DAML Script Library

The DAML Script library defines the API used to implement DAML scripts. See DAML Script:: for more information on DAML script.

Module Daml.Script

Data Types

data Commands a

This is used to build up the commands send as part of submit. If you enable the ApplicativeDo extension by adding {-# LANGUAGE ApplicativeDo #-} at the top of your file, you can use do-notation but the individual commands must not depend on each other.

instance Functor Commands

instance Applicative Commands

instance HasField “commands” (SubmitCmd a) (Commands a)

data Script a

This is the type of A DAML script. Script is an instance of Action, so you can use do notation.

instance Functor Script

instance CanAbort Script

instance Action Script

instance Applicative Script

Functions

query

: Template t => Party -> Script [(ContractId t, t)]

Query the set of active contracts of the template that are visible to the given party.

allocateParty

: Text -> Script Party

Allocate a party with the given display name using the party management service.

allocatePartyOn

: Text -> Text -> Script Party

Allocate a party with the given display name using the party management service.

submit

: Party -> Commands a -> Script a

Submit the commands as a single transaction.

submitMustFail

: Party -> Commands a -> Script ()

Submit the commands as a single transaction but error if it succeeds. This is only useful for testing.

createCmd

: Template t => t -> Commands (ContractId t)

Create a contract of the given template.

exerciseCmd

: Choice t c r => ContractId t -> c -> Commands r

Exercise a choice on the given contract.

exerciseByKeyCmd

: (TemplateKey t k, Choice t c r) => k -> c -> Commands r

Exercise a choice on the contract with the given key.