I would like to reload the React Web3 wallet's page upon MetaMask Confirmation. Meaning when the ERC-20 token send transaction is confirmed, the page should reload or state should update to display the new balance.

In this transfer function, the pseudo-code starts with ".on()":

function refreshPage() {

transfer(recipient, amount) {
  this.state.waviiiToken.methods.transfer(recipient, amount).send({ from: this.state.account })
  .on('confirmation' refreshPage);

Please let me know if this is possible or if you have an example I can reference that updates state or refreshes the page.


I added a window.location.reload() after successful transaction (my web3 await function). This works on local test net but will have to do some more digging due to the longer wait times on the Main Net and other Test Nets.

** EDIT **

Thanks @JaxCoder, This helped me find the solution. window.location.reload() was part of it. To make sure the loader / progress bar keeps running until full confirmation of the transaction is received, the following is the solution:

transfer(recipient, amount) {
  this.setState({ loading: true })
  this.state.waviiiToken.methods.transfer(recipient, amount).send({ from: this.state.account }).on('confirmation', (reciept) => {
    this.setState({ loading: false })
  • 3
    The confirmation time on mainnet might be in the class of 1-2 minutes. You cannot do much about that except design your app user experience differently. – Mikko Ohtamaa Apr 27 '20 at 19:40
  • 1
    Thanks @JaxCoder, this lead me to the solution. – Luc1d May 8 '20 at 5:40
  • I am glad it helped @Luc1d ! – JaxCoder May 8 '20 at 16:28

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.