Skip to main content

Crate canton_ledger

Crate canton_ledger 

Source
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-codegen and the canton-daml runtime.
request
Typed request builders for the client’s read paths.
value
Value constructors for the dynamic command path.

Structs§

CantonClient
An async client for the Canton Ledger API over gRPC.
ChangeId
The complete identity of a submitted command — Canton’s change ID.
Config
Configuration for an SDK gRPC client (shared by canton-ledger and canton-admin).
ErrorInfo
Structured google.rpc.ErrorInfo details from a gRPC status: the machine- readable reason, its domain, and error metadata. #[non_exhaustive].
JsonClient
A client for the Canton JSON Ledger API over HTTP.
JsonCommands
A set of commands to submit over the JSON transport (dynamic path).
JsonSubmission
A JSON-transport command with its identity fixed, ready to send and to recover — the JSON lane’s Submission.
JsonSubmitAndWaitResponse
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.
JsonSubmitResponse
The response to a successful submit-and-wait-for-transaction.
JsonTransaction
A committed transaction from the JSON transport. Top-level fields are typed; events stay as raw JSON (the M1 dynamic path).
ResourceInfo
A resource a failure is about, from a google.rpc.ResourceInfo detail on a gRPC status or an entry of a JSON API error body’s resources. #[non_exhaustive].
RetryConfig
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.
ErrorCategory
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.
ServingStatus

Functions§

create
Build a create command for template_id with the given arguments record.
exercise
Build an exercise command: exercise choice (with argument) on the contract contract_id of type template_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.