I use web3.js and try to take a value of the variable from the smart contract.
My code for it is:
var contract = web3.eth.contract(abi).at(address);
where abi - json array and address - valid working address.
Part of abi json object is
{
"constant": true,
"inputs": [],
"name": "weiRaised",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"type": "function"
},
When I use this code:
console.log(contract.abi[0].abi[6].name);
I see "weiRaised" in the console.
But if I use
console.log(contract.abi[0].abi[6].inputs);
I see 'undefined'.
What I am doing wrong? How Can I get the variable from the smart contract, based on abi and web3.js?