How 0xoucan/celo-mind-web works
Layers and Main Components
• Presentation Layer (UI)
– Components: MainLayout, Header, ChatInterface, InfoPanel, WalletBalances, TransactionMonitor
• State & Integration Layer
– Providers: WalletContext, PrivyProvider
– Config & Constants: config.ts, network constants
• Services Layer (Client Logic)
– agentService.ts (talks to backend AI API)
– blockchainService.ts (direct blockchain calls, balance fetch)
– transactionService.ts (queueing, polling, status)
• External Systems Layer
– CeloMΔIND Backend API (http://localhost:4000)
– External Wallets (MetaMask, Rabby) via Privy SDK
– Celo Blockchain & DeFi Protocols (AAVE, ICHI, Mento)
– CeloScan Explorer
Relationships & Data Flows
• User → ChatInterface: enters natural-language commands
• ChatInterface → agentService → Backend API (/api/agent/chat)
• Backend AI → returns transaction request(s) → agentService → ChatInterface
• ChatInterface → transactionService → PrivyProvider → External Wallet (sign)
• Signed Tx → blockchainService → Celo Blockchain → DeFi Protocols
• transactionService polls status → TransactionMonitor → UI
• blockchainService fetches balances → WalletBalances → UI
Architectural Patterns
• Layered architecture separating UI, state/integration, services, and external systems
• Context-based state management (React Context for Wallet)
• Service-based abstraction for API & blockchain interactions
• Dependency injection via Providers (PrivyProvider)
• Real-time polling & reactive updates