we have the following DAML Contract:
data Something = Option A | Option B deriving(Show, Eq)
data Details = Details with id: Text name: Text state: Text
template Main with a: Party b: Party
c: Something
d: Details
I know we can do the following for 'a' and 'b' :
fields:{ a: daml.party(a), b: daml.party(b),} But how can I write for c and d?
For
dyou can usedaml.record, something like the following:For
cthere is an issue in your type definition. Constructors need to have different names whereas in your example they’re both calledOption. You can fix this by renaming one or both, e.g.,To construct a value, you can then use
daml.variant: