diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/abi.js | 12 | ||||
-rw-r--r-- | lib/contract.js | 6 |
2 files changed, 16 insertions, 2 deletions
diff --git a/lib/abi.js b/lib/abi.js index 86cd99cf4..cae4f7519 100644 --- a/lib/abi.js +++ b/lib/abi.js @@ -92,6 +92,12 @@ var setupInputTypes = function () { } var padding = calcPadding(type, expected); + if (padding > 32) + return false; // not allowed to be so big. + padding = 32; // override as per the new ABI. + + if (prefix === "string") + return web3.fromAscii(value, padding).substr(2); if (typeof value === "number") value = value.toString(16); else if (typeof value === "string") @@ -110,6 +116,8 @@ var setupInputTypes = function () { return false; } + padding = 32; //override as per the new ABI. + return padLeft(formatter ? formatter(value) : value, padding * 2); }; }; @@ -165,12 +173,16 @@ var setupOutputTypes = function () { } var padding = calcPadding(type, expected); + if (padding > 32) + return -1; // not allowed to be so big. + padding = 32; // override as per the new ABI. return padding * 2; }; }; var namedType = function (name, padding) { return function (type) { + padding = 32; // override as per the new ABI. return name === type ? padding * 2 : -1; }; }; diff --git a/lib/contract.js b/lib/contract.js index 4cb202255..eb7fbf018 100644 --- a/lib/contract.js +++ b/lib/contract.js @@ -57,8 +57,10 @@ var contract = function (address, desc) { transact: function (extra) { extra = extra || {}; extra.to = address; - extra.data = parsed; - return web3.eth.transact(extra).then(onSuccess); + return abi.methodSignature(desc, method.name).then(function (signature) { + extra.data = signature.slice(0, 2 + ETH_METHOD_SIGNATURE_LENGTH * 2) + parsed; + return web3.eth.transact(extra).then(onSuccess); + }); } }; }; |