Skip to content
CCPEDIAby Unity Nodes
App Development

How to fetch contract with contract id or key using GRPC java

3 posts392 viewsLast activity May 2023

  1. Joy_KOP

    How to fetch contract with contract id or key using GRPC java

  2. stefanobaghino-da

    EDIT: my answer is wrong, see the following one for the correct approach.

    stefanobaghino-da:

    The Ledger API doesn’t expose endpoints to directly fetch a contract and as a consequence the Java bindings cannot do so either directly. The pattern usually followed to do so that of having a non-consuming choice that performs the fetch in your Daml model and invokes that choice using CommandSubmissionClient.submitAndWaitForResult.

  3. bernhard

    Correction to @stefanobaghino-da 's reply: In Daml 2.5 we introduced two new API methods GetEventsByContractId and GetEventsByContractKey which allow you to query a contract by Id or Key. These are currently only exposed by the lower level gPRC bindings for Java, not the rx-java layer. See getEventsByContractKey - #2 by bernhard.

    See API reference docs here.