2.6 KiB
Wallet Connectivity Specification
Overview
This document specifies wallet connectivity options including WalletConnect v2, hardware wallet support, and embedded wallet architecture.
WalletConnect v2 Integration
Implementation
Library: @walletconnect/web3wallet or @web3modal/wagmi
Features:
- Multi-wallet support
- Session management
- Chain switching
- Transaction signing
- Message signing
Connection Flow
- User initiates connection
- QR code displayed or deep link generated
- User approves in wallet app
- Session established
- Ready for transactions
Session Management
Storage: Persist sessions in localStorage Expiration: Handle session expiration gracefully Reconnection: Auto-reconnect on page reload
Hardware Wallet Support
Supported Wallets
Ledger: Via Ledger Live or browser extension Trezor: Via Trezor Connect Other: Via Web3 provider standard
Integration
Method: Use Web3 provider interface Security: Never expose private keys UX: Clear instructions for hardware wallet usage
Embedded Wallet
Architecture
Options:
- Non-Custodial: User controls keys (Web3Auth, Magic)
- Custodial: Platform manages keys (Fireblocks, Circle)
Recommendation: Start with non-custodial, add custodial for banking features
Non-Custodial Embedded Wallet
Technology: Web3Auth or similar Features:
- Social login (Google, Twitter, etc.)
- Passwordless authentication
- Key management via MPC or smart contract wallets
- Recovery options
Custodial Embedded Wallet
Use Cases: Banking features requiring custody Requirements:
- Regulatory compliance
- Secure key storage (HSM)
- Insurance
- Audit trails
Policy Gating: Only enable for users meeting compliance requirements
Key Management
Non-Custodial Keys
Storage: User's device or MPC network Recovery: Social recovery or seed phrase Security: Never transmitted to server
Custodial Keys
Storage: Hardware Security Module (HSM) Access: Multi-signature approval Audit: All key operations logged
API Integration
Wallet Connection
Methods:
connect(): Initiate connectiondisconnect(): Close connectiongetAccount(): Get connected accountswitchChain(): Switch to different chain
Transaction Signing
Flow:
- Build transaction
- Request user approval
- Sign transaction
- Broadcast transaction
- Monitor confirmation
References
- Swap Engine: See
swap-engine.md - Bridge Engine: See
bridge-engine.md - Security: See
../security/security-architecture.md