Do not rely on web3 injection with new ethereum provider standard #102
Reference in New Issue
Block a user
Delete Branch "chore/ethereum-provider"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.
I'm not sure I understand. This is ported from the official upgrade instructions for Metamask and it comes with
window.ethereumandwindow.Web3(the constructor, not the instance). It is then set asweb3instance onwindow, 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
Web3is undefined, but it injects anwindow.ethereumprovider.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.ethereumand 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. 👍