A small adjustment is necessary on the Daml UI template for running it on Daml Hub

The Daml UI Template is a simple asset management app which was designed to demonstrate how a React UI can interact with a Daml ledger.

The source code: GitHub - digital-asset/daml-ui-template

There are two roles in the business process:

  • an issuer who can issue and appraise an asset (irrespective of who is the asset’s current owner)
  • and an owner, who can give away the asset.

When I want to create a new asset or want to give away my asset, currently I have to choose the owner’s party id from a drop-down list. The members of the list are “Alice” and “Bob”, hard-coded.

This obviously doesn’t work on Daml Hub, because there the party ids are of the format like “ledger-party-65c7ba82-7c9f-4f83-8a85-7053dacda992”.

In order to use the UI, we have to change this. I chose the easy way of converting the dropdown list to a text field.

These are the two places where you have to change the UI code:

The field type is in both cases

type: "selection",
items: [ "Alice", "Bob" ],

which should be changed to

type: "text"

In this case you can copy-paste the party id you want to use.

Note: For production applications this workaround is obviously not suitable (as is not suitable the general way how the Daml UI template identifies users with party ids). In production applications the UI must somehow map party ids and readable user names.

2 Likes