Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected behavior when there are multiple injected providers #53

Closed
zeosamaster opened this issue Jun 8, 2022 · 1 comment · May be fixed by #66
Closed

Unexpected behavior when there are multiple injected providers #53

zeosamaster opened this issue Jun 8, 2022 · 1 comment · May be fixed by #66

Comments

@zeosamaster
Copy link

Steps to reproduce

  1. Install & setup MetaMask
  2. Install & setup another injected wallet (e.g. CoinbaseWallet)
  3. const provider = await detectEthereumProvider({ mustBeMetaMask: true })
  4. await provider.request({ method: 'eth_requestAccounts' })

Expected behavior

  1. MetaMask wallet prompts for connection
  2. CoinbaseWallet does not prompt for connection

Actual behavior

  1. MetaMask wallet prompts for connection
  2. CoinbaseWallet prompts for connection
@GabrielBuragev
Copy link

Hey @zeosamaster i bumped into this issue and i think that is actually an expected behavior as both providers are stored in the window.ethereum.providers.
You can then filter out the provider you need and use it in your app. Check it out here.

While this is a fortunate case where Coinbase & MetaMask play good together (by storing both objects inside the window.ethereum.providers and lets you choose which one you use), there are cases where other wallet extensions simply overwrite the global window.ethereum object.
I faced an issue where i had "Frame Companion" installed alongside MetaMask and Frame's extension simply overwrites the object which makes any app unusable(cannot detect MetaMask extension) ...

I opened an issue for this as i think this is the right approach so dapps can detect such cases and react (give users feedback that he has conflicting extensions installed).

For now, unfortunately, we cannot really act in such situations and i really hope we can at least get a rejection from the await detectEthereumProvider({ mustBeMetaMask: true }) so we can handle these cases in our dapps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants