aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMarek Kotewicz <marek.kotewicz@gmail.com>2015-01-09 23:48:44 +0800
committerMarek Kotewicz <marek.kotewicz@gmail.com>2015-01-09 23:48:44 +0800
commit29c60c000ad81805e73477de51f4acc62acafa68 (patch)
treee223fe0dc50c347a8fa03fe9cf3795485d6295df /lib
parentb3eda29f41b8edecf479e1c7e766211d4ce9334f (diff)
parent92f171ec997fe478cd1e87b8f91ee127b2fb49f3 (diff)
downloadgo-tangerine-29c60c000ad81805e73477de51f4acc62acafa68.tar
go-tangerine-29c60c000ad81805e73477de51f4acc62acafa68.tar.gz
go-tangerine-29c60c000ad81805e73477de51f4acc62acafa68.tar.bz2
go-tangerine-29c60c000ad81805e73477de51f4acc62acafa68.tar.lz
go-tangerine-29c60c000ad81805e73477de51f4acc62acafa68.tar.xz
go-tangerine-29c60c000ad81805e73477de51f4acc62acafa68.tar.zst
go-tangerine-29c60c000ad81805e73477de51f4acc62acafa68.zip
Merge branch 'develop' into tests
Diffstat (limited to 'lib')
-rw-r--r--lib/abi.js2
-rw-r--r--lib/contract.js5
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/abi.js b/lib/abi.js
index 5bfcdaf12..86cd99cf4 100644
--- a/lib/abi.js
+++ b/lib/abi.js
@@ -267,7 +267,7 @@ var methodSignature = function (json, name) {
result += inputTypes.join(',');
result += ')';
- return web3.sha3(result);
+ return web3.sha3(web3.fromAscii(result));
};
module.exports = {
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);
});
},