How to fetch contract with contract id or key using GRPC java
How to fetch contract with contract id or key using GRPC java
EDIT: my answer is wrong, see the following one for the correct approach.
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.
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.