Repository navigation
Architecture
MixinBot::API owns a configuration and a MixinBot::Client, then includes one module per API domain. The composition covers profile, users, assets, Safe and legacy transfers, transactions, outputs, snapshots, payments, multisig, messaging, Blaze, authentication, PIN/TIP, RPC, inscriptions, withdrawals, and related services.
The CLI and global configuration converge on the same API/client boundary.
flowchart LR
CLI[Thor CLI] --> API[MixinBot API]
Config[Configuration] --> API
API --> Domains[Domain modules]
API --> Client[Faraday client]
Domains --> Client
Client --> Network[Mixin Network API]
Client creates an HTTPS Faraday connection with JSON request/response middleware. get, post, fetch_get, fetch_post, and fetch_post_array sign the method, URI, and body with MixinBot::Utils.access_token, then send a Bearer token. Connection and timeout failures are retried up to two times with exponential backoff; debug enables response logging.
Successful responses become MixinBot::Models::ApiEnvelope. Use res['data'] for the envelope payload, or res['key'] for delegated lookup into data; res.to_h returns the original response hash.
sequenceDiagram
participant Caller
participant Client
participant Utils
participant API as Mixin API
Caller->>Client: get or post
Client->>Utils: access_token method URI body
Utils-->>Client: signed JWT
Client->>API: HTTPS request with Bearer
API-->>Client: JSON response
Client->>Client: parse response and map errors
Client-->>Caller: ApiEnvelope or exception
HTTP status handling maps 401, 403, and 429 to authentication, authorization, and rate-limit errors; 5xx statuses become server errors. API error envelopes are resolved through the client error mapper.