Skip to main content

Crate talea_client

Crate talea_client 

Source
Expand description

Typed client SDK for the talea ledger server, plus the talea CLI.

TaleaClient implements the same LedgerApi trait the server’s in-process service does, so code written against the trait runs unchanged against either. All operations are retry-safe by construction (posts carry caller-supplied idempotency keys, registry writes are idempotent on id, reads are reads), and the client retries 503/transport failures automatically within a bounded RetryPolicy.

use talea_client::{LedgerApi, Page, TaleaClient};

let client = TaleaClient::builder("http://127.0.0.1:8080")
    .bearer_token("sekrit")
    .build()?;

let balance = client.balance("onramp", "cash", None).await?;
println!("{} {}", balance.balance, balance.asset);

let page = client
    .account_history("onramp", "cash", Page { after_seq: None, limit: 100 })
    .await?;

Subscriptions are unbroken streams: LedgerApi::subscribe reconnects with backoff and resumes from the last seen sequence, so consumers never re-implement cursor bookkeeping.

Modules§

cli
The talea CLI: thin shim over TaleaClient. execute returns the response as JSON (None for 204 ops) so tests never need a subprocess; run adds printing and the streaming tail loop.

Structs§

AccountDraft
AssetDraft
BalanceView
ClientBuilder
Configures and builds a TaleaClient. Created by TaleaClient::builder; finish with ClientBuilder::build.
EventEnvelope
Page
Paged
Posted
PostingDraft
PostingView
RetryPolicy
TaleaClient
HTTP client for a talea server, implementing LedgerApi.
TransactionDraft
TransactionView
TrialBalance
TrialBalanceLine
WireAmount

Enums§

ApiError

Traits§

LedgerApi
The full ledger contract. Each transport adapter is a thin translation onto it: the server implements it over a Store, the client over HTTP — code written against this trait runs unchanged against either.

Functions§

format_minor
Render minor units as a decimal string using the asset’s precision. Pure string arithmetic — safe for any precision, no 10^p overflow.

Type Aliases§

ApiResult
EventStream