I didn’t know about this, so maybe will help other learners as well.
The command is:
daml damlc inspect .daml/dist/create-daml-app-0.1.0.dar | head -1.
The output is like this:
package 937a1153cbdfbed187e506af8a72474553a61e038259627b428cba26d95ea437
Found in the Trigger Service section of the docs.
The following command returns a big json which also contains the package id:
daml damlc inspect-dar .daml/dist/create-daml-app-0.1.0.dar --json
2 Likes
I recommend using inspect-dar
over inspect
which is specifically designed to output metadata like package ids, package names and so on and provides you a stable machine-readable format via the JSON format. inspect
shows you the Daml-LF which is really more for debugging purposes and not guaranteed to be stable (which is why it does not show up in daml damlc --help
).
2 Likes
I’ve jus learnt the jq
json editor command, using which we can extract the package id from the output of inspect-dar
:
> daml damlc inspect-dar --json .daml/dist/create-daml-app-0.1.0.dar | jq -r .main_package_id
51525b45d9aa029174f826aa34c4a44fcd1e8aba3f512c10ae7ebf5647aa643c
5 Likes