web3-eth-abi
Advanced tools
Comparing version 1.0.0-beta.20 to 1.0.0-beta.21
{ | ||
"name": "web3-eth-abi", | ||
"version": "1.0.0-beta.20", | ||
"namespace": "ethereum", | ||
"version": "1.0.0-beta.21", | ||
"description": "Web3 module encode and decode EVM in/output.", | ||
@@ -11,5 +12,5 @@ "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-eth-abi", | ||
"underscore": "1.8.3", | ||
"web3-core-helpers": "^1.0.0-beta.20", | ||
"web3-utils": "^1.0.0-beta.20" | ||
"web3-core-helpers": "^1.0.0-beta.21", | ||
"web3-utils": "^1.0.0-beta.21" | ||
} | ||
} |
@@ -69,3 +69,12 @@ /* | ||
var formatInputBytes = function (value) { | ||
if(!utils.isHex(value)) { | ||
throw new Error('Given parameter is not bytes: "'+ value + '"'); | ||
} | ||
var result = value.replace(/^0x/i,''); | ||
if(result.length % 2 !== 0) { | ||
throw new Error('Given parameter bytes has an invalid length: "'+ value + '"'); | ||
} | ||
var l = Math.floor((result.length + 63) / 64); | ||
@@ -84,3 +93,12 @@ result = utils.padRight(result, l * 64); | ||
var formatInputDynamicBytes = function (value) { | ||
if(!utils.isHex(value)) { | ||
throw new Error('Given parameter is not bytes: "'+ value + '"'); | ||
} | ||
var result = value.replace(/^0x/i,''); | ||
if(result.length % 2 !== 0) { | ||
throw new Error('Given parameter bytes has an invalid length: "'+ value + '"'); | ||
} | ||
var length = result.length / 2; | ||
@@ -227,5 +245,5 @@ var l = Math.floor((result.length + 63) / 64); | ||
var length = (new BN(hex, 16)).toNumber() * 2; | ||
return utils.hexToUtf8('0x'+ param.dynamicPart().substr(64, length).replace(/^0x/i, '')); | ||
return length ? utils.hexToUtf8('0x'+ param.dynamicPart().substr(64, length).replace(/^0x/i, '')) : ''; | ||
} else { | ||
return "ERROR: Strings are not yet supported as return values"; | ||
throw new Error('ERROR: The returned value is not a convertible string:'+ hex); | ||
} | ||
@@ -232,0 +250,0 @@ }; |
@@ -376,2 +376,4 @@ /* | ||
inputs.forEach(function (res, i) { | ||
returnValue[i] = (res.type === 'string') ? '' : null; | ||
if (notIndexedParams[i]) { | ||
@@ -378,0 +380,0 @@ returnValue[i] = notIndexedParams[i]; |
@@ -18,3 +18,3 @@ var f = require('../formatters'); | ||
var args = Array.prototype.slice.call(arguments); | ||
args[0] = formatters.inputAddressFormatter(args[0]); | ||
args[0] = (!args[0] || args[0] === '0x0') ? '' : formatters.inputAddressFormatter(args[0]); | ||
return f.formatInputInt.apply(this, args); | ||
@@ -21,0 +21,0 @@ }; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38003
1075