olekon / justsmartcontracts

justsmartcontracts.dev source code
MIT License
62 stars 48 forks source link

Don't work with the latest version of the Metamask extension #5

Open in19farkt opened 3 years ago

in19farkt commented 3 years ago

Metamask no longer inject Web3 into the global https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3. This leads to an error when trying to connect Metamask on the contract/operations page.

Workaround:

  1. open developer tools
  2. past code snippet, and press "Enter"
    (function(d, script) {
      script = d.createElement('script');
      script.type = 'text/javascript';
      script.async = true;
      script.src = 'https://unpkg.com/@metamask/legacy-web3@latest/dist/metamask.web3.min.js';
      d.getElementsByTagName('head')[0].appendChild(script);
    }(document));
  3. go to Contract/Operations page and connect Metamask