Skip to content

feat(wallets): reuse WalletConnect sessions and pairings#45

Open
towanTG wants to merge 1 commit intodevelopfrom
feat/walletconnect-session-reuse
Open

feat(wallets): reuse WalletConnect sessions and pairings#45
towanTG wants to merge 1 commit intodevelopfrom
feat/walletconnect-session-reuse

Conversation

@towanTG
Copy link
Copy Markdown
Contributor

@towanTG towanTG commented Apr 29, 2026

Summary

  • reuse compatible WalletConnect sessions instead of disconnecting the existing one on every connect
  • reuse an existing pairing when requesting a broader chain set so users can add chains without forcing a full reset
  • request broader chain coverage as optional namespaces for the selected namespaces
  • keep the active wallet object in sync with session update/delete/expire events
  • add a patch changeset for @swapkit/wallets

Problem

The current connector always disconnects the first existing WalletConnect session before connecting again. That breaks normal session restoration and makes chain expansion unnecessarily destructive.

What changed

  • if an existing session already satisfies the requested chains, reuse it directly
  • if not, prefer an existing pairing topic and create a new proposal on that pairing
  • stop force-resetting prior sessions during connect
  • keep accounts and session updated from WalletConnect session lifecycle events
  • harden the EVM signer against a missing session reference

Notes

This keeps the external WalletOption.WALLETCONNECT API intact.
It does not migrate the modal UI to Reown AppKit yet; this PR is scoped to session reuse and add-chain behavior.

Verification

  • bun run --filter @swapkit/wallets build
  • direct tsc output filtered to walletconnect/index.ts and walletconnect/evmSigner.ts came back clean
  • full repo tsc in this worktree still has broader workspace-resolution noise unrelated to this change

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.

1 participant