How zeusln/zeus works
Main Components
• Mobile App UI & Presentation Layer:
• React Native “views” folder: Contains screens for activities, payment requests, channels, settings, etc.
• “components”, “layout”, and “text” folders: Reusable UI components like buttons, forms, QR code scanning UI, etc.
• State Management / Business Logic:
• “stores” and “models” folders: Centralized state containers (e.g., for balance, channels, transactions) and business data structures.
• “utils” folder: Utility functions handling formatting, error handling, cryptographic functions, etc.
• Native Integration Layer:
• “android” and “ios” directories: Platform-specific code, native modules, bridging (e.g. NavigationService.ts, native notifications, QR scanning integrations).
• Node / Backend Communication:
• “backends” folder: Contains various adapters (like CLNRest, EmbeddedLND, LndHub, NostrWalletConnect, etc.) for interfacing with remote lightning nodes.
• “proto” and “zeus_modules” folders: Handle API definitions, gRPC communication protocols, and include libraries from Lightning Labs for LND and Core Lightning.
• External Services & Assets:
• “assets” and “locales”: Static files such as fonts, images, and translation files.
• “push notifications” or “navigation service”: Handling external device events.
Relationships and Data Flow
• The UI components display screens and receive user interactions.
• User actions are propagated to the stores (via state management libraries) where business logic and user session data are handled.
• Stores interact with models to prepare data.
• When remote node communication is required (e.g. to query channel info, process payments, or manage invoices), the stores call the corresponding functions in the “backends” layer.
• The backend components use the protocols defined in “proto” and the libraries in “zeus_modules” (from @lightninglabs) to communicate with remote nodes or services.
• Native modules (in the “android” and “ios” directories) are used to bridge platform-specific functionalities (such as notifications, NFC, camera/QR scanning, etc.) with the JavaScript layer.
• Utility modules support data conversion (e.g., for macaroons), error handling, and formatting of data transferred between components.
Architectural Patterns & Design Principles
• Separation of Concerns: Clear separation between UI (views, components), state management (stores/models), business logic (utils, backends), and native integrations.
• Abstraction Layers: Backends provide abstracted interfaces to multiple types of node connections (LND, Core Lightning, LNDHub, etc.).
• Modular Design: ZEUS is organized in modules (each in its own directories like “stores”, “backends”, “models”, “views”) to promote easier maintenance and scalability.
• Cross-Platform Consistency: The shared code base (React Native) is supported by platform-specific folders that handle the Android and iOS intricacies.
Technical Elements and Notable Technologies
• React Native and TypeScript as the main development stack.
• Native OS support via Android Studio and Xcode projects.
• Use of gRPC and protocol buffers (from the “proto” folder) for node communication.
• Integration with external libraries (e.g., from @lightninglabs in “zeus_modules”) to handle Lightning network connections.
• Handling of localizations and asset management through “locales” and “assets”.
Additional Notes
• Integration points for connectivity via Tor (as mentioned in the README) by annotating the communication paths for secure node connections.
• Given the extensive use of third-party libraries (e.g., @lightninglabs packages, bc-bech32, bc-ur), mark these components as “External Libraries” that support the backend communication layer.