diff options
author | Marek Kotewicz <marek.kotewicz@gmail.com> | 2015-01-22 04:54:51 +0800 |
---|---|---|
committer | Marek Kotewicz <marek.kotewicz@gmail.com> | 2015-01-22 04:54:51 +0800 |
commit | ad8e92e9c67b82b0e8156345776bafe1c3e07d51 (patch) | |
tree | 9eb59d09860f1600f4048d26580f43576cb45f1e /lib/abi.js | |
parent | 81ff253e68bbc700ff093adcff0a21469460b4b8 (diff) | |
parent | edfb874527160cee14cca931377e55187b874cbe (diff) | |
download | dexon-ad8e92e9c67b82b0e8156345776bafe1c3e07d51.tar dexon-ad8e92e9c67b82b0e8156345776bafe1c3e07d51.tar.gz dexon-ad8e92e9c67b82b0e8156345776bafe1c3e07d51.tar.bz2 dexon-ad8e92e9c67b82b0e8156345776bafe1c3e07d51.tar.lz dexon-ad8e92e9c67b82b0e8156345776bafe1c3e07d51.tar.xz dexon-ad8e92e9c67b82b0e8156345776bafe1c3e07d51.tar.zst dexon-ad8e92e9c67b82b0e8156345776bafe1c3e07d51.zip |
Merge commit 'eb4984c0d036c1420e782ca136810e851e33fb37' into natspec
Diffstat (limited to 'lib/abi.js')
-rw-r--r-- | lib/abi.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/abi.js b/lib/abi.js index c896ab28a..21580347d 100644 --- a/lib/abi.js +++ b/lib/abi.js @@ -32,6 +32,9 @@ BigNumber.config({ ROUNDING_MODE: BigNumber.ROUND_DOWN }); var ETH_PADDING = 32; +/// method signature length in bytes +var ETH_METHOD_SIGNATURE_LENGTH = 4; + /// Finds first index of array element matching pattern /// @param array /// @param callback pattern @@ -389,11 +392,10 @@ var outputParser = function (json) { return parser; }; -/// @param json abi for contract /// @param method name for which we want to get method signature /// @returns (promise) contract method signature for method with given name -var methodSignature = function (json, name) { - return web3.sha3(web3.fromAscii(name)); +var methodSignature = function (name) { + return web3.sha3(web3.fromAscii(name)).slice(0, 2 + ETH_METHOD_SIGNATURE_LENGTH * 2); }; module.exports = { |