Skip to content
CCPEDIAby Unity Nodes
Discussions/App Development/How to fetch contract with contract id or key using GRPC javaForum ↗

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

App Development3 posts367 viewsLast activity May 2023
JO
Joy_KOP
May 2023

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

ST
stefanobaghino-da
May 2023

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.

BE
bernhard
May 2023

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.

← Back to Discussions