aboutsummaryrefslogtreecommitdiffstats
path: root/lib/abi.js
diff options
context:
space:
mode:
authorMarek Kotewicz <marek.kotewicz@gmail.com>2015-01-22 04:12:07 +0800
committerMarek Kotewicz <marek.kotewicz@gmail.com>2015-01-22 04:12:07 +0800
commitc9693b47467f16a6f35be6de85f57244b70d7a01 (patch)
tree0df54c99eb4a1529123f27be8bfe321cc1539cfa /lib/abi.js
parentceb4357a8d66e5112369293b15247f03c561c514 (diff)
downloadgo-tangerine-c9693b47467f16a6f35be6de85f57244b70d7a01.tar
go-tangerine-c9693b47467f16a6f35be6de85f57244b70d7a01.tar.gz
go-tangerine-c9693b47467f16a6f35be6de85f57244b70d7a01.tar.bz2
go-tangerine-c9693b47467f16a6f35be6de85f57244b70d7a01.tar.lz
go-tangerine-c9693b47467f16a6f35be6de85f57244b70d7a01.tar.xz
go-tangerine-c9693b47467f16a6f35be6de85f57244b70d7a01.tar.zst
go-tangerine-c9693b47467f16a6f35be6de85f57244b70d7a01.zip
contract.html example is working with sync api
Diffstat (limited to 'lib/abi.js')
-rw-r--r--lib/abi.js8
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 = {