Add multi-wallet simultaneous connections support#5
Merged
Quantumlyy merged 4 commits intomainfrom Mar 28, 2026
Merged
Conversation
- connect() now allows connecting additional wallets instead of throwing ConnectorAlreadyConnectedError when already connected - Only throws if the same specific connector is already connected - Error recovery preserves 'connected' status when other connections exist - disconnect() removes connector from recentConnectorIds array storage - reconnect() supports reconnecting multiple wallets from stored IDs - Added recentConnectorIds to StorageItemMap with legacy fallback Co-authored-by: Claude <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
…to actions - Add switchConnection() action to change active wallet without disconnecting - Add optional connector parameter to all 8 actions (getBalance, sendPayment, createInvoice, signMessage, estimateFee, getTransaction, getTransactions, waitForPayment) so they can target a specific connected wallet - Export switchConnection from both actions and index entrypoints Co-authored-by: Claude <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
…ery hooks - Add useSwitchConnection hook wrapping core switchConnection action - Include connector UID in query keys for useBalance, useGetTransaction, and useTransactionHistory for per-connector cache separation - Export useSwitchConnection from React package Co-authored-by: Claude <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
…ations Co-authored-by: Claude <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements multi-wallet simultaneous connections, allowing users to connect multiple wallet connectors at once and switch between them. Previously, only a single active connection was supported.
Key Changes
Core Actions
connect(): Updated to allow multiple simultaneous connections. Now only throwsConnectorAlreadyConnectedErrorif the specific connector is already connected, not if any wallet is connected. Newly connected wallets become the active connection.disconnect(): Added optionalconnectorparameter to disconnect specific wallets while keeping others connected. Automatically switches to another connected wallet if the active one is disconnected.switchConnection(): New action to switch the active connection between already-connected wallets without reconnecting.reconnect(): Updated to support reconnecting multiple recent connectors. Reads from newrecentConnectorIdsstorage key (with fallback to legacyrecentConnectorId). Preserves existing connections if reconnection fails.State Management
config.state.connections: Changed from single connection toMap<string, Connection>to track multiple simultaneous connectionsconfig.state.current: Now stores the UID of the currently active connectorgetBalance,sendPayment,signMessage, etc.) now accept optionalconnectorparameter to specify which connection to use (defaults to current)Storage
recentConnectorId(single string) torecentConnectorIds(string array)React Hooks
useSwitchConnection(): New hook for switching active connections with mutation state managementconnector?.uidin query keys for proper cache invalidation when switching connectionsTests
Implementation Details
connectorparameter or current active connectionhttps://claude.ai/code/session_01Sts7EuD7ooKxBCJitw6uA7