Package-level declarations

Types

Link copied to clipboard
data class ActiveContract(val createdEvent: EventOuterClass.CreatedEvent, val synchronizerId: String, val reassignmentCounter: Long)

One contract from the active contract set.

Link copied to clipboard
data class ActiveContractsSnapshot(val offset: Long, val contracts: List<ActiveContract>)

The active contract set at offset, the anchor for a gap-free state sync: apply contracts to local state, then consume updates(UpdateSubscription(beginExclusive = offset, ...)).

Link copied to clipboard
class CachingTokenProvider(refreshLeeway: Duration = 30.seconds, clock: () -> Instant = Instant::now, fetch: suspend () -> String)

Caches the token from an access-token provider until shortly before it expires, so the provider is consulted once per token lifetime instead of once per request.

Link copied to clipboard
class CantonClient(channel: ManagedChannel, callCredentials: CallCredentials? = null, retryPolicy: RetryPolicy = RetryPolicy.DEFAULT, accessTokenProvider: suspend () -> String? = null) : Closeable

A client for the Canton Ledger API.

Link copied to clipboard
data class CantonClientConfiguration(val host: String, val port: Int = 6865, val useTls: Boolean = true, val accessTokenProvider: suspend () -> String? = null, val tlsTrust: TlsTrust = TlsTrust(), val retryPolicy: RetryPolicy = RetryPolicy.DEFAULT)

Configuration for connecting to a Canton participant's Ledger API.

Link copied to clipboard
data class CantonError(val grpcCode: Status.Code, val errorCode: String?, val correlationId: String?, val retryable: Boolean, val retryDelay: Duration?, val description: String)

A decoded Canton Ledger API error.

Link copied to clipboard
class CantonException(val error: CantonError, cause: Throwable? = null) : RuntimeException

A ledger failure decoded into a CantonError — either a gRPC failure (cause set) or an asynchronous command rejection reported via a completion event (no cause).

Link copied to clipboard
data class CommandSubmission(val commands: List<CommandsOuterClass.Command>, val actAs: List<String>, val readAs: List<String> = emptyList(), val userId: String = "", val commandId: String = UUID.randomUUID().toString(), val workflowId: String = "", val deduplicationDuration: Duration? = null, val synchronizerId: String = "")

A batch of commands to submit atomically to the ledger.

Link copied to clipboard

Thrown when a Value does not have the shape a reader expects. Every Value.as… extension below throws it on a sum-case mismatch (the message names both the expected and the actual case), and ValueOuterClass.Record.requireField throws it for a missing field.

Link copied to clipboard
object DamlValues

Concise constructors for Daml Values, mirroring the Swift SDK's Com_Daml_Ledger_Api_V2_Value extensions. Both implementations are held to the same golden vectors in testdata/values/.

Link copied to clipboard
sealed interface LedgerUpdate

One element of the ledger update stream. Every update carries the participant-local offset that totally orders it; persist the offset of the last update you processed and pass it as UpdateSubscription.beginExclusive to resume without gaps or duplicates.

Link copied to clipboard
data class RetryPolicy(val maxAttempts: Int = 4, val initialBackoff: Duration = 250.milliseconds, val backoffMultiplier: Double = 2.0, val maxBackoff: Duration = 5.seconds, val streamHealthyWindow: Duration = 10.seconds)

Exponential backoff policy applied to retryable ledger errors (see CantonError.retryable). A server-suggested delay from RetryInfo takes precedence over the computed backoff when it is longer.

Link copied to clipboard
data class TlsTrust(val trustRoots: TlsTrust.TrustRoots = TrustRoots.SystemDefault, val verifyHostname: Boolean = true)

Which certificates to trust when connecting to a participant over TLS.

Link copied to clipboard
data class UpdateSubscription(val parties: List<String>, val beginExclusive: Long, val endInclusive: Long? = null, val ledgerEffects: Boolean = false, val includeReassignments: Boolean = true, val verbose: Boolean = true)

A subscription to the ledger update stream for a set of parties.

Functions

Link copied to clipboard
fun ValueOuterClass.Value.asBool(): Boolean

This value as a Daml Bool.

Link copied to clipboard
fun ValueOuterClass.Value.asContractId(): String

This value's contract id.

Link copied to clipboard
fun ValueOuterClass.Value.asDate(): LocalDate

This value as a Daml Date, from days since 1970-01-01.

Link copied to clipboard
fun ValueOuterClass.Value.asEnumConstructor(): String

The constructor name of this Daml enum value.

Link copied to clipboard
fun ValueOuterClass.Value.asInt64(): Long

This value as a Daml Int.

Link copied to clipboard
fun ValueOuterClass.Value.asList(): List<ValueOuterClass.Value>

The elements of this Daml List.

Link copied to clipboard
fun ValueOuterClass.Value.asNumeric(): BigDecimal

This value as a Daml Numeric, parsed exactly.

Link copied to clipboard
fun ValueOuterClass.Value.asOptional(): ValueOuterClass.Value?

The wrapped value for Some, or null for None.

Link copied to clipboard
fun ValueOuterClass.Value.asParty(): String

This value's party id.

Link copied to clipboard
fun ValueOuterClass.Value.asRecord(): ValueOuterClass.Record

This value's record, for reading fields with field or requireField.

Link copied to clipboard
fun ValueOuterClass.Value.asText(): String

This value as a Daml Text.

Link copied to clipboard
fun ValueOuterClass.Value.asTimestamp(): Instant

This value as a Daml Time, from microseconds since the epoch in UTC. Negative timestamps floor-divide correctly.

Link copied to clipboard
fun ValueOuterClass.Value.asUnit()

Asserts this is Daml (); the only reader that returns nothing.

Link copied to clipboard
fun ValueOuterClass.Value.asVariant(): ValueOuterClass.Variant

This value's variant, exposing its constructor and payload.

Link copied to clipboard
fun ValueOuterClass.Record.field(label: String): ValueOuterClass.Value?

The value of the field labelled label, or null if absent.

Link copied to clipboard
fun ValueOuterClass.Record.requireField(label: String): ValueOuterClass.Value

The value of the field labelled label.