detect-provider icon indicating copy to clipboard operation
detect-provider copied to clipboard

No provider selected for request eth_chainId when coinbase wallet extension is installed

Open vinceprofeta opened this issue 4 years ago • 3 comments

Repro: Install Coinbase Wallet

const prov: any = await detectEthereumProvider({ mustBeMetaMask: true });
const chainId: string = await prov.request({ method: 'eth_chainId' });
Error: No provider selected for request eth_chainId

From the docs: This may happen, for example, if the user has multiple wallets installed. After confirming that your code and dependencies are not modifying or overwriting window.ethereum, you should ask the user to ensure that they only have a single provider-injecting wallet enabled at any one time.

Any solutions other than messaging?

vinceprofeta avatar Oct 26 '21 16:10 vinceprofeta

Any progress on this? I'm having a similar issue.

s1mplejac avatar Jan 18 '22 00:01 s1mplejac

This helped: https://ethereum.stackexchange.com/questions/111605/how-can-i-connect-my-dapp-to-metamask-if-coinbase-wallet-injects-another-ethere

s1mplejac avatar Jan 18 '22 02:01 s1mplejac

useEffect(() => {
        if (isMetaMaskInstalled()) {
            if (window.ethereum.providers.length > 1) {
                const metamaskProvider = window.ethereum.providers.find((provider) => provider.isMetaMask);
                window.ethereum = metamaskProvider;
            }
        }
}, []);

matricore avatar Mar 04 '23 10:03 matricore