Repl/navigator parties

I’m testing out daml repl for the first time.

I can get some examples to work. For instance, I can create contracts with submit buyer $ createCmd ..., and then visualize these in the ACS using query, like the example in the official docs.

However, when I go to visualize them in the Navigator, they’re not there!

I suspect this is because buyer <- allocateParty "Buyer" is allocating a party (duh! :confounded:) with a random string as id, rather than using “Buyer” as the id. I can in fact see this when I inspect the query results (look at bearer or counterparty):

cs <- query @FinancialContract buyer
daml> debug cs
[DA.Internal.Prelude:540]: [(<contract-id>,FinancialContract {bearer = 'party-a3a6173c', counterparty = 'party-a3a6173c', ...

So when I sign in to the Navigator using the user Buyer, I can’t see any of these contracts.

Is there some way I can work around this, so that I can inspect the contracts on the Navigator but interact with them through the REPL?

There are two ways to approach this:

  1. Try to control party ids. In general, that’s not possible, e.g., Canton will include cryptographic keys in your party id. However, on Sandbox things are different. You can use allocatePartyWithHint displayName (PartyIdHint hint) and Sandbox will allocate a party with exactly the id hint or fail if it already exists.

  2. Make Navigator pick up the parties that have been allocated. There are a few ways to do this:

    1. Specify them in your daml.yaml. Works but is a bit annoying since they might change after every ledger restart.
    2. Use daml ledger navigator. That will generate a temporary navigator config based on the allocated parties. Note that the UI will show display names for the login field but if you create a contract or exercise a choice, you have to specify the actual party id. You have to restart Navigator everytime you allocate a new party.
    3. In SDK 1.8, daml navigator will automatically pick up allocated parties if you don’t have any specified in your daml.yaml. Those parties will be refreshed periodically so no need to restart Navigator.

Great to hear this is automated in 1.8!

The allocatePartyWithHint isn’t named very intuitively … :frowning_face: Should have read the documentation!