If you’re using React, you can also use the useQuery hook or the corresponding streaming version useStreamQuery. They are implemented on top of the functions in @daml/ledger@Leonid_Shlyapnikov linked to.
We want to be able to query it based on city and state. Right now we’ve only been able to retrieve all contracts. I see how to do it using the JSON API, but not the React bindings.
A little confused about the documentation and we’re getting errors when we try to pass in query parameters, could you give an example of how we would use this function?
useStreamQuery accepts a second argument, take a look at the type signature at https://docs.daml.com/app-dev/bindings-ts/daml-react/modules/defaultledgercontext.html#usequery. This is the query that will be sent to the JSON API. So you can use something like useStreamQuery(Profile.Profile, () => ({state: "yourstate", city: "yourcity"}), []) to filter down to contracts with state set to "yourstate" and city set to "yourcity".