# jhad00/shamy architecture

> Architecture diagram of the GitHub repository jhad00/shamy, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jhad00/shamy
- Repository: https://github.com/jhad00/shamy

## Overview

Shamy is a Node.js client library for ShamCash. Applications initialize ShamClient, which restores a saved session or creates QR credentials and polls ShamCash until authentication succeeds; its events report connection state and readiness. Once authenticated, callers use account, transfer, history, and wallet managers for profile and balance retrieval, receiving QR codes, transfers, transaction logs and monitoring, and external-wallet cash-in or Syriatel recharge. API managers encrypt requests and decrypt responses through ShamCrypto. Source excerpts support the main calls and data transfers; some documented capabilities are not independently visible in sampled implementation details.

Main entry points: [`src/Client.js`](https://github.com/jhad00/shamy/blob/main/src/Client.js) (ShamClient), [`src/api/Account.js`](https://github.com/jhad00/shamy/blob/main/src/api/Account.js) (Account services), [`src/api/History.js`](https://github.com/jhad00/shamy/blob/main/src/api/History.js) (History and monitoring), [`src/api/Transfer.js`](https://github.com/jhad00/shamy/blob/main/src/api/Transfer.js) (Transfer services)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client and sessions"]
  node_client["ShamClient<br/>[Client.js]"]
  node_session[("Session file<br/>[Client.js]")]
  node_authapi["ShamCash session API"]
end

subgraph group_security["Payload security"]
  node_crypto["ShamCrypto<br/>[Crypto.js]"]
  node_constants["Endpoint and key constants<br/>[Constants.js]"]
end

subgraph group_account["Account services"]
  node_account["Account services<br/>[Account.js]"]
  node_receive["Receive QR<br/>[Account.js]"]
  node_shamcash["ShamCash API"]
end

subgraph group_payments["Payments and activity"]
  node_transfer["Transfer services<br/>[Transfer.js]"]
  node_history["History and monitoring<br/>[History.js]"]
  node_wallets["Wallet and recharge services<br/>[Wallets.js]"]
  node_bank["ShamCash bank API"]
end

node_app(("Node.js application"))

node_app -->|"initializes"| node_client
node_client -->|"loads and saves"| node_session
node_client -->|"encrypts and decrypts"| node_crypto
node_client -->|"polls"| node_authapi
node_client -->|"reads endpoints and key"| node_constants
node_client -->|"creates manager"| node_account
node_client -->|"creates manager"| node_transfer
node_client -->|"creates manager"| node_history
node_client -->|"creates manager"| node_wallets
node_app -->|"requests account data"| node_account
node_app -->|"requests transfers"| node_transfer
node_app -->|"requests logs or monitoring"| node_history
node_app -->|"requests wallet operations"| node_wallets
node_account -->|"encrypts and decrypts"| node_crypto
node_account -->|"reads API endpoint"| node_constants
node_account -->|"requests account data"| node_shamcash
node_account -->|"fetches address for"| node_receive
node_receive -->|"gets profile"| node_account
node_transfer -->|"encrypts and decrypts"| node_crypto
node_transfer -->|"reads API endpoint"| node_constants
node_transfer -->|"resolves and transfers"| node_shamcash
node_history -->|"encrypts and decrypts"| node_crypto
node_history -->|"reads API endpoint"| node_constants
node_history -->|"fetches transaction logs"| node_shamcash
node_history -->|"emits new transactions"| node_history
node_wallets -->|"encrypts and decrypts"| node_crypto
node_wallets -->|"reads bank endpoint"| node_constants
node_wallets -->|"sends wallet operations"| node_bank

click node_client "https://github.com/jhad00/shamy/blob/main/src/Client.js"
click node_session "https://github.com/jhad00/shamy/blob/main/src/Client.js"
click node_crypto "https://github.com/jhad00/shamy/blob/main/src/Crypto.js"
click node_constants "https://github.com/jhad00/shamy/blob/main/src/Constants.js"
click node_account "https://github.com/jhad00/shamy/blob/main/src/api/Account.js"
click node_receive "https://github.com/jhad00/shamy/blob/main/src/api/Account.js"
click node_transfer "https://github.com/jhad00/shamy/blob/main/src/api/Transfer.js"
click node_history "https://github.com/jhad00/shamy/blob/main/src/api/History.js"
click node_wallets "https://github.com/jhad00/shamy/blob/main/src/api/Wallets.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_client,node_session,node_authapi toneBlue
class node_crypto,node_constants toneAmber
class node_account,node_receive,node_shamcash toneMint
class node_transfer,node_history,node_wallets,node_bank toneRose
class node_app toneIndigo
```

## Components

### Client and sessions

- [ShamClient](https://github.com/jhad00/shamy/blob/main/src/Client.js): `src/Client.js`
- [Session file](https://github.com/jhad00/shamy/blob/main/src/Client.js): `src/Client.js`
- **ShamCash session API**

### Payload security

- [ShamCrypto](https://github.com/jhad00/shamy/blob/main/src/Crypto.js): `src/Crypto.js`
- [Endpoint and key constants](https://github.com/jhad00/shamy/blob/main/src/Constants.js): `src/Constants.js`

### Account services

- [Account services](https://github.com/jhad00/shamy/blob/main/src/api/Account.js): `src/api/Account.js`
- [Receive QR](https://github.com/jhad00/shamy/blob/main/src/api/Account.js): `src/api/Account.js`
- **ShamCash API**

### Payments and activity

- [Transfer services](https://github.com/jhad00/shamy/blob/main/src/api/Transfer.js): `src/api/Transfer.js`
- [History and monitoring](https://github.com/jhad00/shamy/blob/main/src/api/History.js): `src/api/History.js`
- [Wallet and recharge services](https://github.com/jhad00/shamy/blob/main/src/api/Wallets.js): `src/api/Wallets.js`
- **ShamCash bank API**

### Other components

- **Node.js application**

## Connections

- Node.js application → ShamClient: initializes (evidence: `README.md`)
- ShamClient → Session file: loads and saves (evidence: `src/Client.js`)
- ShamClient → ShamCrypto: encrypts and decrypts (evidence: `src/Client.js`)
- ShamClient → ShamCash session API: polls (evidence: `src/Client.js`)
- ShamClient → Endpoint and key constants: reads endpoints and key (evidence: `src/Client.js`)
- ShamClient → Account services: creates manager (evidence: `src/Client.js`)
- ShamClient → Transfer services: creates manager (evidence: `src/Client.js`)
- ShamClient → History and monitoring: creates manager (evidence: `src/Client.js`)
- ShamClient → Wallet and recharge services: creates manager (evidence: `src/Client.js`)
- Node.js application → Account services: requests account data (evidence: `README.md`)
- Node.js application → Transfer services: requests transfers (evidence: `README.md`)
- Node.js application → History and monitoring: requests logs or monitoring (evidence: `README.md`)
- Node.js application → Wallet and recharge services: requests wallet operations (evidence: `README.md`)
- Account services → ShamCrypto: encrypts and decrypts (evidence: `src/api/Account.js`)
- Account services → Endpoint and key constants: reads API endpoint (evidence: `src/api/Account.js`)
- Account services → ShamCash API: requests account data (evidence: `src/api/Account.js`)
- Account services → Receive QR: fetches address for (evidence: `src/api/Account.js`)
- Receive QR → Account services: gets profile (evidence: `src/api/Account.js`)
- Transfer services → ShamCrypto: encrypts and decrypts (evidence: `src/api/Transfer.js`)
- Transfer services → Endpoint and key constants: reads API endpoint (evidence: `src/api/Transfer.js`)
- Transfer services → ShamCash API: resolves and transfers (evidence: `src/api/Transfer.js`)
- History and monitoring → ShamCrypto: encrypts and decrypts (evidence: `src/api/History.js`)
- History and monitoring → Endpoint and key constants: reads API endpoint (evidence: `src/api/History.js`)
- History and monitoring → ShamCash API: fetches transaction logs (evidence: `src/api/History.js`)
- History and monitoring → History and monitoring: emits new transactions (evidence: `src/api/History.js`)
- Wallet and recharge services → ShamCrypto: encrypts and decrypts (evidence: `src/api/Wallets.js`)
- Wallet and recharge services → Endpoint and key constants: reads bank endpoint (evidence: `src/api/Wallets.js`)
- Wallet and recharge services → ShamCash bank API: sends wallet operations (evidence: `src/api/Wallets.js`)
