0

I added a new function exampleFunc in solidity the mycontract.json file gets updated with that function with public visibility but web3.eth.contract(abiArray).at(address); does not contains the newly added function.

var con = require('../../build/contracts/MyContract.json');
var keys = Object.keys(con.networks);
var address = con.networks[keys[keys.length-1]].address;
var abiArray = con.abi;


componentDidMount(){
        const web3 = new Web3(window.web3.currentProvider);
        this.instance = web3.eth.contract(abiArray).at(address);
        console.log(this.instance);
}
1

delete your 'build' folder and recompile..for some reason its like a magic cure when it comes to truffle

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.