aboutsummaryrefslogtreecommitdiffstats
path: root/dist/ethereum.js
diff options
context:
space:
mode:
authorMarek Kotewicz <marek.kotewicz@gmail.com>2015-01-16 18:58:26 +0800
committerMarek Kotewicz <marek.kotewicz@gmail.com>2015-01-16 18:58:26 +0800
commit2c36d5ff457952c557b467e580514b08126d7dd7 (patch)
treea1825d9b12c7c01841462698975a582731b9fa5f /dist/ethereum.js
parentf1295b506d11f79048bb86d96a7f28224f0dd04c (diff)
downloadgo-tangerine-2c36d5ff457952c557b467e580514b08126d7dd7.tar
go-tangerine-2c36d5ff457952c557b467e580514b08126d7dd7.tar.gz
go-tangerine-2c36d5ff457952c557b467e580514b08126d7dd7.tar.bz2
go-tangerine-2c36d5ff457952c557b467e580514b08126d7dd7.tar.lz
go-tangerine-2c36d5ff457952c557b467e580514b08126d7dd7.tar.xz
go-tangerine-2c36d5ff457952c557b467e580514b08126d7dd7.tar.zst
go-tangerine-2c36d5ff457952c557b467e580514b08126d7dd7.zip
big integers on abi.js output, tests
Diffstat (limited to 'dist/ethereum.js')
-rw-r--r--dist/ethereum.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/dist/ethereum.js b/dist/ethereum.js
index b69f51c75..0a26b832f 100644
--- a/dist/ethereum.js
+++ b/dist/ethereum.js
@@ -176,7 +176,16 @@ var setupOutputTypes = function () {
/// Formats input right-aligned input bytes to int
/// @returns right-aligned input bytes formatted to int
var formatInt = function (value) {
- return value.length <= 8 ? +parseInt(value, 16) : hexToDec(value);
+ // check if it's negative number
+ // it it is, return two's complement
+ if (value.substr(0, 1).toLowerCase() === 'f') {
+ return new BigNumber(value, 16).minus(new BigNumber('ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 16)).minus(1);
+ }
+ return new BigNumber(value, 16);
+ };
+
+ var formatUInt = function (value) {
+ return new BigNumber(value, 16);
};
/// @returns right-aligned input bytes formatted to hex
@@ -200,7 +209,7 @@ var setupOutputTypes = function () {
};
return [
- { type: prefixedType('uint'), format: formatInt },
+ { type: prefixedType('uint'), format: formatUInt },
{ type: prefixedType('int'), format: formatInt },
{ type: prefixedType('hash'), format: formatHash },
{ type: prefixedType('string'), format: formatString },