Sandbox-options:--wall-clock-time

Hi everyone, I am here again, asking for some help. I am trying to run my first contract in navigator but I get the following error:
Waiting for canton sandbox to start. Error: Unknown option --wall-clock-time Canton v2.4.0

I don’t understand what I am doing wrong, as I am following a tutorial and I can see that I have the same line of codes, but mine doesn’t work. This is my code in daml.yaml
`#init-script: Main:setup
parties:

  • Jerry
  • Elaine
  • Kramer
    dependencies:
  • daml-prim
  • daml-stdlib
  • daml-script
    exposed-modules:
  • Main
    sandbox-options:
  • –wall-clock-time’

Anyone can help? Sorry to bother you constantly, for me it’s a big learning curve :pray: :pray: :pray: But I try a lot on my own before asking :slight_smile: :slight_smile: :slight_smile:

To get around this error, I believe you can safely delete the last two lines from your daml.yaml file.

sandbox-options:
  - --wall-clock-time

I’m thinking it is this bug.

Hi Wallace, thank you for coming back to me again!:slight_smile: :slightly_smiling_face:

I deleted both lines. Now it opens, but when I play a role (let’s say Jerry), and I want to register the first contract, it seems to work, but the contract is not created. A small “access denied” black symbol is at the top right, close to the date.

Other suggestions? :pray: :pray:

I don’t remember where the Jerry, Elaine, and Kramer tutorial is. Can point us to the directions you are following?

I am folwing this

Daml 101 Video Series

Daml 101: Let’s write a Daml template from scratch [2022]

Also Please, if there are more resources or videos like this, please let me know :pray: :pray: :pray:

Could you copy-and-paste your code into this thread so that I can try it out myself. Maybe I’ll be able to see what is going on, instead of having to guess. :slight_smile:

Regarding other resources, I suspect you are looking in the right place… Become a Daml Developer.

Great! Sure, thanks a lot.
This is the Main.daml
`module Main where

–import Daml.Script

type ItemCustodyId = ContractId ItemCustody

–track chain of property
template ItemCustody
with
owner : Party
custodian : Party
neighbour: Party
itemName: Text
meterCount: Int --shutter clicks

where
    signatory owner
    observer custodian
    observer neighbour

– depreacated sinax controller … can
–controller owner can
–ReleaseItemTo : ContractID ItemCustody
–with
–friend : Party
–do

    choice ReleaseItemTo 
        : ItemCustodyId
        with
            friend : Party
            currentMeterCount : Int
        controller owner
        
        do 
            create this with
                custodian = friend 
                meterCount = currentMeterCount

    choice ReturnItemTo 
        : ItemCustodyId
        with
            rightfulOwner : Party
            currentMeterCount :Int
        controller custodian
        do 
            create this with
                owner = rightfulOwner
                meterCount = currentMeterCount

–test
{-
setup : Script ItemCustodyId
setup = script do
jerry ← allocateParty “Jerry”
elaine ← allocateParty “Elaine”
kramer ← allocateParty “Kramer”

brandNewCamera <- submit jerry do
    createCmd ItemCustody with
        owner = jerry
        custodian = jerry
        neighbour = kramer
        itemName = "Really Expensive Camera"
        meterCount = 347

elaineHasCamera <- submit jerry do
    exerciseCmd brandNewCamera ReleaseItemTo with friend = elaine, currentMeterCount = 360

submit elaine do
    exerciseCmd elaineHasCamera ReturnItemTo with rightfulOwner = jerry, currentMeterCount = 10004
-}
'

and this is the daml.yaml
’ sdk-version: 2.4.0
name: MyBorrowApp
source: daml
version: 1.0.0
#init-script: Main:setup
parties:

  • Jerry
  • Elaine
  • Kramer
    dependencies:
  • daml-prim
  • daml-stdlib
  • daml-script
    exposed-modules:
  • Main
    #sandbox-options:

- --wall-clock-time

#navigator-options:

- --feature-user-management=false

’ sdk-version: 2.4.0

name: MyBorrowApp

source: daml

version: 1.0.0

#init-script: Main:setup

parties:

  • Jerry

  • Elaine

  • Kramer

dependencies:

  • daml-prim

  • daml-stdlib

  • daml-script

exposed-modules:

  • Main

#sandbox-options:

- --wall-clock-time

#navigator-options:

- --feature-user-management=false’

Sorry I don’t know why the daml.yaml get copied in this strange way

To paste long sections of code into this site, use three tick marks on the line before and the line after your code.

This is without the three tick marks.

This is with the three tick marks.
name: MyBorrowApp
source: daml
version: 1.0.0
#init-script: Main:setup
parties:
  - Jerry
  - Elaine
  - Kramer
dependencies:
  - daml-prim
  - daml-stdlib
  - daml-script
exposed-modules:
  - Main
#sandbox-options:
#   - --wall-clock-time
#navigator-options:
#  - --feature-user-management=false```
1 Like

--import Daml.Script

type ItemCustodyId = ContractId ItemCustody

--track chain of property
template ItemCustody
    with
        owner : Party
        custodian : Party
        neighbour: Party
        itemName: Text
        meterCount: Int --shutter clicks
         
    where
        signatory owner
        observer custodian
        observer neighbour
        
 -- depreacated sinax controller ... can 
        --controller owner can
            --ReleaseItemTo : ContractID ItemCustody
                --with 
                    --friend : Party
                --do 

        choice ReleaseItemTo 
            : ItemCustodyId
            with
                friend : Party
                currentMeterCount : Int
            controller owner
            
            do 
                create this with
                    custodian = friend 
                    meterCount = currentMeterCount

        choice ReturnItemTo 
            : ItemCustodyId
            with
                rightfulOwner : Party
                currentMeterCount :Int
            controller custodian
            do 
                create this with
                    owner = rightfulOwner
                    meterCount = currentMeterCount

--test
{-
setup : Script ItemCustodyId
setup = script do
    jerry <- allocateParty "Jerry"
    elaine <- allocateParty "Elaine"
    kramer <- allocateParty "Kramer"

    brandNewCamera <- submit jerry do
        createCmd ItemCustody with
            owner = jerry
            custodian = jerry
            neighbour = kramer
            itemName = "Really Expensive Camera"
            meterCount = 347

    elaineHasCamera <- submit jerry do
        exerciseCmd brandNewCamera ReleaseItemTo with friend = elaine, currentMeterCount = 360

    submit elaine do
        exerciseCmd elaineHasCamera ReturnItemTo with rightfulOwner = jerry, currentMeterCount = 10004
    -}```

Thanks! Sorry I put only one ` previously

Some of the things related to users/parties and how the Navigator loads those have changed since that video was recorded.

Here is working code:

daml.yaml
sdk-version: 2.4.0
name: MyBorrowApp
source: daml
version: 1.0.0
init-script: Main:setup
dependencies:
  - daml-prim
  - daml-stdlib
  - daml-script
exposed-modules:
  - Main
navigator-options:
 - --feature-user-management=false
Main.daml
module Main where

import Daml.Script

type ItemCustodyId = ContractId ItemCustody

--track chain of property
template ItemCustody
    with
        owner : Party
        custodian : Party
        neighbour: Party
        itemName: Text
        meterCount: Int --shutter clicks
         
    where
        signatory owner
        observer custodian
        observer neighbour
        
        choice ReleaseItemTo 
            : ItemCustodyId
            with
                friend : Party
                currentMeterCount : Int
            controller owner
            
            do 
                create this with
                    custodian = friend 
                    meterCount = currentMeterCount

        choice ReturnItemTo 
            : ItemCustodyId
            with
                rightfulOwner : Party
                currentMeterCount :Int
            controller custodian
            do 
                create this with
                    owner = rightfulOwner
                    meterCount = currentMeterCount

setup : Script ItemCustodyId
setup = script do
    jerry <- allocateParty "Jerry"
    elaine <- allocateParty "Elaine"
    kramer <- allocateParty "Kramer"

    brandNewCamera <- submit jerry do
        createCmd ItemCustody with
            owner = jerry
            custodian = jerry
            neighbour = kramer
            itemName = "Really Expensive Camera"
            meterCount = 347

    elaineHasCamera <- submit jerry do
        exerciseCmd brandNewCamera ReleaseItemTo with friend = elaine, currentMeterCount = 360

    submit elaine do
        exerciseCmd elaineHasCamera ReturnItemTo with rightfulOwner = jerry, currentMeterCount = 10004

The things to notice are:

  • Instead of listing the Parties in the daml.yaml file, use --feature-user-management=false as described at Navigator — Daml SDK 2.4.0 documentation.

  • Define a setup script to allocate the parties. Navigator will then use those parties to populate the Navigator login screen.

Hope that helps!

Thank you ever so much, Wallace! I will study carefully what you just sent and try again. Thank you so so much again. :pray: :pray: :pray: :pray: :pray: :pray:

Will be these videos get updated? I know for others would not matter but for people very very inexperience like me :blush: it means a lot. :slightly_smiling_face:

Hi Wallace, how can it be then when I open I see already the contracts created and archived? From the tutorial, I understand that I should see the template but not the contracts, as I haven’t done anything yet.
I should open the template, insert the date and create the contract. Instead it’s all already there so how can I play with the 3 roles?

Also, when I open the contract, the layout looked very messy, and I think it should not look like that. In signatories, observers and contract details the names are not shown but it appears only the number of the party (partly visible), while the Item name and the meter count are shown respectively with the correct name and number. It doesn’t seem to me that I can create a contract correctly. Here is the link, I hope you can open it.

http://localhost:7500/contracts/0001fdbdee3293f3a0dc22405cdf229db8777659bd1f79fd2b2e6ec6b7e9ced1bdca001220809e23d7177a4c71c41210699896f38b852a4eb91cb0e2d5665de5bc84d55385//

A bit more help? :pray: :pray: :pray: :pray: :pray:

That is because the setup script includes three commands (one createCmd and two exerciseCmds). If you would like to start without those, you can comment them out of the setup script and restart everything. Even if you comment out the commands, you will want to leave in the allocateParty lines.

I’m guessing your layout looks something like this, where all the parties include a long unhelpful identifier.

Yes, that reflects that the representation of “parties” in Daml has evolved to include a unique identifier. And Navigator is still just naively displaying the full name (with the newly added unique identifier.) The display is accurate, but not as clean as we might like when learning. It’s not straightforward to know who party party-9b6faed2-6bb6-4cd2-bfc0-58ca6f2b024f::1220a220a71c... is. :woozy_face:

Here is a way to get around this issue. In your setup script, add a “hint” to the party allocation.

setup = script do
    -- jerry <- allocateParty "Jerry"
    -- elaine <- allocateParty "Elaine"
    -- kramer <- allocateParty "Kramer"
    jerry <- allocatePartyWithHint "Jerry" (PartyIdHint "Jerry")
    elaine <- allocatePartyWithHint "Elaine" (PartyIdHint "Elaine")
    kramer <- allocatePartyWithHint "Kramer" (PartyIdHint "Kramer")

After adding the party id hint, we can at least associate the identifier with the party as we know them. :grinning:

Remember, after making changes to your setup script, stop the running services and rerun daml start.