Closed bumi closed 5 years ago
I'm not sure I understand. This is ported from the official upgrade instructions for Metamask and it comes with window.ethereum
and window.Web3
(the constructor, not the instance). It is then set as web3
instance on window
, so that the APIs are the same.
Am I missing something? Or is there a particular wallet that doesn't work this way perhaps?
When I tried the app in opera I get the error that Web3
is undefined, but it injects an window.ethereum
provider.
Looking at the metamask documentation here it seems that window.ethereum == window.web3.currentProvider. So there is no need to initialize another Web3 object.
It seems the new global API only injects window.ethereum
and no Web3 is available. (which somehow makes sense as for example we use ethers and no full web3 is needed at all)
Ah, I see. Thanks. :+1:
when window.ethereum is available web3 is likely not available as the browser uses the new provider standard. So we either user the window.ethereum as provider or the web3.currentProvider as legacy option.