Skip to content
CCPEDIAby Unity Nodes
App Development

Trigger Service Start Trigger Package Id

4 posts273 views1 likesLast activity Jan 2023

  1. VictorShneerOP

    Hi!

    How client app can get the correct Package Id to start a trigger using Trigger Service?

    I continue with Trigger Service. I started a trigger from Postman.
    My payload was:

    {
      "triggerName": "17cd398d85060be21a136c7ba797bd9029b9006c66e08f53766b42d86ca93c37:Triggers.MergeHoldingsTrigger:mergeFungiblesTrigger",
      "party": "Alice",
    }
    

    I got Package Id using:
    daml damlc inspect path/to/trigger.dar | head -1
    What is the best way for a client application to reach the package id? I see the JSON Api exposes List all Packages but not sure it can help much since it is returning a list…
    Can you suggest something here?

  2. Mate_Varga

    Hi @VictorShneer

    The trigger service will return the package ID whenever you upload a new Dar:
    https://docs.daml.com/tools/trigger-service/index.html#upload-a-new-dar

    You should use that to know how to start your trigger.

    Hope this helps,
    Mate

  3. VictorShneer

    Thanks Mate!

    So I should keep trigger as a separate project to make it “live” in a separate dar.
    Then I upload it through Trigger Sevice (not directly to the ledger as usual)
    Catch the package id and use it whenever I want to start a new trigger. Right?
    But what if there is a time span between dar upload and the new trigger start? I should consider storage for package id in this case, right?
    :thinking:

  4. cocreature 1

    I recommend to use daml damlc inspect-dar --json path/to/your/dar here.