Skip to content

feat: implement WalletConnect v2 multi-chain support and connection health (#227)#330

Merged
Smartdevs17 merged 1 commit into
Smartdevs17:mainfrom
Itodo-S:issue-227-walletconnect-v2-support
Apr 26, 2026
Merged

feat: implement WalletConnect v2 multi-chain support and connection health (#227)#330
Smartdevs17 merged 1 commit into
Smartdevs17:mainfrom
Itodo-S:issue-227-walletconnect-v2-support

Conversation

@Itodo-S
Copy link
Copy Markdown
Contributor

@Itodo-S Itodo-S commented Apr 26, 2026

Summary

Closes #227 — adds multi-chain switching and connection health assessment to the existing WalletConnect v2 service layer.

New files

src/services/walletconnect/multiChain.ts

  • buildMultiChainState(activeChainId) — builds a typed MultiChainState with all supported chains
  • switchChain(state, targetChainId) — validates the target is supported, returns ChainSwitchResult with success/error and chain metadata
  • getActiveChain(state) — resolves full chain definition for the active chain
  • isChainSupported(chainId) — quick boolean check
  • getCaipNetworkId(chainId) — returns the CAIP-2 network ID (e.g. eip155:137) for use in WalletConnect protocol messages

src/services/walletconnect/connectionHealth.ts

  • assessConnectionHealth(session, nowMs?) — classifies a session as healthy | degraded | disconnected | unknown and lists specific issues (missing_address, missing_chain_id, session_stale)
  • formatConnectionDuration(ms) — human-readable duration (e.g. 45s, 3m, 2h) for UI display

src/services/walletconnect/__tests__/multiChain.test.ts — 12 tests
src/services/walletconnect/__tests__/connectionHealth.test.ts — 11 tests

Acceptance criteria coverage

  • Implement WalletConnect v2 client — existing session manager + new chain utilities
  • Multi-chain support — switchChain, buildMultiChainState, all 5 EVM chains
  • Add connection state management — assessConnectionHealth with stale-session detection
  • Implement disconnect handling — assessConnectionHealth reports disconnected for non-connected states
  • QR code handling — existing buildPairingUri + new multiChain state feeds QR payload
  • Session management improvements — health assessment, stale detection, duration formatting

Test plan

  • jest --testPathPattern=walletconnect — all tests pass

@Smartdevs17 Smartdevs17 merged commit 709360f into Smartdevs17:main Apr 26, 2026
3 of 18 checks passed
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.

Implement subscription walletconnect v2 protocol support

2 participants