Unverified Commit 696567fc authored by yann300's avatar yann300 Committed by GitHub

Merge pull request #1137 from andremedeiros/fix/handle-bignumber-conversion-on-hash-without-prefix

fix: handle bignumber conversion on hash without prefix
parents de7f09f1 58eb6962
...@@ -75,8 +75,8 @@ async function extractHexValue (location, storageResolver, byteLength) { ...@@ -75,8 +75,8 @@ async function extractHexValue (location, storageResolver, byteLength) {
function toBN (value) { function toBN (value) {
if (value instanceof BN) { if (value instanceof BN) {
return value return value
} else if (value.indexOf && value.indexOf('0x') === 0) { } else if (value.match && value.match(/^(?:0x)?(?<hash>[a-f0-9])*$/)) {
value = ethutil.unpad(value.replace('Ox', '')) value = ethutil.unpad(value.replace(/^(0x)/, ''))
value = new BN(value === '' ? '0' : value, 16) value = new BN(value === '' ? '0' : value, 16)
} else if (!isNaN(value)) { } else if (!isNaN(value)) {
value = new BN(value) value = new BN(value)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment