providers documentation

This commit is contained in:
Marek Kotewicz
2015-01-14 12:01:11 +01:00
parent 8d1f96cc0a
commit 12bdb5f550
6 changed files with 108 additions and 11 deletions

View File

@ -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').cal(); // 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;