0

I am working through the tutorial. When I check the contents of the template-ids.json after running npm run fetch-template-ids in the 'ping-pong' project folder, it looks as follows:

{"Car.Car":{"packageId":"9158c3e66ac2a78e427307b098f7a45e86ddcb40a9be6a26eea0d363e7b48a10","name":"Car.Car"}}
stefanobaghino
  • 11,253
  • 4
  • 35
  • 63
Meyer Auslander
  • 349
  • 1
  • 10

1 Answers1

1

Judging from the output, it looks like you are producing the template identifiers file for a different model than the one shipped with the tutorial.

The script works by using the bindings to connect to a running ledger and download the templates loaded in it with their package identifiers. By default it tries to connect to localhost:7600.

The explanation about the behavior you are observing is that you have a running sandbox on port 7600 on your own machine which has a model loaded with a module Car containing a template Car.

You can follow to approaches.

1. Restart the tutorial sandbox on port 7600

  • locate and stop the sandbox running on port 7600
  • restart the sandbox from the tutorial project
  • ensure the restarted ledger is running on port 7600
  • run npm run fetch-template-ids as usual

To locate a running ledger you can use this answer.

When you located the ledger busy on port 7600, my recommendation is to go to its project directory and run da stop, rather then killing it. The project directory should be easy to identify as part of the path where the DAR file passed as an argument resides.

For example, if the command includes the following path as an argument

/home/someuser/path/to/your-daml-project/target/PingPongExample.dar

You want to do the following

cd /home/someuser/path/to/your-daml-project
da stop

2. Run the tutorial using a different port

  • check on which port the tutorial sandbox is running
  • run the script with an extra option

        npm run fetch-template-ids -- -p <PORT_NUMBER>
        #                          ^^ notice the double dash here
    

If you are not sure about the port on which the tutorial sandbox is running, you can check it by stopping and restarting it with the following command from the tutorial project directory:

da stop && da sandbox

The output should look like the following

stopping... Sandbox ledger server
/path/to/daml/PingPong.daml with no scenario
and binding to port 7676
[Info] Starting:
    Sandbox ledger server
    /home/ste/Projects/DACH-NY/pooong/daml/PingPong.daml with no scenario
    and binding to port 7676

If that output looks like this, you'll have to run the following command to fetch the template identifiers:

npm run fetch-template-ids -- -p 7676

Furthermore, please note the the tutorial assumes you are using a ledger that runs on port 7600. If you follow the second approach, make sure to make the necessary arrangements to connect to the proper ledger (I believe the only required change is to specify a different port when calling DamlLedgerClient.connect).

stefanobaghino
  • 11,253
  • 4
  • 35
  • 63