diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/contract.js | 9 | ||||
-rw-r--r-- | lib/web3.js | 9 |
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/contract.js b/lib/contract.js index 418f87df7..95cc7bbd6 100644 --- a/lib/contract.js +++ b/lib/contract.js @@ -75,6 +75,15 @@ var contract = function (address, desc) { return result; }; + result._options = {}; + ['gas', 'gasPrice', 'value', 'from'].forEach(function(p) { + result[p] = function (v) { + result._options[p] = v; + return result; + }; + }); + + desc.forEach(function (method) { var displayName = abi.methodDisplayName(method.name); diff --git a/lib/web3.js b/lib/web3.js index 7191adfe8..fde3cce75 100644 --- a/lib/web3.js +++ b/lib/web3.js @@ -268,6 +268,15 @@ var web3 = { /// eth object prototype eth: { + contractFromAbi: function (abi) { + return function(addr) { + // Default to address of Config. TODO: rremove prior to genesis. + addr = addr || '0xc6d9d2cd449a754c494264e1809c50e34d64562b'; + var ret = web3.eth.contract(addr, abi); + ret.address = addr; + return ret; + }; + }, watch: function (params) { return new web3.filter(params, ethWatch); } |