I have deployed a contract in a private blockchain using remix and ganache. Now I want to interact with it trough web3 and the console from my browser, but I'm not managing to interact with the contract functions in the browser. This in my index.html:
index.html
var simpleStorageAbi =
[
{
"constant": false,
"inputs": [],
"name": "getValue",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "val",
"type": "uint256"
}
],
"name": "setValue",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"constant": true,
"inputs": [],
"name": "value",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
}
];
var SimpleStorageContract = new web3.eth.Contract(simpleStorageAbi);
var simpleStorageInstance = new web3.eth.Contract(simpleStorageAbi, "(address)");
When I open the console from the browser the contract I type:
simpleStorageInstance
and I would expect the contract functions:
{…}
> getValue
> setValue
> value
instead I get this
Contract {_requestManager: RequestManager, givenProvider: null, providers: {…}, setProvider: ƒ, …}
BatchRequest: ƒ ()
clearSubscriptions: ƒ (keepIsSyncing)
currentProvider: (...)
defaultAccount: (...)
defaultBlock: (...)
defaultChain: (...)
defaultCommon: (...)
defaultHardfork: (...)
events: {allEvents: ƒ}
extend: ƒ ex(extension)
givenProvider: null
handleRevert: (...)
methods: {getValue: ƒ, 0x20965255: ƒ, getValue(): ƒ, setValue: ƒ, 0x} etc
I tried accessing the functions in this way
simpleStorageInstance.methods.setValue(5);
but I get nothing in return (no transaction returned).
{arguments: Array(1), call: ƒ, send: ƒ, encodeABI: ƒ, estimateGas: ƒ, …}
What am I doing wrong?