diff options
author | Marek Kotewicz <marek.kotewicz@gmail.com> | 2015-01-09 20:07:34 +0800 |
---|---|---|
committer | Marek Kotewicz <marek.kotewicz@gmail.com> | 2015-01-09 20:07:34 +0800 |
commit | b3eda29f41b8edecf479e1c7e766211d4ce9334f (patch) | |
tree | 0af08c3133f7a0c94b8591ffd8aed010fb707f29 /lib/abi.js | |
parent | c397e350f4903b13af901762547fcc4d7905d8cd (diff) | |
parent | a5907a8239c2d60ee5491ae2a33b105480798c6a (diff) | |
download | go-tangerine-b3eda29f41b8edecf479e1c7e766211d4ce9334f.tar go-tangerine-b3eda29f41b8edecf479e1c7e766211d4ce9334f.tar.gz go-tangerine-b3eda29f41b8edecf479e1c7e766211d4ce9334f.tar.bz2 go-tangerine-b3eda29f41b8edecf479e1c7e766211d4ce9334f.tar.lz go-tangerine-b3eda29f41b8edecf479e1c7e766211d4ce9334f.tar.xz go-tangerine-b3eda29f41b8edecf479e1c7e766211d4ce9334f.tar.zst go-tangerine-b3eda29f41b8edecf479e1c7e766211d4ce9334f.zip |
Merge branch 'master' into tests
Diffstat (limited to 'lib/abi.js')
-rw-r--r-- | lib/abi.js | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/abi.js b/lib/abi.js index e37f477ee..5bfcdaf12 100644 --- a/lib/abi.js +++ b/lib/abi.js @@ -140,7 +140,6 @@ var toAbiInput = function (json, methodName, params) { return; } - bytes = "0x" + padLeft(index.toString(16), 2); var method = json[index]; for (var i = 0; i < method.inputs.length; i++) { @@ -259,8 +258,21 @@ var outputParser = function (json) { return parser; }; +var methodSignature = function (json, name) { + var method = json[findMethodIndex(json, name)]; + var result = name + '('; + var inputTypes = method.inputs.map(function (inp) { + return inp.type; + }); + result += inputTypes.join(','); + result += ')'; + + return web3.sha3(result); +}; + module.exports = { inputParser: inputParser, - outputParser: outputParser + outputParser: outputParser, + methodSignature: methodSignature }; |