Questions tagged [daml]

Daml is an open source smart contract language which codifies multi-party agreements. This tag should be used for any questions relating to Daml programming and tools supplied with the Daml SDK.

DAML (the Digital Asset Modeling Language) is a contract modeling language which can run on the Digital Asset Ledger, and codifies multi-party agreements over a distributed ledger. More details on DAML and various use cases are given on the DAML Driven blog.

147 questions
2
votes
1 answer

Difference between error, abort, assert and fail?

What is the difference between error, fail, abort and assert in DAML?
Meetanshru
  • 35
  • 2
2
votes
1 answer

How can I lookup interactively the inferred type of a variable within the vscode IDE?

Some IDEs allow you to inspect the inferred type of a variable (i.e. IntelliJ provides Scala types using Ctrl-Shift-P). Does the DAML IDE provide something like that?
therat2000
  • 61
  • 1
2
votes
1 answer

How do I assert a contract is inactive (archived) in a scenario?

If I wanted to validate that a contract is active, I could simply fetch it in a Scenario: template Something with party : Party where signatory party nonconsuming choice DoStuff : () controller party do …
dtanabe
  • 1,611
  • 9
  • 18
2
votes
1 answer

Daml sandbox persistance ledger id mismatch

When running the quick start tutorial, if you try to persist the data into a Postgres database, you get a ledger identifier mismatch in the console when you restart the sandbox. After checking the database the information for the contracts is still…
2
votes
1 answer

How to access Map Key/value in DAML?

Trying to replace an element in the map but not sure how to get it done. Not sure what to do to access the key or the value. Tried the below code but it complains that key or value is not recognized. let map : Map Text OneElement = M.fromList…
Frankie
  • 113
  • 5
2
votes
1 answer

How will the DAML Code affecting two distinct DA Nodes be deployed and how will its integrity maintained?

I am looking for DA’s recommendation/best practices regarding writing and deploying DAML code and object (.daml and .dar) in production grade solutions. Let us take a scenario - Central Authority (CA) operating node may issue a new role under a…
2
votes
2 answers

How to get current contract id when exercising choice

How can I get the contract id when exercising a choice since this refers to the current contract but not the contract id? I can not find it through DAML SDK.
2
votes
1 answer

Displaying the "agreement" field of a DAML contract

How can I display the contents of the "agreement" field of a DAML contract in Navigator? For instance this parameterized text from the test_project contract: agreement toText landlord <> " promises to let " toText tenant <> " live at " <>…
2
votes
1 answer

Digital Asset Node.js bindings: syntax for expressing 'time' type variable

I am working through the tutorial where it says how to create a contract. Here is their code: function createFirstPing() { const request = { commands: { applicationId: 'PingPongApp', workflowId: `Ping-${sender}`, …
Meyer Auslander
  • 349
  • 1
  • 10
2
votes
1 answer

Using the DAML Ledger API from a language other than Java or JavaScript

I would like to write an application that interacts with the DAML ledger but as of the SDK 0.11.3 the only documented bindings are for Java and JavaScript. Is there a way to use the Ledger API from other languages?
stefanobaghino
  • 11,253
  • 4
  • 35
  • 63
2
votes
2 answers

Trouble using the getTime function

I am using getTime inside an assert statement on a contract choice as follows: Add_Car : CarId with startCoverage: Time do -- Check for a legal start date assert ( startCoverage > getTime …
Meyer Auslander
  • 349
  • 1
  • 10
2
votes
2 answers

Function for getting today's date?

I am creating a 'choice' inside a contract template that requires checking today's date. My DAML code is as follows: controller dealer can Add_Car : CarId with startCoverage: Date do -- Check for a legal…
Meyer Auslander
  • 349
  • 1
  • 10
2
votes
1 answer

Trouble using the 'date' function inside a 'create' statement or 'exercise' statement

Here is a code snippet: car1AddCid <- submit dealer1 do carCid <- create Car with dealer = dealer1 insurer = insurance1 vin = "1A" daily_insurance_rate = 1.5 daily_rate_APD = 0.16 covered = False …
Meyer Auslander
  • 349
  • 1
  • 10
2
votes
1 answer

Syntax errors in Main.daml

My Main.daml code is as follows: daml 1.2 module Main where type CarId = ContractId Car -- for return type on controller actions template Car with dealer : Party insurer : Party vin: Text date_vehicle_added: Date …
Meyer Auslander
  • 349
  • 1
  • 10
2
votes
1 answer

How are multiple return arguments from a choice accessed

I have a choice defined as: MyChoice: ( ContractId X, ContractId X ) .... return ( a, b ) How do I use a or b in a scenario as an argument for something else? Dot notation doesn't appear to work.
user3293336
  • 121
  • 1
1
2
3
9 10