ChoiceContextJson

Bridges the registry's off-ledger JSON (Daml JSON API encoding) and the gRPC Ledger API's proto values.

Registries return choiceContextData as the Daml JSON encoding of Splice.Api.Token.MetadataV1.ChoiceContext — a TextMap of AnyValue variants ({"tag": "AV_ContractId", "value": "00…"}). The official TS SDK submits through the JSON API where that encoding is native; we submit over gRPC, so the context must be re-encoded as proto values. AnyValue's closed constructor set is what makes this translation total.

Functions

Link copied to clipboard
fun anyValueToValue(json: JsonElement): ValueOuterClass.Value

One AnyValue variant from Daml JSON to its proto encoding.

Link copied to clipboard
fun choiceContextValue(json: JsonElement?): ValueOuterClass.Value

Daml JSON ChoiceContext -> proto record. Null/absent means an empty context.

Link copied to clipboard
fun extraArgsValue(choiceContextData: JsonElement?, meta: Map<String, String> = emptyMap()): ValueOuterClass.Value

ExtraArgs { context, meta } ready to embed in a choice-argument record.

Link copied to clipboard
fun transferFactoryChoiceArguments(expectedAdmin: String, transfer: Transfer): JsonObject

TransferFactory_Transfer choice arguments in Daml JSON API encoding, for GetFactoryRequest.choiceArguments — extraArgs empty per spec.