Expand description
Async Canton Ledger API client (gRPC + JSON).
CantonClient speaks the gRPC Ledger API v2: command submission
(fire-and-forget CantonClient::submit and
CantonClient::submit_and_wait_for_transaction) with change-ID
de-duplication and completion-based recovery, ACS + update streaming
(paging, reverse-order, event query, and offset-resumable streams), a
node health check, and an opt-in retry pipeline. JsonClient mirrors the
core surface over the HTTP JSON Ledger API (submit + bounded reads, plus
WebSocket streaming behind the ws feature). Both share the
canton_core connection kernel (endpoint, Auth,
TLS, retry) and error model.
use canton_ledger::{CantonClient, Config};
let client = CantonClient::connect_lazy(Config::new("http://localhost:3901"))?;
println!("ledger api version: {}", client.version().await?);Re-exports§
pub use request::ActiveContractsRequest;pub use request::CompletionsRequest;pub use request::TransactionShape;pub use request::UpdatesRequest;
Modules§
- proto
- The generated Ledger API v2 protobuf types, for the dynamic (untyped)
command path. For typed payloads generated from a DAR, see
canton-codegenand thecanton-damlruntime. - request
- Typed request builders for the client’s read paths.
- value
- Value constructors for the dynamic command path.
Structs§
- Canton
Client - An async client for the Canton Ledger API over gRPC.
- Change
Id - The complete identity of a submitted command — Canton’s change ID.
- Config
- Configuration for an SDK gRPC client (shared by
canton-ledgerandcanton-admin). - Error
Info - Structured
google.rpc.ErrorInfodetails from a gRPC status: the machine- readablereason, itsdomain, and errormetadata.#[non_exhaustive]. - Json
Client - A client for the Canton JSON Ledger API over HTTP.
- Json
Commands - A set of commands to submit over the JSON transport (dynamic path).
- Json
Submission - A JSON-transport command with its identity fixed, ready to send and to
recover — the JSON lane’s
Submission. - Json
Submit AndWait Response - The response to a successful
submit-and-wait— the lighter of the two waiting submissions, which reports where the command landed without returning the transaction itself. - Json
Submit Response - The response to a successful
submit-and-wait-for-transaction. - Json
Transaction - A committed transaction from the JSON transport. Top-level fields are typed;
eventsstay as raw JSON (the M1 dynamic path). - Resource
Info - A resource a failure is about, from a
google.rpc.ResourceInfodetail on a gRPC status or an entry of a JSON API error body’sresources.#[non_exhaustive]. - Retry
Config - Retry policy for unary calls.
- Submission
- A command with its identity fixed, ready to send and to recover.
- Submit
- A ledger command submission: which parties act, which commands to run, and the submission metadata (change ID, de-duplication period, workflow).
- TlsConfig
- TLS settings for the gRPC channel.
Enums§
- AcsEntry
- One entry of an Active Contract Set snapshot.
- Auth
- How the client authenticates each request.
- Error
- The single error type for the whole Canton Rust SDK.
- Error
Category - Canton’s error categories — the coarse classification every Ledger API
error carries (
ErrorInfo.metadata["category"]), which the error-code documentation defines retryability on.#[non_exhaustive]: Canton may add categories. - Serving
Status
Functions§
- create
- Build a create command for
template_idwith the givenargumentsrecord. - exercise
- Build an exercise command: exercise
choice(withargument) on the contractcontract_idof typetemplate_id. - identifier
- A template/type identifier (
package_id,Module.Path,EntityName). - record
- A record value from labelled fields.
Type Aliases§
- Result
- SDK-wide result alias. Re-exported by the facade as
canton::Result.