# blocto/blocto-android-sdk architecture

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

- Interactive diagram: https://gitdiagram.com/blocto/blocto-android-sdk
- Repository: https://github.com/blocto/blocto-android-sdk

## Overview

##### Main Components
- Core Module: Represented by the “core” folder. It contains common components, utility classes, models (e.g., Account, Blockchain, CallbackActivity), and shared logic that underpins the SDK.
- Specialized Blockchain Modules:
– EVM Module (“evm” folder): Contains implementations specific to Ethereum-like blockchains. It includes methods for sending transactions and signing messages.
– Flow Module (“flow” folder): Contains Flow-specific logic with corresponding methods (e.g., AuthenticateMethod) and ViewModels.
– Solana Module (“solana” folder): Contains Solana-specific features, including methods for signing and sending transactions and their associated models.
- Wallet Module (“wallet” folder): Focused on wallet functionalities, including handling callbacks, request URIs, and integrating wallet-specific sign types.
- Demo / App Module (“app” folder): An example dApp which demonstrates how to integrate and use BloctoSDK. It includes various activities (for each blockchain supported) and UI layouts.

##### Relationships and Interactions
- The Demo App acts as the client, providing user interfaces and invoking SDK functions.

##### Architectural Patterns and Design Principles
- Modular Design: Emphasize the loose coupling between the modules by indicating clear boundaries and the separation of concerns.
- Layered Architecture: Show how the presentation layer (e.g., Activities and Fragments in the app module) communicates with the SDK’s business logic (in core and specific blockchain modules), and further into utility/model layers.
- Encapsulation and Extensibility: The modules are designed to allow future extensions (e.g., support for more blockchains), so add notes to signify that each module encapsulates its blockchain-specific methods and models.

##### Relevant Technologies and Frameworks
- Android SDK / Gradle: Each module is an independent Gradle project (as seen by build.gradle files) tailored for Android development.
- Proguard Rules: Each module includes its own Proguard configuration, indicating attention to code obfuscation and security details.
- GitHub Actions & CI/CD: The presence of GitHub workflows indicates an integrated continuous integration process.
- The project also leverages common Kotlin/Java programming constructs, evident from the source file structures.

##### Instructing the Principal Software Engineer
- Core module centrally or at a lower layer to show that it is a common foundation for the specialized modules.
- Incorporate notes to highlight how configuration (via Gradle settings, Proguard rules) plays a part in the build and deployment pipeline.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Demo App Layer
    subgraph "Demo App Layer"
        A["Demo / App Module - Demonstration and UI"]:::app
    end

    %% Blockchain Modules Layer
    subgraph "Blockchain Modules Layer"
        E["EVM Module - Ethereum-specific transactions"]:::module
        F["Flow Module - Flow-specific logic and methods"]:::module
        S["Solana Module - Solana-specific features"]:::module
        W["Wallet Module - Wallet functionalities & callbacks"]:::wallet
    end

    %% Core Module Layer
    subgraph "Core Module Layer"
        C["Core Module - Common logic & models"]:::core
    end

    %% App dependencies to modules
    A -->|"UsesCommon"| C
    A -->|"APICall"| E
    A -->|"APICall"| F
    A -->|"APICall"| S
    A -->|"WalletIntegration"| W

    %% Specialized modules extend Core functionality
    E -->|"ExtendsCore"| C
    F -->|"ExtendsCore"| C
    S -->|"ExtendsCore"| C

    %% Wallet module integration with blockchain modules
    W <-->|"Callback"| E
    W <-->|"Callback"| F
    W <-->|"Callback"| S

    %% Click Events
    click A "https://github.com/blocto/blocto-android-sdk/tree/develop/app/src/main/"
    click E "https://github.com/blocto/blocto-android-sdk/tree/develop/evm/src/main/java/com/portto/sdk/evm/"
    click F "https://github.com/blocto/blocto-android-sdk/tree/develop/flow/src/main/java/com/portto/sdk/flow/"
    click S "https://github.com/blocto/blocto-android-sdk/tree/develop/solana/src/main/java/com/portto/sdk/solana/"
    click W "https://github.com/blocto/blocto-android-sdk/tree/develop/wallet/src/main/java/com/portto/sdk/wallet/"
    click C "https://github.com/blocto/blocto-android-sdk/tree/develop/core/src/main/java/com/portto/sdk/core/"

    %% Styles
    classDef app fill:#FFD700,stroke:#DAA520,stroke-width:2px;
    classDef module fill:#87CEEB,stroke:#4682B4,stroke-width:2px;
    classDef wallet fill:#90EE90,stroke:#008000,stroke-width:2px;
    classDef core fill:#87CEEB,stroke:#4682B4,stroke-width:2px;
```
