metamask-mobile
metamask-mobile copied to clipboard
WalletConnect v2 implementation does not support Optional Namespaces.
Describe the bug
MetaMask Mobile's WalletConnect v2 implementation does not support Optional Namespaces, thus breaking multichain DApps - users cannot switch network. This was previously working in MM Mobile + WalletConnect v1.
To Reproduce
- Head to https://stackblitz.com/edit/vitejs-vite-bhhzgv
- Connect
- Try switch to Polygon
- Error.
Expected behavior
You are able to switch chains.
I would like to add more precision.
This bug is due to the fact that Metamask ignores (or misshandle) the optionalChains parameter and therefore does not include these chains in the "allowed" chains of the session.
This is resulting in an error when we try to request chain switch:
error={ "message": "Chain 'eip155:137' not approved. Please use one of the following: eip155:1"}
How the connection is initiated client-side:
await EthereumProvider.init({
projectId: process.env.TEST_PROJECT_ID,
chains: [1], // chains added to required namespaces
optionalChains: [77, 99, 137] // chains added to optional namespaces
...
})
Any updates on this?
Any update? Too many dApps are already broken.
I'm still having issues with this. It seems MetaMask is indifferent whether Optional Namespaces are sent in the Proposal Namespace. Further, when the Required Namespace "chains" array length is greater than 1, MetaMask won't even connect...
Am I crazy or does setting chains undefined when the array length is not 1 make no sense? Like at least fall back on defaultChain if it exists. https://github.com/ElvisKrop/wagmi-dev-references/blob/020fc97e276e8d7fbbb918e840029593fa05e7e9/packages/connectors/src/walletConnect.ts#L304
Im also facing this issue
Any updates on this?
This issue has been automatically marked as stale because it has not had recent activity in the last 90 days. It will be closed in 7 days. Thank you for your contributions.
This issue was closed because there has been no follow activity in 7 days. If you feel this was closed in error please provide evidence on the current production app in a new issue or comment in the existing issue to a maintainer. Thank you for your contributions.
I believe this is closed by accident, the issue is still present @gauthierpetetin
Thanks for flagging @microHoffman , I'll re-open it.