Simple CLI command to get the package id of a DAR
- gyorgybalazsiOP 2
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 937a1153cbdfbed187e506af8a72474553a61e038259627b428cba26d95ea437Found 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 - cocreature 2
I recommend using
inspect-daroverinspectwhich 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.inspectshows 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 indaml damlc --help). - gyorgybalazsi 5
I’ve jus learnt the
jqjson editor command, using which we can extract the package id from the output ofinspect-dar:> daml damlc inspect-dar --json .daml/dist/create-daml-app-0.1.0.dar | jq -r .main_package_id 51525b45d9aa029174f826aa34c4a44fcd1e8aba3f512c10ae7ebf5647aa643c