Is it possible to ask for the currently active contracts using DAML Script/REPL?

I’m writing a couple of tests that validate that a given set of active contracts is available before and after a migration between DAML SDK versions when using a persistent sandbox.

I’d like to use DAML Script to initialize the ledger to a given state and my intention would be to somehow ask for the active contract set to validate that the migration is successful.

Is there a way to use DAML Script/REPL to this end or do would I be better served by the JSON API?

1 Like

DAML Script has a query function that will return all contracts of a given template fora given party. You can find examples in the documentation at https://docs.daml.com/daml-script/index.html.

It is common to specify the template type using a type application so you end up with something like

activeCoins <- query @Coin party
2 Likes

Thanks, I was looking for the wrong keyword when going through the docs!

1 Like