We listen to our event stream and convert every contract to JSON, subsequently storing it in MongoDB.
When using the verbose
setting, we’re able to get more information about each contract, in particular (1) contract keys, and (2) fully qualified type names. We get these from the DamlRecord
object returned by getArguments
(then use the fieldMap
to convert to JSON).
When using non-verbose mode, we can get a DamlRecord
of the contract using toValue
, but it doesn’t have the same contents: again, it’s missing the (1) contract key and (2) fully qualified type names.
At first blush, these both seem like things that the codegen should know about. It also strikes me that converting contracts to JSON is probably a common use case; i assume we don’t support that, but wonder why.
Questions:
- is there a generic way to get contract keys with non-verbose?
- Ditto for fully qualified types?
- is there a best practice for converting transaction trees to JSON?
- is there any appetite for supporting toJSON as a first-class feature of codegen?