Basically I have a dapp that gets the web3 object from window.web3 (the injected from metamask).

When i disable de extention from chrome (not removing, just disabling) the web3 invocations are skipped, no callback is generated.

To Reproduce

  1. Install metamask in your browser
  2. Disable it
  3. In the dapp, send a transaction

My code:

const getData = myContract.myMethod.getData(parameters);
web3.eth.sendTransaction({ from: from, to: CONTRACT_ADDRESS, data: getData }, function (error, result) {
       console.log("Callback !")

I suposse that sendTransaction should fail or throw an error

  • OS: Windows
  • Browser: Tested on chrome and mozilla firefox
  • MetaMask Version: Latest 5.2.2

Any ideas?

The problem is just when is disabled, when the plugin is installed or removed from chrome i get the right responses (the popup shows and an error is throwed respectively)

I have implemented that if user refresh the page the web3 instance get obtained again, and if it is disabled then the web3 object is null. The problem is that the browser doesnt detect the disabling until a reload

I can see that when disabling the webpage shows this warnings, but.. is there any way to detect those events to set the window.web3 object to null or something?

enter image description here

I have created an issue into metamask github: https://github.com/MetaMask/metamask-extension/issues/5936

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.