WalletConnect/WalletConnectSwiftV2

CAIP-25 OptionalNamespace

itsallmememe opened this issue · 2 comments

Describe the bug
We implemented the change as stated here - https://medium.com/walletconnect/caip-25-implementation-guidance-migrating-to-empty-undefined-required-namespaces-6aa5626a86d9 - to move “requiredNamespaces” to “optionalNamespaces” for the CAIP-25 update.

In our use case our app needs to confirm that the user can access a certain chain before requesting that the user signs a transaction for that chain.

We do this by performing Sign.instance.connect and passing in the namespace of the chain, however if we move the namespace to optionalNamespaces from requiredNamespaces then the chainId returned in Sign.instance.sessionSettlePublisher is always 1 - Ethereum Mainnet - even if we pass in Base or Zora or Optimism as the optionalNamespace

This results in us being unable to confirm which chain the user has access to.

Can you confirm what the best approach is here? Are we ok keeping our chain in the requiredNamespaces parameter?

SDK Version

  • Client: iOS / Swift
  • Version 1.9.9

Expected behavior
Wallet should respond with optional namespace that is passed in

Note:

  • the "Sign.instance.sessionSettlePublisher is always 1 - Ethereum Mainnet" only happens with MetaMask wallet. Rainbow correctly responds with chain id.
  • Trust wallet also does not support the changes yet either.

What is the recommended approach here?

  • Wait until all wallets support this change?
  • how urgent is this change?

hey, Metamask will always approve one chain, other wallets should connect to many.
Dapp will usually display the first chain from the chains array(in namespaces) as an active chain.