Hi all,
I’m building a java backend using the reactive bindings. I have a template with contract key as below:
key (networkOwner, client, productId): (Party, Party, Text)
maintainer key._1
In my java I’m trying to send an ExerciseByKeyCommand through the Ledger API to exercise a choice in this template, but it is unclear how to correctly create the Value object to represent the contract key. Any advice would be greatly appreciated!
Thanks in advance!
Tuples are not builtin types in Daml-LF. They are just regular records named TupleN
in DA.Types
. This is documented in How Daml types are translated to Daml-LF — Daml SDK 1.16.0 documentation.
The package id is stable and is 40f452260bef3f29dede136108fc08a88d5a5250310281067087da6f0baddff7
if you really want to hardcode it but I recommend using the Java codegen instead to get it.
1 Like
Thanks for the reply, I did catch this, yes.
Doing that would give me a da.types.Tuple3
object but the ExerciseByKeyCommand
object requires a Value
as the key. I couldn’t see a way to clearly add an object to the Value builder, in place of things like setText
/setParty
/setDate
, what’s the best way to create a Value
from the da.types.Tuple3
?
You should be able to call toValue
to get a DamlRecord
which is a subclass of Value
.