web3-react
web3-react copied to clipboard
WC v2 Proposal namespaces with respect of smart contract wallets
Copied this issue from another repo (https://github.com/orgs/WalletConnect/discussions/2733) but this one has the exact same issue. They fixed it like this: https://github.com/WalletConnect/walletconnect-monorepo/commit/ae452ed7c0ca5ca422609c3812d835753c59add3
More users currently are starting using smart contract wallets multichain, especially safe multisig. Smart contract wallet can be deployed selectively on specific chain. Current implementation of @walletconnect/ethereum-provider doesn't respect this and sends ethereum mainnet as required network. See chains, // REQUIRED chain ids. Dapp should work equally on different chains without specifying required network. Because smart contract wallet may be not deployed on required chain, but deployed on optional chains. Wallet can't continue working with dapp because it violates wallet connect protocol 2.4. Session Namespaces MUST contain at least one account in requested chains.
Dapp should be able to send proposal without required chains and not empty optional chains. From dapp development perspective I think that required chains make sense in rare cases, for instance, if dapp's contracts are deployed only on one chain. When dapp works on several chains it doesn't make sense to provide them as required because wallet may be deployed only in part of them, they should be provided as optional.
According to CAIP-25 required chains are optional. The requiredScopes array MUST contain 1 or more scopeObjects, if present.
References: https://github.com/wagmi-dev/references/issues/330 https://github.com/orgs/WalletConnect/discussions/2383
Steps to reproduce:
Suppose that we have Smart Contract Wallet on polygon. Open https://app.uniswap.org/ Choose polygon network in chain selector Connect WC v2 Expected: Wallet receives proposal with required polygon or with empty required chains. Wallet approves session. Actual: Wallet receives ethereum as required and polygon as optional. Wallet rejects session as it's not deployed on ethereum.
Open https://app.safe.global/ -> deploy wallet on gnosis Use WalletConnect Open https://layer3.xyz/ in other tab Sign in -> WalletConnect Copy WC uri -> insert in safe Expected: Continue work with layer3, sign personal message on gnosis. Actual: error - "Connection refused: Incompatible chain detected. Make sure the Dapp uses Gnosis Chain to interact with this Safe."