Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(walletconnect): use active network chain ID only #282

Merged
merged 1 commit into from
Oct 4, 2024

Conversation

drichar
Copy link
Collaborator

@drichar drichar commented Oct 4, 2024

Description

This PR enhances the WalletConnect class by implementing an activeChainId getter to dynamically determine the correct CAIP-2 chain ID based on the active network. The connect and signTransactions methods have been updated to use this getter, ensuring that only the chain ID for the currently active network is included in session proposals and transaction signing requests.

Details

  • Added activeChainId getter to WalletConnect class
  • Removed this.chains property from WalletConnect class
  • Updated connect method to use activeChainId in requiredNamespaces
  • Updated signTransactions method to use activeChainId
  • Removed chains parameter from WalletConnectModal initialization
  • Added tests for activeChainId getter and its usage in connect and signTransactions methods
  • Updated existing tests to use activeChainId

Closes #281

Implement `activeChainId` getter in `WalletConnect` class to return the
CAIP-2 chain ID for the currently active network. Update `connect` and
`signTransactions` methods to use this getter.

- Add `activeChainId` getter to `WalletConnect` class
- Remove `this.chains` property from `WalletConnect` class
- Update `connect` method to use `activeChainId` in `requiredNamespaces`
- Update `signTransactions` method to use `activeChainId`
- Remove optional `chains` parameter from `WalletConnectModal` initialization
- Add tests for `activeChainId` getter
- Add tests for `activeChainId` usage in `connect` and `signTransactions`
- Update existing tests to use `activeChainId`

This ensures only the active network's chain ID is included in
`requiredNamespaces` for session proposals, fixing issues with wallets
that don't support all networks.
@drichar drichar merged commit eb433b9 into main Oct 4, 2024
1 check passed
@drichar drichar deleted the fix/281-walletconnect-requirednamespaces branch October 4, 2024 05:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WalletConnect provider includes all supported chains in new session proposals
1 participant