-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Labels
Description
🧭 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(), anduseNetworkSwitcher()
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:
- Supports multiple wallet types (EVM, Stellar)
- Maintains active account state
- Exposes hooks:
useWalletConnections()– list of connected walletsuseActiveAccount()– current account and network context
- Integrates with network switching (Issue Adapter Sandbox & Mock Provider Mode #23), fee estimation (Transaction State Tracking Service (“Heartbeat”) #16), transaction history (#19), and headless mode (Logging & Audit Trail for Critical Actions #24)
- Provides programmatic and UI-based account switching
🛠 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 walletsconnectWallet(walletType): connect a new walletdisconnectWallet(walletType): remove a walletswitchAccount(account): set active accountactiveAccount: 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,switchAccountimplemented - 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
Reactions are currently unavailable