DamlValues

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/.

Functions

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

A Daml Bool.

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

A Daml ContractId.

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

Days since 1970-01-01.

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

A Daml enum constructor. Named enumValue because enum is a Kotlin soft keyword.

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

A Daml Int.

Link copied to clipboard
fun list(vararg elements: ValueOuterClass.Value): ValueOuterClass.Value

list over varargs.

fun list(elements: List<ValueOuterClass.Value>): ValueOuterClass.Value

A Daml List; the elements are not required to share a type here, the ledger checks that.

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

A Daml Numeric, rendered with BigDecimal.toPlainString so no exponent appears on the wire.

fun numeric(value: String): ValueOuterClass.Value

A Daml Numeric from an already-formatted decimal string; passed through unchecked.

Link copied to clipboard
fun optional(value: ValueOuterClass.Value? = null): ValueOuterClass.Value

Some(value), or None when value is null.

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

A Daml Party from its party id.

Link copied to clipboard
fun record(vararg fields: Pair<String, ValueOuterClass.Value>): ValueOuterClass.Value

A record Value with the given labelled fields, in the order given.

Link copied to clipboard
fun recordOf(vararg fields: Pair<String, ValueOuterClass.Value>): ValueOuterClass.Record

A bare ValueOuterClass.Record, e.g. for CreateCommand.create_arguments.

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

A Daml Text.

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

Microseconds since epoch, UTC.

Link copied to clipboard
fun unit(): ValueOuterClass.Value

Daml ().

Link copied to clipboard
fun variant(constructor: String, value: ValueOuterClass.Value): ValueOuterClass.Value

A Daml variant: constructor applied to value.