module Main where
data PayoutEvent = PayoutEvent with
time : Time
amount : Decimal
deriving (Eq, Show)
template Foo
with
owner : Party
payouts : [PayoutEvent]
where
signatory owner
I deployed the resulting .dar to Daml Hub and want to instantiate a Foo using the Live Data view. According to the documentation records are defined as blocks containing their values, but I can’t seem to get the record right.
What is the format to create an array of the above PayoutEvent records?
When I try, for example, { "time": "2021-12-20T20:37:21.172Z", "amount": "10.0" } , I receive the following error:
Your JSON encoding is perfectly fine and if you submit that via the JSON API it all works out. However, the hub UI is interpreting the JSON payload as a string not a JSON object and ends up submitting the following payload:
Thanks, @cocreature.
I spoke with @dtanabe and @sarah.breckenridge, and they confirmed this is a bug on the DamlHub UI. It should have shown nested input boxes to input the array elements and record fields. In the meantime, I’ll use the JSON or grpc API and build a small custom UI.