-
Notifications
You must be signed in to change notification settings - Fork 541
Description
Is your request related to a problem?
With WalletConnect the Dapp tells the wallet which network to connect to on establishing the connection.
Currently, when onboard library is configured, even if chainId of 1 is not even specified, a walletconnect session request is sent with chainId of '1' (Ethereum mainnet) instead of whatever is specified in the "chains" array. The problem with this approach is that then yet another request needs to be sent for the user to authorise "switching networks", which is quite bad UX. Modern / good mobile wallets allows simultaneous connections of different dapps to multiple networks at the same time, by keeping track of which dapp is connected to which chainId. The widespread "metamask standard" is bad even for browsers: imagine having 5 dapps in 5 tabs, and having to switch networks every-time a tab in the browser is switched - makes no sense at all, so it is good that walletconnect doesn't follow the metamask approach and we should allow this.
Feature Description
As a user from the onboard library, I'd like to specify the networks my dapp supports like this:
const onboard = Onboard({
wallets: [walletConnect],
chains: [
{
id: '0xA',
token: 'ETH',
label: 'Optimism',
rpcUrl: '....'
}
]}
});
And have the walletconnect session request dialog on the mobile wallet side (iOS or Android) to already make the request to connect to the proper network. One solution for when there is support for multiple networks, is for Onboard to send the walletconnect session request with the first item in the array, as the "default" network for the request.
Alternative Solutions
Here's another dapp describing a similar issue: gnosis/cowswap#1973
Anything else?
Screenshot of the desired result on the mobile wallet side (as example, rainbow wallet was used):
