-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Link to minimal reproducible example
https://stackblitz.com/edit/github-erhvie8k
Steps to Reproduce
1 - Initialize AppKit using a custom network where the id differs from the reference used in caipNetworkId.
2 - Open the connect modal.
3 - Observe that the generated optional namespace contains a chain built using the network id, instead of the expected caipNetworkId.
Summary
Just for clarification, I am adding support for the Neo3 and Stellar blockchains by building custom AppKit adapters and network definitions.
Both blockchains follow the same network ID conventions already used by their respective WalletConnect SDK implementations.
References:
-
Stellar WalletConnect SDK: https://github.com/Creit-Tech/Stellar-Wallets-Kit/blob/main/src/sdk/modules/wallet-connect.module.ts
-
Neo3 WalletConnect SDK: https://github.com/CityOfZion/wallet-connect-sdk/blob/main/packages/wallet-connect-sdk-core/src/index.ts
Currently, WCNamespaceUtil.createNamespaces uses the id to build the CAIP network ID which could cause some inconsistencies when you need to use two networks with the same network id.
For example, in the syncAccounts method of AppKitBaseClient, the find operation relies on the id to locate the corresponding caipNetwork. When two networks share the same id, this lookup may return the wrong network, resulting in incorrect account synchronization and other inconsistencies.
Reference:
| let caipNetwork = this.getCaipNetworks().find( |
I cannot assign a unique id to each network as a workaround, because WCNamespaceUtil.createNamespaces uses the network id to construct the caipNetworkId.
Proposed Solutions:
Refactor all locations where the id property is used to construct the caipNetworkId, ensuring that the existing caipNetworkId property is used directly instead of being derived from id.
Refactor all lookup operations that rely on the id property (e.g., find operations) to use caipNetworkId as the primary identifier for network resolution.
List of related npm package versions
@reown/appkit
@reown/appkit-controllers
Node.js Version
v22.14.0
Package Manager
npm@11.8.0