0

I was trying to get the latest contract id of the exercised command. The CommandService in Ledger API was not returning the latest contract id when the contracts get executed. I could see that the SubmitAndWait is returning the empty as per the below documentation link.

https://docs.daml.com/app-dev/ledger-api-introduction/proto-docs.html#commandservice

Is there any other method will help us to get the executed/created contract id?

Also, is there any method will help me to pull the contract information based on the contract id?

  • Can you clarify what you are trying to achieve in the broader context so that we can be more helpful? In general you can observe events on the ledger using the TransactionService to subscribe to recorderd transactions or transaction trees: https://docs.daml.com/app-dev/ledger-api-introduction/proto-docs.html#com-digitalasset-ledger-api-v1-transaction-service-proto – stefanobaghino Apr 02 '19 at 03:15

1 Answers1

0

You can subscribe to the transaction stream with the Transaction Service and match the incoming transactions with the command_id you used to send the create/exercise commands.

UPDATE: As of the DAML SDK 0.12.15 (released on 2019-05-06), we added a few new service methods to the CommandService that make what you want to do much easier:

  • SubmitAndWaitForTransaction
  • SubmitAndWaitForTransactionTree

Both service methods take a SubmitAndWaitRequest (just like the SubmitAndWait), with the response containing the resulting Transaction or TransactionTree respectively, which you can inspect for newly created contracts from and exercise.

Gerolf Seitz
  • 121
  • 4