I am building a web3 app where I have added support for metamask and coinbase wallet using web3modal package. The setup looks something like this:
- Configure providers
import CoinbaseWalletSDK from "@coinbase/wallet-sdk";
export const providerOptions = {
walletlink: {
package: CoinbaseWalletSDK, // Required
options: {
appName: "Web 3 Modal Demo", // Required
infuraId: process.env.INFURA_KEY // Required unless you provide a JSON RPC url; see `rpc` below
}
}
};
- Create a Web3Modal instance
const web3Modal = new Web3Modal({
network: "mainnet", // optional
cacheProvider: true, // optional
providerOptions, // required
disableInjectedProvider: true
});
- Finally calling
web3Modal.connect()
in something like aConnect Wallet
button click event handler to connect to a wallet.
With these steps I am successfull in connecting wallet in desktop browsers. But for mobile browsers, I am having some issues. I have been able to make metamask deeplink work. But for coinbase, not so much. It seems as thought the coinbase sdk it self comes out of the box with deeplink support in mobile. I say that because from the coinbase wallet docs: https://docs.cloud.coinbase.com/wallet-sdk/docs/web3modal , I got the codesandbox link to a working example, and when I open that project in mobile browser, the coinbase wallet deeplink works just fine. In that project's codebase, I do not see anything that is extra from what I have done. You can find that working example at: https://j43b10.csb.app/ ( this is from coinbase docs).
I am just not able to understand what I am doing wrong or different than that example project that has made coinbase deeplink not work. If you have any ideas or suggestion, please help. thanks
Oh! and one last thing. These are the versions of packages that I am using:
"@coinbase/wallet-sdk": "3.6.0",
"web3modal": "^1.9.5",
"web3": "^1.7.0",
It seems downgrading conibase wallet sdk to
3.0.1
makes the deep link work. Dont know why in the latest version the deeplink was not working. Maybe its a bug.