How to get package_id for submit_command with gRPC

wilsonhsu0102
Tue, 15 Aug 2023 19:35:20 +0000
App Development

Hi team,

I am working on setting up a gRPC client to call the Daml ledger api from a Rails app. Following the Java example here: https://github.com/digital-asset/ex-java-bindings/blob/89052898bbdf9828f08ea039c87095bf65bf679b/README.rst#setting-up-the-example-projects
In the Java example above, it seems like the package.id is set during build time, instead of runtime.

The application I am working on consists of multiple packages (and sometimes just 1 when running sandbox in local dev), so I am wondering if there’s a possible way to get the package.Id during runtime from Ledger Api.
https://docs.daml.com/app-dev/grpc/proto-docs.html#com-daml-ledger-api-v1-identifier

I am trying to get it from PackageManagementService ListKnownPackages, but it doesn’t provide package-name in the details. I do see the package_id that I am looking for and its source_description: '', so I am wondering if I can set the source_description to the package_name which would help me identify the package_id.

The only recommended way I see online is using daml damlc inspect-dar with jq, but it doesn’t sound right to be doing that during runtime.

Thank you,

5 posts - 2 participants