Here is my code Sample in js script connected to ContractInstance through web3:
ContractInstance.Fire(function(error,res){
if(!error){ContractInstance.dead.call(function(err, result){
console.log(result);});}
});
ContractInstance.dead.call(function(err, result){
console.log(result) });
- So when I call fire function of contract then my dead variable changes to true (I confirm it in remix )
- And then I call dead variable inside Fire function.
- Somehow it prints false in the console, but later when I call it outside the function it prints true.
I don't know why this is happening maybe because
when I call fire function it stops for a while because metamask asks for confirmation .
or it might be due to the fact that it does not update in the contract so quickly.
Can somebody help me how should I call dead variable just after the the fire function is called ?