0

I use react and web3 to interact with metamask. Until yesterday every thing was fine. but, today some of the transaction results are not returning. I use this code to load web3

let web3
if (window.ethereum) {
  web3 = new Web3(window.ethereum)
  await window.ethereum.enable();
  this.setState({web3: web3})
}
else {
  window.alert('Non-Ethereum browser detected. You should consider trying MetaMask!')
}

when I, want to use send().on('receipt')... its not returning anything. but send().on(transactionHash)works fine I have no clue why would receipt suddenly stops to work. here is the code

contractInstance.methods.transferOwnership(newOwner).send({from: 
accounts[0]}).on('receipt', function(receipt){
        console.log("events of transfer ownership" , receipt.events)
     })

I mean the function works fine and the ownership transfers, but the receipt is not working at all

Your Answer

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

Browse other questions tagged or ask your own question.