diff options
author | Gav Wood <i@gavwood.com> | 2015-01-25 09:42:49 +0800 |
---|---|---|
committer | Gav Wood <i@gavwood.com> | 2015-01-25 09:42:49 +0800 |
commit | 7869294a26b00983df6fb64fab6a11e4c11c38ff (patch) | |
tree | f457a0920fbef3fd7f6b6148ddb08b61508e4d1c /lib | |
parent | 61a01588778116b19d3a81fa4d795641e8b8de12 (diff) | |
download | go-tangerine-7869294a26b00983df6fb64fab6a11e4c11c38ff.tar go-tangerine-7869294a26b00983df6fb64fab6a11e4c11c38ff.tar.gz go-tangerine-7869294a26b00983df6fb64fab6a11e4c11c38ff.tar.bz2 go-tangerine-7869294a26b00983df6fb64fab6a11e4c11c38ff.tar.lz go-tangerine-7869294a26b00983df6fb64fab6a11e4c11c38ff.tar.xz go-tangerine-7869294a26b00983df6fb64fab6a11e4c11c38ff.tar.zst go-tangerine-7869294a26b00983df6fb64fab6a11e4c11c38ff.zip |
Fixes to ethereum.js and standard.js.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/contract.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/contract.js b/lib/contract.js index 498908d37..b05a6cc90 100644 --- a/lib/contract.js +++ b/lib/contract.js @@ -37,7 +37,7 @@ var abi = require('./abi'); * var myContract = web3.eth.contract('0x0123123121', abi); // creation of contract object * * myContract.myMethod('this is test string param for call'); // myMethod call (implicit, default) - * myContract.myMethod('this is test string param for call').call(); // myMethod call (explicit) + * myContract.call().myMethod('this is test string param for call'); // myMethod call (explicit) * myContract.transact().myMethod('this is test string param for transact'); // myMethod transact * * @param address - address of the contract, which should be called @@ -46,6 +46,18 @@ var abi = require('./abi'); */ var contract = function (address, desc) { + + desc.forEach(function (method) { + // workaround for invalid assumption that method.name is the full anonymous prototype of the method. + // it's not. it's just the name. the rest of the code assumes it's actually the anonymous + // prototype, so we make it so as a workaround. + if (method.name.indexOf('(') === -1) { + var displayName = method.name; + var typeName = method.inputs.map(function(i){return i.type}).join(); + method.name = displayName + '(' + typeName + ')'; + } + }); + var inputParser = abi.inputParser(desc); var outputParser = abi.outputParser(desc); |