I am working on deploying our app similar to ex-bond-issuance to DABL but am having a bit of trouble understanding the DABL docs (specifically how to deploy)).
Do I need to deploy individual .dar files for each trigger (and do they need to have individual daml.yaml files that reference the rest of the model in the dependencies)?
When I read the DABL docs it seems like I need to upload individual .dar files with individual daml.yaml. But in my experimenting, it seems like DABL is recognizing the 6 triggers, and I can manually deploy to the respective parties.
You don’t need to deploy individual .dar files for each trigger. The doc is emphasizing the fact that DABL will treat any dar containing triggers as “Trigger”(just like a function) so the Model(template definition) inside the same dar won’t be uploaded to the ledger.
The recommended way(and the required way for DABL) to iterate over Model + Triggers is to add Model .dar as one of the dependencies in the trigger’s daml.yaml. In other word, have a dar only contains template definition as a dependency of your triggers dar(defined in daml.yaml), so that you can keep iterating the trigger dar with functional changes.
If I understand your situation correctly, You only need to separate your Model template definition into a bond-issuance-model.dar, and have another trigger dar: bond-issuance-trigger.dar built from a daml.yaml containing: dependencies: - bond-issuance-model.dar
Then upload/deploy both dar to your DABL Ledger.
Sorry for the confusion on the docs, we are on our way improving it!
@jamesljaworski85
Good to hear you got the model and trigger working!
To initialize your ledger with DAML Script, DABL currently does not support calling the script in a dar. However, you could run the script using daml script cli from local to your DABL ledger as described in the docs, with --json-api
flag. more details for that is described here.
To do that, you only need to download a participants.json from “Ledger Settings”, and take a look at party_participants fields, and prepare another ledger-parties.json file having a reverse mapping of your partyId: partyLiterals. all other credentials are already exists in the participants.json. Finally you can run the script by
daml script --participant-config participants.json --json-api --dar <Name of .dar that contains the DAML Script> --script-name <Name of DAML Script function> --input-file ledger-parties.json
Hi @Li_Ma. Thanks for the response! It wasn’t clear to me that I had to run from the command line on my own machine in order to run the script.
I was able to get things up and running but had to make some changes to the script because of the following error when running the script from master branch.
Exception in thread "main" java.lang.RuntimeException: The script 8fcf2e9b1f2ccf2bc482daea6ea3a1a613d1d31641e5f096a5c48dd188f18811:DA.RefApps.Bond.Test.MarketSetupScript:setupMarket does not take arguments.
at com.daml.lf.engine.script.Runner$.run(Runner.scala:296)
at com.daml.lf.engine.script.RunnerMain$.$anonfun$main$13(RunnerMain.scala:105)
at scala.concurrent.Future.$anonfun$flatMap$1(Future.scala:307)
at scala.concurrent.impl.Promise.$anonfun$transformWith$1(Promise.scala:41)
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64)
at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:56)
at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:93)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:85)
at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:93)
at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:48)
at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:48)
at java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(Unknown Source)
at java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
at java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)
daml-helper: Received ExitFailure 1 when running
Raw command: java "-Dlogback.configurationFile=C:\\Users\\James Jaworski\\AppData\\Roaming\\daml\\sdk\\1.8.0\\daml-sdk/script-logback.xml" -jar "C:\\Users\\James Jaworski\\AppData\\Roaming\\daml\\sdk\\1.8.0\\daml-sdk/daml-sdk.jar" script --participant-config participants.json --json-api --dar target/bond-issuance-model.dar --script-name DA.RefApps.Bond.Test.MarketSetupScript:setupMarket --input-file ledger-parties.json
By modifying the script to allow the parties to be received as an input, I was able to get the script to run when I using this script from the bond-on-dabl branch .