Update contracts.rst

This commit is contained in:
cseberino 2016-05-30 15:27:02 -05:00 committed by chriseth
parent 8c5a56d864
commit a20e03135b

View File

@ -23,7 +23,10 @@ name as the contract) is executed once.
From ``web3.js``, i.e. the JavaScript From ``web3.js``, i.e. the JavaScript
API, this is done as follows:: API, this is done as follows::
var source = <<Need to specify some source including contract name for the data param below.>>
// The json abi array generated by the compiler // The json abi array generated by the compiler
var abiArray = [ var abiArray = [
{ {
"inputs":[ "inputs":[
@ -41,12 +44,13 @@ API, this is done as follows::
} }
]; ];
var MyContract = web3.eth.contract(abiArray); var MyContract_ = web3.eth.contract(source);
MyContract = web3.eth.contract(MyContract_.CONTRACT_NAME.info.abiDefinition);
// deploy new contract // deploy new contract
var contractInstance = MyContract.new( var contractInstance = MyContract.new(
10, 10,
11, 11,
{from: myAccount, gas: 1000000} {from: myAccount, gas: 1000000, data = MyContract.CONTRACT_NAME.code}
); );
.. index:: constructor;arguments .. index:: constructor;arguments