DAML React template and using contract key to fetch contracts

Hi,

I think I’ve seen this question before but can’t seem to find it.

How would I use a contract key from the DAML ui template? The contract key is (signatory party id, a unique key).

const classes = useStyles();
  const party = useParty();
  const ledger = useLedger();
  const assets = useStreamQuery(Client).contracts;

thank you.

2 Likes

There are a bunch of things you can do with contract keys, each with their own signatures. The Getting Started guide supplies a few examples:

Keys are well-typed when you use codegen, so I strongly recommend letting TypeScript guide you in formatting your key data for these functions properly.

3 Likes