diff options
author | Marek Kotewicz <marek.kotewicz@gmail.com> | 2015-01-09 20:30:14 +0800 |
---|---|---|
committer | Marek Kotewicz <marek.kotewicz@gmail.com> | 2015-01-09 20:30:14 +0800 |
commit | 543a87c63f77a61fb91a07515c2f6383b791a27d (patch) | |
tree | 7f1e5e7eb01bca56f02ca641d4886c47690ca3c5 /lib/contract.js | |
parent | a5907a8239c2d60ee5491ae2a33b105480798c6a (diff) | |
download | go-tangerine-543a87c63f77a61fb91a07515c2f6383b791a27d.tar go-tangerine-543a87c63f77a61fb91a07515c2f6383b791a27d.tar.gz go-tangerine-543a87c63f77a61fb91a07515c2f6383b791a27d.tar.bz2 go-tangerine-543a87c63f77a61fb91a07515c2f6383b791a27d.tar.lz go-tangerine-543a87c63f77a61fb91a07515c2f6383b791a27d.tar.xz go-tangerine-543a87c63f77a61fb91a07515c2f6383b791a27d.tar.zst go-tangerine-543a87c63f77a61fb91a07515c2f6383b791a27d.zip |
method signature length defined
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); }); }, |