# bordalix/helm-wallet architecture

> Architecture diagram of the GitHub repository bordalix/helm-wallet, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bordalix/helm-wallet
- Repository: https://github.com/bordalix/helm-wallet

## Overview

##### Main Components Identification

The system should be represented with these key components:

a) Frontend Layer (React Application)
- User Interface Components (/src/components)
- Screen Flows (/src/screens)
- Provider Components (/src/providers)

b) Core Business Logic Layer (/src/lib)
- Wallet Management
- Transaction Processing
- Cryptographic Operations
- Network Communications

c) External Services
- Boltz Exchange Integration
- Lightning Network Interface
- Liquid Network Interface
- Explorer Services

**┌─ User Interface Layer ─────────────────────┐**
- (React Components, Screens, UI Logic)      │
- Application State Layer ──────────────────┤
- (Providers: wallet.tsx, config.tsx, etc.)  │
- Business Logic Layer ────────────────────┬┤
- ┌─ Wallet Core ─┐ ┌─ Network ─┐ ┌─ Crypto ┐│
- wallet.ts     │ │ boltz.ts  │ │blinder.ts││
- transactions.ts│ │ lnurl.ts  │ │signer.ts ││
- ┘ └──────────┘ └──────────┘│
- External Services Layer ─────────────────┬┤
- ┌─ Boltz Exchange ─┐ ┌─ Lightning Network ┐│
- ┘ └──────────────────┘ │
- ┘

##### Key Relationships to Highlight

- Data flow between UI components and providers
- Communication between business logic and external services
- Wallet interactions with Boltz Exchange
- Lightning payment routing through Boltz

##### Technical Details

Annotations for:
- React/TypeScript as the frontend framework
- Liquid Network as the underlying blockchain
- Lightning Network compatibility through Boltz
- Local storage and encryption mechanisms
- Transaction fee structure

##### Implementation Notes

- Clear separation between UI components (/src/components) and business logic (/src/lib)
- Flow from user input through to blockchain transactions
- Role of providers in managing application state
- Demonstrate how the wallet maintains its simple UX while handling complex operations

##### Additional Elements

- Component types and their relationships
- Important configuration points

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef business fill:#2ecc71,stroke:#27ae60,color:white
    classDef external fill:#f1c40f,stroke:#f39c12,color:black
    classDef infrastructure fill:#95a5a6,stroke:#7f8c8d,color:white

    %% Frontend Layer
    subgraph Frontend
        UI["UI Components"]
        Screens["Screen Flows"]
        Icons["Icon Components"]
    end

    %% Application State Layer
    subgraph AppState
        Providers["Provider Components"]
        WalletProvider["Wallet Provider"]
        ConfigProvider["Config Provider"]
        FiatProvider["Fiat Provider"]
        BoltzProvider["Boltz Provider"]
    end

    %% Business Logic Layer
    subgraph BusinessLogic
        WalletCore["Wallet Management"]
        TransactionProc["Transaction Processing"]
        CryptoOps["Cryptographic Operations"]
        NetworkComm["Network Communications"]
        SubmarineSwaps["Submarine Swaps"]
        ReverseSwaps["Reverse Swaps"]
        LiquidInterface["Liquid Interface"]
        LightningInterface["Lightning Interface"]
    end

    %% External Services Layer
    subgraph External
        BoltzExchange["Boltz Exchange"]
        LightningNetwork["Lightning Network"]
        LiquidNetwork["Liquid Network"]
        Explorers["Explorer Services"]
    end

    %% Relationships
    UI --> Providers
    Screens --> Providers
    Providers --> BusinessLogic
    WalletCore --> NetworkComm
    NetworkComm --> External
    SubmarineSwaps --> BoltzExchange
    ReverseSwaps --> BoltzExchange
    LightningInterface --> LightningNetwork
    LiquidInterface --> LiquidNetwork

    %% Click Events
    click UI "https://github.com/bordalix/helm-wallet/tree/master//src/components/"
    click Screens "https://github.com/bordalix/helm-wallet/tree/master//src/screens/"
    click Icons "https://github.com/bordalix/helm-wallet/tree/master//src/icons/"
    click Providers "https://github.com/bordalix/helm-wallet/tree/master//src/providers/"
    click WalletProvider "https://github.com/bordalix/helm-wallet/blob/master//src/providers/wallet.tsx"
    click ConfigProvider "https://github.com/bordalix/helm-wallet/blob/master//src/providers/config.tsx"
    click FiatProvider "https://github.com/bordalix/helm-wallet/blob/master//src/providers/fiat.tsx"
    click BoltzProvider "https://github.com/bordalix/helm-wallet/blob/master//src/providers/boltz.tsx"
    click WalletCore "https://github.com/bordalix/helm-wallet/blob/master//src/lib/wallet.ts"
    click TransactionProc "https://github.com/bordalix/helm-wallet/blob/master//src/lib/transactions.ts"
    click CryptoOps "https://github.com/bordalix/helm-wallet/blob/master//src/lib/blinder.ts"
    click NetworkComm "https://github.com/bordalix/helm-wallet/blob/master//src/lib/network.ts"
    click SubmarineSwaps "https://github.com/bordalix/helm-wallet/blob/master//src/lib/submarineSwap.ts"
    click ReverseSwaps "https://github.com/bordalix/helm-wallet/blob/master//src/lib/reverseSwap.ts"
    click LiquidInterface "https://github.com/bordalix/helm-wallet/blob/master//src/lib/liquid.ts"
    click LightningInterface "https://github.com/bordalix/helm-wallet/blob/master//src/lib/lightning.ts"
    click Explorers "https://github.com/bordalix/helm-wallet/blob/master//src/lib/explorers.ts"

    %% Style Applications
    class UI,Screens,Icons,Providers,WalletProvider,ConfigProvider,FiatProvider,BoltzProvider frontend
    class WalletCore,TransactionProc,CryptoOps,NetworkComm,SubmarineSwaps,ReverseSwaps,LiquidInterface,LightningInterface business
    class BoltzExchange,LightningNetwork,LiquidNetwork,Explorers external
```
