diff options
author | Marek Kotewicz <marek.kotewicz@gmail.com> | 2015-01-27 22:20:22 +0800 |
---|---|---|
committer | Marek Kotewicz <marek.kotewicz@gmail.com> | 2015-01-27 22:20:22 +0800 |
commit | 09f633596da91818201781cc009e1e1ab6f8d059 (patch) | |
tree | ffbbd41d94f8fca0d2139cf745141073549f0921 /lib/web3.js | |
parent | 42a25f2f26f14a0b0ecfca31b5000f7a1d50240a (diff) | |
download | go-tangerine-09f633596da91818201781cc009e1e1ab6f8d059.tar go-tangerine-09f633596da91818201781cc009e1e1ab6f8d059.tar.gz go-tangerine-09f633596da91818201781cc009e1e1ab6f8d059.tar.bz2 go-tangerine-09f633596da91818201781cc009e1e1ab6f8d059.tar.lz go-tangerine-09f633596da91818201781cc009e1e1ab6f8d059.tar.xz go-tangerine-09f633596da91818201781cc009e1e1ab6f8d059.tar.zst go-tangerine-09f633596da91818201781cc009e1e1ab6f8d059.zip |
fixed #23
Diffstat (limited to 'lib/web3.js')
-rw-r--r-- | lib/web3.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/web3.js b/lib/web3.js index 7cf624c9c..622be29b6 100644 --- a/lib/web3.js +++ b/lib/web3.js @@ -233,7 +233,9 @@ var web3 = { /// @returns decimal representaton of hex value prefixed by 0x toDecimal: function (val) { - return (new BigNumber(val.substring(2), 16).toString(10)); + // remove 0x and place 0, if it's required + val = val.length > 2 ? val.substring(2) : "0"; + return (new BigNumber(val, 16).toString(10)); }, /// @returns hex representation (prefixed by 0x) of decimal value |