WalletConnect / WalletConnectSwiftV2

WalletConnect Swift SDK v2
https://docs.walletconnect.com
Apache License 2.0
301 stars 159 forks source link

CAIP-25 OptionalNamespace #1257

Open itsallmememe opened 9 months ago

itsallmememe commented 9 months ago

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

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

itsallmememe commented 9 months ago

Note:

What is the recommended approach here?

llbartekll commented 1 month ago

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.