Skip to content

👜 Implement Wallet Connection & Multi-Account Support #71

@mijinummi

Description

@mijinummi

🧭 Overview

BridgeWise allows users to bridge assets across Stellar and EVM networks.

To support professional dApps, it must enable wallet connections and multi-account support, allowing users to:

  • Connect multiple wallets (MetaMask, Phantom, etc.)
  • Switch between accounts dynamically
  • Maintain correct transaction context per account
  • Integrate seamlessly with hooks like useBridgeExecution(), useTransactionHistory(), and useNetworkSwitcher()

This ensures secure, flexible, and production-ready wallet interactions.


🎯 Problem

  • Users currently limited to a single wallet connection
  • Switching accounts is cumbersome or unsupported
  • Hooks and SDK logic do not differentiate between accounts
  • Without multi-account support, dApps cannot serve advanced users effectively

💡 Proposed Solution

Implement Wallet Connection & Multi-Account Layer that:


🛠 Scope of Work

1️⃣ Wallet Adapter Enhancements

  • Support connecting multiple wallets simultaneously
  • Maintain active wallet and account context
  • Listen to account change events from wallets

2️⃣ Hook Implementation

interface WalletConnection {
  walletType: 'MetaMask' | 'Phantom' | 'WalletConnect' | string;
  accounts: string[];
  connected: boolean;
}

const { wallets, connectWallet, disconnectWallet, switchAccount, activeAccount } = useWalletConnections();
  • wallets: list of connected wallets
  • connectWallet(walletType): connect a new wallet
  • disconnectWallet(walletType): remove a wallet
  • switchAccount(account): set active account
  • activeAccount: current account and chain context

3️⃣ UI Integration

  • <WalletConnector /> demo component
  • Show multiple connected wallets and active account
  • Optional network selection per wallet
  • Reflect changes in <BridgeCompare /> and <BridgeStatus />

4️⃣ Error Handling & Fallbacks

  • Handle wallet disconnection gracefully
  • Provide structured errors for unsupported wallets
  • Ensure active account is always valid before executing transfers

📊 Expected Outcome

  • Users can connect multiple wallets and switch accounts dynamically
  • Hooks and SDK modules respect active account context
  • Developers can integrate BridgeWise logic securely and flexibly
  • Seamless UX in multi-account and multi-chain environments

✅ Acceptance Criteria

  • Multiple wallet connections supported
  • Active account state maintained and exposed via hooks
  • connectWallet, disconnectWallet, switchAccount implemented
  • Integration with network switching, fee estimation, transaction history, and headless mode
  • UI demo component <WalletConnector /> available
  • SSR-safe and production-ready
  • Unit tests covering connection, disconnection, account switching, and error handling
  • Documentation updated with usage examples

📈 Measurable Impact

  • Professional dApps can support multiple accounts per user
  • Users experience smooth wallet and account management
  • Reduced errors from incorrect account usage
  • Developers gain flexible, secure wallet integration

🧪 Testing Requirements

  • Connect and disconnect multiple wallets simultaneously
  • Switch active accounts and verify correct transaction context
  • Simulate network changes per wallet
  • Test integration with hooks (useBridgeExecution(), useTransactionHistory(), useNetworkSwitcher())
  • Validate error handling for unsupported wallets or disconnected accounts

📚 Documentation Requirements

  • Add “Wallet Connection & Multi-Account Support” section in README
  • Provide hook usage examples:
const { wallets, connectWallet, switchAccount, activeAccount } = useWalletConnections();
  • Include demo component <WalletConnector />
  • Document supported wallet types, account switching, and network context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions