aboutsummaryrefslogtreecommitdiffstats
path: root/lib/contract.js
diff options
context:
space:
mode:
authorMarek Kotewicz <marek.kotewicz@gmail.com>2015-01-16 00:27:07 +0800
committerMarek Kotewicz <marek.kotewicz@gmail.com>2015-01-16 00:27:07 +0800
commit6d02c0d392762203dc150203ce0f315654aed5c2 (patch)
treee6c51635dae8245effc9b570de4f8cb00a117b1c /lib/contract.js
parent508f116738517efc8c21233e9d50349ba30e223c (diff)
parentec74fc05d438806ece64fe34b0f28c8f45f5167e (diff)
downloaddexon-6d02c0d392762203dc150203ce0f315654aed5c2.tar
dexon-6d02c0d392762203dc150203ce0f315654aed5c2.tar.gz
dexon-6d02c0d392762203dc150203ce0f315654aed5c2.tar.bz2
dexon-6d02c0d392762203dc150203ce0f315654aed5c2.tar.lz
dexon-6d02c0d392762203dc150203ce0f315654aed5c2.tar.xz
dexon-6d02c0d392762203dc150203ce0f315654aed5c2.tar.zst
dexon-6d02c0d392762203dc150203ce0f315654aed5c2.zip
Merge commit '1a6dbeff6e86d65cae6d7db366cbaa4182eaff7f' into ethereumjs
Conflicts: libjsqrc/ethereumjs/dist/ethereum.js libjsqrc/ethereumjs/dist/ethereum.js.map libjsqrc/ethereumjs/dist/ethereum.min.js libjsqrc/ethereumjs/lib/abi.js
Diffstat (limited to 'lib/contract.js')
-rw-r--r--lib/contract.js23
1 files changed, 22 insertions, 1 deletions
diff --git a/lib/contract.js b/lib/contract.js
index eb7fbf018..52ce08705 100644
--- a/lib/contract.js
+++ b/lib/contract.js
@@ -27,9 +27,29 @@ if (process.env.NODE_ENV !== 'build') {
var abi = require('./abi');
-// method signature length in bytes
+/// method signature length in bytes
var ETH_METHOD_SIGNATURE_LENGTH = 4;
+/**
+ * This method should be called when we want to call / transact some solidity method from javascript
+ * it returns an object which has same methods available as solidity contract description
+ * usage example:
+ *
+ * var abi = [{
+ * name: 'myMethod',
+ * inputs: [{ name: 'a', type: 'string' }],
+ * outputs: [{name: 'd', type: 'string' }]
+ * }]; // contract abi
+ *
+ * var myContract = web3.eth.contract('0x0123123121', abi); // creation of contract object
+ *
+ * myContract.myMethod('this is test string param for call').call(); // myMethod call
+ * myContract.myMethod('this is test string param for transact').transact() // myMethod transact
+ *
+ * @param address - address of the contract, which should be called
+ * @param desc - abi json description of the contract, which is being created
+ * @returns contract object
+ */
var contract = function (address, desc) {
var inputParser = abi.inputParser(desc);
var outputParser = abi.outputParser(desc);
@@ -70,3 +90,4 @@ var contract = function (address, desc) {
};
module.exports = contract;
+