CantonClient
A client for the Canton Ledger API.
val client = CantonClient(
CantonClientConfiguration(host = "validator.example.com")
)
val version = client.ledgerApiVersion()The channel-based constructor is useful for tests (in-process transport) and for callers who need full control over the ManagedChannel.
Constructors
Opens an OkHttp-backed gRPC channel to CantonClientConfiguration.host — TLS with the configured TlsTrust unless useTls is off — and takes the retry policy and access-token provider from the same configuration. The client owns the channel it built: close shuts it down.
Functions
The active contract set visible to parties at activeAtOffset (all templates). Retryable failures restart the snapshot from scratch, so the result is never partial.
The active contract set at the current ledger end — the starting point for a full state sync. Apply ActiveContractsSnapshot.contracts, then consume updates from ActiveContractsSnapshot.offset:
Fetches the Ledger API version from the participant.
The participant's current ledger end offset — the natural UpdateSubscription.beginExclusive for a fresh subscription.
Submits submission and waits for it to be committed, returning the update id. Retryable failures are retried with the same command id, so the participant deduplicates re-executions.
Submits submission, waits for it to be committed, and returns the resulting transaction (flat/ACS-delta shape, filtered to the submitting parties). Retries reuse the same command id.
Streams ledger updates for subscription, transparently reconnecting on retryable failures and resuming from the offset of the last received update — consumers see one uninterrupted, gap-free stream. The retry budget resets only once a connection has proven healthy: it delivered at least one update and stayed alive for RetryPolicy.streamHealthyWindow. Shorter-lived connections keep escalating the backoff until RetryPolicy.maxAttempts is exhausted.