aboutsummaryrefslogtreecommitdiffstats
path: root/dist/ethereum.js
diff options
context:
space:
mode:
authorMarek Kotewicz <marek.kotewicz@gmail.com>2015-01-15 23:01:58 +0800
committerMarek Kotewicz <marek.kotewicz@gmail.com>2015-01-15 23:01:58 +0800
commitec74fc05d438806ece64fe34b0f28c8f45f5167e (patch)
treeff11239c13765f41571840035f2dee633f9eeaab /dist/ethereum.js
parent46b932ccc03b0251d97084bbbde5193532b5618f (diff)
downloadgo-tangerine-ec74fc05d438806ece64fe34b0f28c8f45f5167e.tar
go-tangerine-ec74fc05d438806ece64fe34b0f28c8f45f5167e.tar.gz
go-tangerine-ec74fc05d438806ece64fe34b0f28c8f45f5167e.tar.bz2
go-tangerine-ec74fc05d438806ece64fe34b0f28c8f45f5167e.tar.lz
go-tangerine-ec74fc05d438806ece64fe34b0f28c8f45f5167e.tar.xz
go-tangerine-ec74fc05d438806ece64fe34b0f28c8f45f5167e.tar.zst
go-tangerine-ec74fc05d438806ece64fe34b0f28c8f45f5167e.zip
gulp
Diffstat (limited to 'dist/ethereum.js')
-rw-r--r--dist/ethereum.js16
1 files changed, 13 insertions, 3 deletions
diff --git a/dist/ethereum.js b/dist/ethereum.js
index 204eb0dde..f4e0e6eac 100644
--- a/dist/ethereum.js
+++ b/dist/ethereum.js
@@ -58,9 +58,10 @@ var findMethodIndex = function (json, methodName) {
/// @param string string to be padded
/// @param number of characters that result string should have
+/// @param sign, by default 0
/// @returns right aligned string
-var padLeft = function (string, chars) {
- return new Array(chars - string.length + 1).join("0") + string;
+var padLeft = function (string, chars, sign) {
+ return new Array(chars - string.length + 1).join(sign ? sign : "0") + string;
};
/// @param expected type prefix (string)
@@ -87,8 +88,17 @@ var setupInputTypes = function () {
/// @returns right-aligned byte representation of int
var formatInt = function (value) {
var padding = 32 * 2;
- if (typeof value === 'number')
+ if (typeof value === 'number') {
+ if (value < 0) {
+
+ // two's complement
+ // TODO: fix big numbers support
+ value = ((value) >>> 0).toString(16);
+ return padLeft(value, padding, 'f');
+ }
value = value.toString(16);
+
+ }
else if (value.indexOf('0x') === 0)
value = value.substr(2);
else if (typeof value === 'string')