I'd be curious to understand what the use case is where you only want to support Metamask at window.ethereum? The benefit is mainly that dapps continue to work without being aware that there are multiple wallets at window.ethereum. This is one solution to the problem of having a single window.ethereum interface. For chainId it returns 0x1 unless there is a selected provider (2 or 4 above) in which case it returns that selected provider's chain id.It also implements the isMetaMask method, which returns true if one of the providers has isMetaMask set to true (this is necessary since some dapps will not work if window.ethereum has isMetaMask set to false).Whichever one the user approves first, becomes the selected provider.When the dapp requests ethereum accounts (eip1102), it will initiate the eip1102 request on all providers it has registered (hence the multiple popups).If one of those providers is already connected ( is defined), it selects that provider.It keeps a list of providers if it discovers more than one is being registered at window.ethereum.In the case where the user has both Coinbase Wallet extension and Metamask installed, the current approach is to inject a 'multi' provider at window.ethereum that has the following logic: The tl dr is that the multiple popups actually do give the user a choice - whichever wallet they approve is the one that is selected as the ethereum provider. When we created the Coinbase Wallet extension, we needed a way to support users having both Coinbase Wallet extension and Metamask installed at the same time - without updating dapps and without making the user enable / disable one of the extensions each time they use a dapp. Most dapps look for the window.ethereum object as the 'injected' provider.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |