Display Tuple in React frontend

I defined a Tuple in the Daml code

aType : (Party, Party)

How can I display it in frontend react config file (frontend-config.js)? For primitive types, I can use

x => x.argument.fields[0].value.value

But It doesn’t work for Tuple. I also got problem with Set. Any ideas? Thanks.

Hey Frankie, can you provide a bit more detail on this? There are types exported from “@damly/types”
For example
import { ContractId, Party, List } from "@daml/types";
If I need a ContractId type for my typescript file, I can do the above.

Daml tuples are translated into records with fields _1, …, _n. Navigator uses the JSON encoding used in the JSON API, so you should end up with a JSON object with those fields. For Set, take a look at REST JSON Specification - #4 by Gary_Verhaegen.

That said, I would recommend against using the custom frontend config in Navigator. It is very limited and we have no plans to extend it. If you need a custom frontend you are better off building something using the Javascript bindings. create-daml-app is often a good starting point.

1 Like

Thanks guys. I was trying to upgrade a very old POC and keep the old Navigator react configuration. I found a way to hack it which is to use JSON.Strigify() to print the JSON structure and then get to the field I need.