This commit is contained in:
Marek Kotewicz
2015-01-27 15:20:22 +01:00
parent 42a25f2f26
commit 09f633596d
6 changed files with 46 additions and 6 deletions

View File

@ -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