Mod note: As of SDK 1.5.0 Scenarios have been superseded by the more powerful Daml Script. We now recommend using that for all purposes. For more information, and to learn how to use Script please check out @Andreas’ post on our blog.
In scenarios, we have the pass
function to imitate the passing of time.
Do we have something similar which can be used in REPL?
I want to demonstrate to a client how a check result with expiry date behaves.
3 Likes
The latest snapshot (which will end up in 1.3.0 released next week) adds a setTime
function to DAML Script and therefore also DAML REPL that allows you to set the time. There is no pass
function atm but you can easily build your own on top of getTime
and setTime
.
2 Likes
Note that setTime
only works if your ledger is running in static time mode since the time service is not available in wallclock mode.
1 Like
Sounds good. Trying to find info about how I can get the snapshot, the release note seems to be hidden, pops up in search, but the page cannot be loaded.
You have to change the version in the URL. We deliberately only list stable versions. E.g., https://docs.daml.com/1.3.0-snapshot.20200708.4686.0.95dfa18e/ for this one. Note that there are no public release notes for snapshots (but since this will be the 1.3.0 RC, you’ll get release notes for this later today).
Almost there:
I have set in daml.yaml
sandbox-options:
- --static-time
After daml start
Sandbox started in static time mode:
/ __/__ ____ ___/ / / ___ __ __
_\ \/ _ `/ _ \/ _ / _ \/ _ \\ \ /
/___/\_,_/_//_/\_,_/_.__/\___/_\_\
INFO: Initialized sandbox version 1.3.0-snapshot.20200708.4686.0.95dfa18e with ledger-id = b9740e15-074b-4037-ab58-3b08a916f688, port = 6865, dar file = List(.daml/dist/ven-iteration-first-0.0.1.dar), time mode = static time, ledger = in-memory, auth-service = AuthServiceWildcard$, contract ids seeding = strong
Waiting for navigator to start:
_ __ _ __
/ |/ /__ __ __(_)__ ____ _/ /____ ____
/ / _ `/ |/ / / _ `/ _ `/ __/ _ \/ __/
/_/|_/\_,_/|___/_/\_, /\_,_/\__/\___/_/
/___/
Version 1.3.0-snapshot.20200708.4686.0.95dfa18e
Frontend running at http://localhost:7500.
But still, REPL gives an error message for setTime
like Sandbox was running in wallclock time:
daml> setTime $ time (date 2020 Jul 9) 14 00 00
java.lang.RuntimeException: setTime is not supported in wallclock mode
daml>
You also need to start daml repl
in static time mode via daml repl --static-time
.
1 Like
Perfect, thank you! REPL is another great feature which helps me to demo how a business process implementation works to domain owners.
2 Likes
And here’s the RC announcement that I hinted at earlier if you want the full release notes DAML SDK 1.3.0 RC is out!
1 Like