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

How do I sort a list by some custom criteria in DAML?

Say I have a List of a custom type called Mortgage as defined below: data Mortgage = Mortgage { rate: Decimal; issuedDate: Datetime; amount: Decimal } deriving (Eq, Show) And in this particular one-off case I want to sort the list in…
the1337sauce
  • 539
  • 4
  • 11
2
votes
1 answer

How do I access elements in a list by index in DAML?

Say a list has a length of three and I want to access the second, or middle element. What is the best way to do this?
the1337sauce
  • 539
  • 4
  • 11
1
vote
1 answer

Which approaches are used to format Daml code?

I've just started looking into Daml and writing some basic templates. A feature that feels extremely lacking is auto-format. Searched through docs and wasn't able to find anything about it. This feels strange, especially since Haskell has a decent…
Vsevolod
  • 87
  • 6
1
vote
1 answer

NodeJS API DAML Bindings

we have the following DAML Contract: data Something = Option A | Option B deriving(Show, Eq) data Details = Details with id: Text name: Text state: Text template Main with a: Party b: Party c: Something d: Details I know we can do the following for…
Alex
  • 11
  • 1
1
vote
2 answers

how to call function with dynamic name in Daml?

the choice call have few function to required to be called based on the values which we passed from list. For Example: Choice Call: update X let list = [FunctionX,FunctionZ,FunctionY] list.forEach (FunctionName => FunctionName parameter…
arjun a
  • 151
  • 7
1
vote
1 answer

DAML :- Am unable to set party as observer from another template of its array argument, please help on the same

I am trying to set a party as observer, with that observer argument taking from another template argument which defined as array. Please find the below snippet of my code: template Roles with subscriber: Party signeddate : Time …
irfan baba
  • 21
  • 1
1
vote
1 answer

How to define on e party out of four parties as controller party in Daml

I have five parties so called A,B,C,D and E. Party A defined as signatory party and rest four parties are controllers, but my requirement is any once party can act as controller but i don't know exactly which party would be controller, How could i…
irfan baba
  • 21
  • 1
1
vote
1 answer

Can date be generated while creating a daml contract

I want to get the system date when the daml contract is created. Is there and way to do that. Example :- module ExampleTemplateModule where template ExampleTemplate with admin: Party todayDate: Date --- In place of this can I use…
1
vote
1 answer

What means a Party being a ‘Witness’ of a contract and what are its implications?

I'm making some exercises to get to know Daml and one of the exercises involves the transfer of an Asset from a Party to another Party. Everything works correctly, but I’ve noticed that the owner of the previous Asset contract is marked as ‘Witness’…
rjmAmaro
  • 618
  • 8
  • 20
1
vote
1 answer

What is the '$' operator?

I come across some examples in the Daml documentation where the operator '$' is being used, but cannot fully understand its purpose. Example: submit alice $ create User with username = alice, following = [] Is it the same as do, like in: submit…
rjmAmaro
  • 618
  • 8
  • 20
1
vote
1 answer

How to create dynamic map (key/value) pair in daml?

Can anyone tell how to create a dynamic map in daml? For example :- "r": { "age":…
1
vote
1 answer

how can update only Map values in daml contract?

Datatype detail: type1: Text type2: [detail2] Datatype detail2: type1: Text template A with consumerName: Text producerName : Text details : Map Text detail create A with consumerName,producerName,details now need to update…
arjun a
  • 151
  • 7
1
vote
1 answer

daml test command is failed with: damlc: user error (Failed to start scenario service: BErrorClient

I just created my first DAML project and wrote a basic template. When I try to test it, getting following error: damlc: user error (Failed to start scenario service: BErrorClient (ClientIOError (GRPCIOBadStatusCode StatusUnknown (StatusDetails…
Jai
  • 27
  • 6
1
vote
1 answer

What is the workflow on daml-sawtooth network?

I am trying to understand the adoption of a DAML smart on sawtooth network. According to this tutorial https://github.com/blockchaintp/daml-on-sawtooth there is: Sawtooth network which contains: Rest-api Validator Transaction…
HectorCode
  • 205
  • 2
  • 11
1
vote
1 answer

Interface for Exercise by Key command in DAML node js binding?

We have exercise command with contractId as one of the field. ContractId can be fetched on listening to transaction events. How can we exercise a choice if contract key is known and not contractId?
1 2
3
9 10