I'm trying to simulate a transaction on the public blockchain that invokes a contract's method with certain parameters. Then I want to make a follow-up transaction with some other method call.
I figured that I can use call()
function in the JavaScript console to invoke a method without actually publishing a real transaction, e.g:
var abi = [...];
var contractAddress = "0x...";
var contract = web3.eth.contract(abi).at(contractAddress);
contract.updateSomething.call(...); // change some values
The problem now is: How can I make another call that uses the updated state of the contract?
If I just use another call()
it returns the old value, not the updated one.
...
contract.updateSomething.call(...); // change some values
contract.readSomething.call(); // returns old value