diff options
Diffstat (limited to 'lib/contract.js')
-rw-r--r-- | lib/contract.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/contract.js b/lib/contract.js index 1a03849bf..4cb202255 100644 --- a/lib/contract.js +++ b/lib/contract.js @@ -27,6 +27,9 @@ if (process.env.NODE_ENV !== 'build') { var abi = require('./abi'); +// method signature length in bytes +var ETH_METHOD_SIGNATURE_LENGTH = 4; + var contract = function (address, desc) { var inputParser = abi.inputParser(desc); var outputParser = abi.outputParser(desc); @@ -47,7 +50,7 @@ var contract = function (address, desc) { extra = extra || {}; extra.to = address; return abi.methodSignature(desc, method.name).then(function (signature) { - extra.data = signature.slice(0, 10) + parsed; + extra.data = signature.slice(0, 2 + ETH_METHOD_SIGNATURE_LENGTH * 2) + parsed; return web3.eth.call(extra).then(onSuccess); }); }, |