# blade-labs/wallet-demo architecture

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

- Interactive diagram: https://gitdiagram.com/blade-labs/wallet-demo
- Repository: https://github.com/blade-labs/wallet-demo

## Overview

##### Main Components
- Client/User Interface: Represent the browser running the Vue application. This includes the primary entry point (index.html and main.ts) that bootstraps the app.
- Components (e.g., BladeTitle, Field, NetworkInformation, ResultMessage, WalletAccount, WalletBalance)
- Form Components (e.g., FormAccountInfo, FormAssociateToken, FormBuyNFT, FormCallContract, FormGetReceipt, FormSendHbar, FormSendToken, FormSign, FormTransferNFT)
- Control Components (e.g., AccountField, ActionButton, ButtonOutlined, CircleButton, ContractParameters, FunctionParameter, SubmitButton, TextBox, ToggleControl, TokenAmountBox)
- Static Component (e.g., SpinnerSmall)
- Utility Functions: Include a module for utilities (such as the encode.ts file) which might be used across different components.
- External Dependency: Represent the Blade Wallet API as an external service that the app integrates with. Since the README indicates that the demo works with Testnet accounts, annotate this component to specify that it is an external dApp API endpoint.

##### Relationships and Interactions
- Lifecycle and Event Handling: If applicable, indicate how events (e.g., a button click in a control component) initiate actions that propagate changes to the store and eventually lead to an API call.

##### Important Configuration and Build Aspects
- That configuration and build files (Dockerfile, Vite configuration, Tailwind, PostCSS) are used to set up and deploy the application. This context may be added outside the main interaction flow to indicate deployment and environment configuration.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Client Side"
        B["Browser / Client"]:::browser
        VA["Vue Application"]:::browser
        B --> VA

        subgraph "Views & Components"
            DC["Display Components (BladeTitle, Field, NetworkInformation, ResultMessage, WalletAccount, WalletBalance)"]:::components
            FC["Form Components (FormAccountInfo, FormAssociateToken, FormBuyNFT, FormCallContract, FormGetReceipt, FormSendHbar, FormSendToken, FormSign, FormTransferNFT)"]:::components
            CC["Control Components (AccountField, ActionButton, ButtonOutlined, CircleButton, ContractParameters, FunctionParameter, SubmitButton, TextBox, ToggleControl, TokenAmountBox)"]:::components
            SC["Static Component (SpinnerSmall)"]:::components
            VA --> DC
            VA --> FC
            VA --> CC
            VA --> SC
        end

        subgraph "Application State & Models"
            SM["State Management (balance-store, blade-signer, demo-store)"]:::state
            ML["Model Layer (contract, errors, signer)"]:::state
            UT["Utility Functions (encode.ts)"]:::state
            VA --> SM
            SM --> ML
            ML --> UT
        end
    end

    API["Blade Wallet API (Testnet)"]:::external
    FC -->|"API_call"| API

    subgraph "Deployment & Configuration"
        CF1["Dockerfile"]:::config
        CF2["vite.config.ts"]:::config
        CF3["tailwind.config.js"]:::config
        CF4["postcss.config.js"]:::config
        CF5[".github/workflows/build-deploy.yml"]:::config
        CF1 --> CF2
        CF2 --> CF3
        CF3 --> CF4
        CF4 --> CF5
    end

    CF2 -->|"build"| VA

    click B "https://github.com/blade-labs/wallet-demo/blob/develop/src/main.ts"
    click DC "https://github.com/blade-labs/wallet-demo/tree/develop/src/components/display/"
    click FC "https://github.com/blade-labs/wallet-demo/tree/develop/src/components/forms/"
    click CC "https://github.com/blade-labs/wallet-demo/tree/develop/src/components/controls/"
    click SC "https://github.com/blade-labs/wallet-demo/blob/develop/src/components/static/SpinnerSmall.vue"
    click SM "https://github.com/blade-labs/wallet-demo/tree/develop/src/store/"
    click ML "https://github.com/blade-labs/wallet-demo/tree/develop/src/model/"
    click UT "https://github.com/blade-labs/wallet-demo/blob/develop/src/utils/encode.ts"
    click API "https://github.com/blade-labs/wallet-demo/blob/develop/src/views/BladeWallet.vue"
    click CF1 "https://github.com/blade-labs/wallet-demo/tree/develop/Dockerfile"
    click CF2 "https://github.com/blade-labs/wallet-demo/blob/develop/vite.config.ts"
    click CF3 "https://github.com/blade-labs/wallet-demo/blob/develop/tailwind.config.js"
    click CF4 "https://github.com/blade-labs/wallet-demo/blob/develop/postcss.config.js"
    click CF5 "https://github.com/blade-labs/wallet-demo/blob/develop/.github/workflows/build-deploy.yml"

    classDef browser fill:#BBDEFB,stroke:#1976D2,stroke-width:2px;
    classDef components fill:#C8E6C9,stroke:#388E3C,stroke-width:2px;
    classDef state fill:#FFECB3,stroke:#FBC02D,stroke-width:2px;
    classDef external fill:#FFCDD2,stroke:#C62828,stroke-width:2px;
    classDef config fill:#D7CCC8,stroke:#5D4037,stroke-width:2px;
```
