- Overview
- Tutorials
- Getting started
- Get started with Canton and the JSON Ledger API
- Get started with Canton Network App Dev Quickstart
- Get started with smart contract development
- Basic contracts
- Test templates using Daml scripts
- Build the Daml Archive (.dar) file
- Data types
- Transform contracts using choices
- Add constraints to a contract
- Parties and authority
- Compose choices
- Handle exceptions
- Work with dependencies
- Functional programming 101
- The Daml standard library
- Test Daml contracts
- Next steps
- Application development
- Getting started
- Development how-tos
- Component how-tos
- Explanations
- References
- Application development
- Smart contract development
- Daml language cheat sheet
- Daml language reference
- Overview: Template Structure
- Reference: Templates
- Reference: Choices
- Reference: Updates
- Reference: Data Types
- Reference: Built-in Functions
- Reference: Expressions
- Reference: Functions
- Reference: Daml File Structure
- Reference: Daml Packages
- Reference: Contract Keys
- Reference: Interfaces
- Reference: Exceptions (Deprecated)
- Daml standard library
- DA.Action.State.Class
- DA.Action.State
- DA.Action
- DA.Assert
- DA.Bifunctor
- DA.Crypto.Text
- DA.Date
- DA.Either
- DA.Exception
- DA.Fail
- DA.Foldable
- DA.Functor
- DA.Internal.Interface.AnyView.Types
- DA.Internal.Interface.AnyView
- DA.List.BuiltinOrder
- DA.List.Total
- DA.List
- DA.Logic
- DA.Map
- DA.Math
- DA.Monoid
- DA.NonEmpty.Types
- DA.NonEmpty
- DA.Numeric
- DA.Optional
- DA.Record
- DA.Semigroup
- DA.Set
- DA.Stack
- DA.Text
- DA.TextMap
- DA.Time
- DA.Traversable
- DA.Tuple
- DA.Validation
- GHC.Show.Text
- GHC.Tuple.Check
- Prelude
- Daml Script
- Smart contract upgrading reference
- Glossary of concepts
Daml.Script¶
The Daml Script testing library.
Typeclasses¶
class IsSubmitOptions options where
Defines a type that can be transformed into a SubmitOptions
- toSubmitOptions
: options -> SubmitOptions
class Applicative script => ScriptSubmit script where
Defines an applicative that can run transaction submissions. Usually this is simply
Script
.
- liftSubmission
: HasCallStack => ConcurrentSubmits a -> script a
Data Types¶
data InvalidUserId
Thrown if text for a user identifier does not conform to the format restriction.
Field
Type
Description
m
data User
data UserAlreadyExists
Thrown if a user to be created already exists.
Field
Type
Description
userId
data UserId
data UserNotFound
Thrown if a user cannot be located for a given user identifier.
Field
Type
Description
userId
data UserRight
data ConcurrentSubmits a
Applicative that allows for multiple concurrent transaction submissions See
concurrently
for usage of this type.
Field
Type
Description
submits
[Submission]
continue
[Either SubmitError ([CommandResult], TransactionTree)] -> a
data PackageId
data SubmitOptions
Options to detemine the stakeholders of a transaction, as well as disclosures. Intended to be specified using the
actAs
,readAs
anddisclose
builders, combined using the Semigroup concat(<>)
operator.actAs alice <> readAs [alice, bob] <> disclose myContractNote that actAs and readAs follows the same party derivation rules as
signatory
, see their docs for examples. All submissions must specify at least oneactAs
party, else a runtime error will be thrown. A minimum submission may look likeactAs alice `submit` createCmd MyContract with party = aliceFor backwards compatibility, a single or set of parties can be provided in place of the
SubmitOptions
tosubmit
, which will represent theactAs
field. The above example could be reduced toalice `submit` createCmd MyContract with party = alice
data CryptoErrorType
Daml Crypto (Secp256k1) related submission errors
Field
Type
Description
value
Field
Type
Description
keyValue
Field
Type
Description
signatureValue
Field
Type
Description
contractIdValue
data SubmitError
Errors that can be thrown by a command submission via
trySubmit
Contract with given contract ID could not be found, and has never existed on this participant When run on Canton, there may be more than one contract ID, and additionalDebuggingInfo is always None On the other hand, when run on IDELedger, there is only ever one contract ID, and additionalDebuggingInfo is always Some
Field
Type
Description
unknownContractIds
Provided as text, as we do not know the template ID of a contract if the lookup fails
additionalDebuggingInfo
should always be None in Canton’s case, see https://github.com/digital-asset/daml/issues/17154
Contract with given contract key could not be found
Field
Type
Description
contractKey
No vetted package with given package name could be found
Field
Type
Description
packageName
Generic authorization failure, included missing party authority, invalid signatories, etc.
Field
Type
Description
authorizationErrorMessage
DisclosedContractKeyHashingError
Given disclosed contract key does not match the contract key of the contract on ledger.
Field
Type
Description
contractId
expectedKey
givenKeyHash
Attempted to create a contract with a contract key that already exists
Field
Type
Description
duplicateContractKey
Canton will often not provide this key, IDELedger will
Contract key lookup yielded different results
Field
Type
Description
contractKey
Unhandled user thrown exception
Field
Type
Description
exc
Errors more complex than simple records cannot currently be encoded over the grpc status. Such errors will be missing here.
Transaction failure due to abort/assert calls pre-exceptions
Field
Type
Description
userErrorMessage
Failure due to false result from
ensure
, strictly pre-exception. According to docs, not throwable with LF >= 1.14. On LF >= 1.14, a failedensure
will result in aPreconditionFailed
exception wrapped inUnhandledException
.CreateEmptyContractKeyMaintainers
Attempted to create a contract with empty contract key maintainers
Field
Type
Description
invalidTemplate
FetchEmptyContractKeyMaintainers
Attempted to fetch a contract with empty contract key maintainers
Field
Type
Description
failedTemplateKey
Attempted to exercise/fetch a contract with the wrong template type
Field
Type
Description
contractId
Any contract Id of the actual contract
expectedTemplateId
actualTemplateId
ContractDoesNotImplementInterface
Attempted to use a contract as an interface that it does not implement
Field
Type
Description
contractId
templateId
interfaceId
ContractDoesNotImplementRequiringInterface
Attempted to use a contract as a required interface that it does not implement
Field
Type
Description
contractId
templateId
requiredInterfaceId
requiringInterfaceId
Attempted to compare values that are not comparable
Illegal Contract ID found in Contract Key
(no fields)
Attempted to compare incomparable contract IDs. You’re doing something very wrong. Two contract IDs with the same prefix are incomparable if one of them is local and the other non-local or if one is relative and the other relative or absolute with a different suffix.
Field
Type
Description
globalExistingContractId
We do not know the template ID at time of comparison.
A value has been nested beyond a given depth limit
Field
Type
Description
limit
Nesting limit that was exceeded
The transaction refers to locked contracts which are in the process of being created, transferred, or archived by another transaction. If the other transaction fails, this transaction could be successfully retried.
Field
Type
Description
localVerdictLockedContracts
Locked contract ids
The transaction refers to locked keys which are in the process of being modified by another transaction.
Field
Type
Description
localVerdictLockedKeys
Locked contract keys
Upgrade exception
Field
Type
Description
errorType
errorMessage
Exception resulting from call to
failWithStatus
Field
Type
Description
failureStatus
Crypto exceptions
Field
Type
Description
cryptoErrorType
cryptoErrorMessage
Development feature exceptions
Field
Type
Description
devErrorType
DevErrorType
devErrorMessage
Generic catch-all for missing errors.
Field
Type
Description
unknownErrorMessage
data UpgradeErrorType
SCU related submission errors
Field
Type
Description
coid
srcTemplateId
dstTemplateId
signatories
[Party]
observers
[Party]
keyOpt
Optional (AnyContractKey, [Party])
Field
Type
Description
expectedType
data Created
Field
Type
Description
contractId
argument
data CreatedIndexPayload t
Field
Type
Description
templateId
offset
data Exercised
Field
Type
Description
contractId
choice
argument
childEvents
data ExercisedIndexPayload t
Field
Type
Description
templateId
choice
offset
child
data TransactionTree
Field
Type
Description
rootEvents
data TreeEvent
data TreeIndex t
data AnyContractId
Field
Type
Description
templateId
contractId
ContractId ()
data ParticipantName
Participant name for multi-participant script runs to address a specific participant
Field
Type
Description
participantName
data PartyDetails
The party details returned by the party management service.
data PartyIdHint
A hint to the backing participant what party id to allocate. Must be a valid PartyIdString (as described in @value.proto@).
Field
Type
Description
partyIdHint
- type PrivateKeyHex
= BytesHex
A DER formatted private key to be used for ECDSA message signing
data Secp256k1KeyPair
Secp256k1 key pair generated by
secp256k1generatekeypair
for testing.
Field
Type
Description
privateKey
publicKey
data Commands a
This is used to build up the commands sent as part of
submit
. If you enable theApplicativeDo
extension by adding{-# LANGUAGE ApplicativeDo #-}
at the top of your file, you can usedo
-notation but the individual commands must not depend on each other and the last statement in ado
block must be of the formreturn expr
orpure expr
.
Field
Type
Description
commands
[CommandWithMeta]
continue
[CommandResult] -> a
data Disclosure
Contract disclosures which can be acquired via
queryDisclosure
Field
Type
Description
templateId
contractId
ContractId ()
blob
data Script a
This is the type of A Daml script.
Script
is an instance ofAction
, so you can usedo
notation.
Field
Type
Description
runScript
() -> Free ScriptF (a, ())
HIDE We use an inlined StateT () to separate evaluation of something of type Script from execution and to ensure proper sequencing of evaluation. This is mainly so that
debug
does something slightly more sensible.dummy
()
HIDE Dummy field to make sure damlc does not consider this an old-style typeclass.
Functions¶
- userIdToText
-
Extract the name-text from a user identitifer.
- validateUserId
: HasCallStack => Text -> Script UserId
Construct a user identifer from text. May throw InvalidUserId.
- createUser
: HasCallStack => User -> [UserRight] -> Script ()
Create a user with the given rights. May throw UserAlreadyExists.
- createUserOn
: HasCallStack => User -> [UserRight] -> ParticipantName -> Script ()
Create a user with the given rights on the given participant. May throw UserAlreadyExists.
- getUser
: HasCallStack => UserId -> Script User
Fetch a user record by user id. May throw UserNotFound.
- getUserOn
: HasCallStack => UserId -> ParticipantName -> Script User
Fetch a user record by user id from the given participant. May throw UserNotFound.
- listAllUsers
-
List all users. This function may make multiple calls to underlying paginated ledger API.
- listAllUsersOn
: ParticipantName -> Script [User]
List all users on the given participant. This function may make multiple calls to underlying paginated ledger API.
- grantUserRights
: HasCallStack => UserId -> [UserRight] -> Script [UserRight]
Grant rights to a user. Returns the rights that have been newly granted. May throw UserNotFound.
- grantUserRightsOn
: HasCallStack => UserId -> [UserRight] -> ParticipantName -> Script [UserRight]
Grant rights to a user on the given participant. Returns the rights that have been newly granted. May throw UserNotFound.
- revokeUserRights
: HasCallStack => UserId -> [UserRight] -> Script [UserRight]
Revoke rights for a user. Returns the revoked rights. May throw UserNotFound.
- revokeUserRightsOn
: HasCallStack => UserId -> [UserRight] -> ParticipantName -> Script [UserRight]
Revoke rights for a user on the given participant. Returns the revoked rights. May throw UserNotFound.
- deleteUser
: HasCallStack => UserId -> Script ()
Delete a user. May throw UserNotFound.
- deleteUserOn
: HasCallStack => UserId -> ParticipantName -> Script ()
Delete a user on the given participant. May throw UserNotFound.
- listUserRights
: HasCallStack => UserId -> Script [UserRight]
List the rights of a user. May throw UserNotFound.
- listUserRightsOn
: HasCallStack => UserId -> ParticipantName -> Script [UserRight]
List the rights of a user on the given participant. May throw UserNotFound.
- submitUser
: HasCallStack => UserId -> Commands a -> Script a
Submit the commands with the actAs and readAs claims granted to a user. May throw UserNotFound.
- submitUserOn
: HasCallStack => UserId -> ParticipantName -> Commands a -> Script a
Submit the commands with the actAs and readAs claims granted to the user on the given participant. May throw UserNotFound.
- setTime
: HasCallStack => Time -> Script ()
Set the time via the time service.
This is only supported in Daml Studio and
daml test
as well as when running over the gRPC API against a ledger in static time mode.Note that the ledger time service does not support going backwards in time. However, you can go back in time in Daml Studio.
- sleep
: HasCallStack => RelTime -> Script ()
Sleep for the given duration.
This is primarily useful in tests where you repeatedly call
query
until a certain state is reached.Note that this will sleep for the same duration in both wall clock and static time mode.
- passTime
-
Advance ledger time by the given interval.
This is only supported in Daml Studio and
daml test
as well as when running over the gRPC API against a ledger in static time mode. Note that this is not an atomic operation over the gRPC API so no other clients should try to change time while this is running.Note that the ledger time service does not support going backwards in time. However, you can go back in time in Daml Studio.
- actAs
: IsParties parties => parties -> SubmitOptions
Builds a SubmitOptions with given actAs parties. Any given submission must include at least one actAs party. Note that the parties type is constrainted by
IsParties
, allowing for specifying parties as any of the following:Party [Party] NonEmpty Party Set Party Optional Party
- readAs
: IsParties parties => parties -> SubmitOptions
Builds a SubmitOptions with given readAs parties. A given submission may omit any readAs parties and still be valid. Note that the parties type is constrainted by
IsParties
, allowing for specifying parties as any of the following:Party [Party] NonEmpty Party Set Party Optional Party
- discloseMany
: [Disclosure] -> SubmitOptions
Provides many Explicit Disclosures to the transaction.
- disclose
: Disclosure -> SubmitOptions
Provides an Explicit Disclosure to the transaction.
- packagePreference
: [PackageId] -> SubmitOptions
Provide a package id selection preference for upgrades for a submission
- prefetchKeys
: [AnyContractKey] -> SubmitOptions
Provide a list of contract keys to prefetch for a submission
- concurrently
: HasCallStack => ConcurrentSubmits a -> Script a
Allows for concurrent submission of transactions, using an applicative, similar to Commands. Concurrently takes a computation in
ConcurrentSubmits
, which supports all the existingsubmit
functions thatScript
supports. It however does not implementAction
, and thus does not support true binding and computation interdependence NOTE: The submission order of transactions withinconcurrently
is deterministic, this function is not intended to test contention. It is only intended to allow faster submission of many unrelated transactions, by not waiting for completion for each transaction before sending the next. Example:exerciseResult <- concurrently $ do alice `submit` createCmd ... res <- alice `submit` exerciseCmd ... bob `submit` createCmd ... pure res
- submitResultAndTree
: (HasCallStack, ScriptSubmit script, IsSubmitOptions options) => options -> Commands a -> script (a, TransactionTree)
Equivalent to
submit
but returns the result and the full transaction tree.
- trySubmitResultAndTree
: (HasCallStack, ScriptSubmit script, IsSubmitOptions options) => options -> Commands a -> script (Either SubmitError (a, TransactionTree))
Equivalent to
trySubmit
but returns the result and the full transaction tree.
- submitWithError
: (HasCallStack, ScriptSubmit script, IsSubmitOptions options) => options -> Commands a -> script SubmitError
Equivalent to
submitMustFail
but returns the error thrown.
- submit
: (HasCallStack, ScriptSubmit script, IsSubmitOptions options) => options -> Commands a -> script a
submit p cmds
submits the commandscmds
as a single transaction from partyp
and returns the value returned bycmds
. Theoptions
field can either be any "Parties" like type (SeeIsParties
) orSubmitOptions
which allows for finer control over parameters of the submission.If the transaction fails,
submit
also fails.
- submitWithOptions
: (HasCallStack, ScriptSubmit script, IsSubmitOptions options) => options -> Commands a -> script a
Warning
DEPRECATED:
Daml 2.9 compatibility helper, use ‘submit’ instead
- submitTree
: (HasCallStack, ScriptSubmit script, IsSubmitOptions options) => options -> Commands a -> script TransactionTree
Equivalent to
submit
but returns the full transaction tree.
- trySubmit
: (HasCallStack, ScriptSubmit script, IsSubmitOptions options) => options -> Commands a -> script (Either SubmitError a)
Submit a transaction and recieve back either the result, or a
SubmitError
. In the majority of failures, this will not crash at runtime.
- trySubmitTree
: (HasCallStack, ScriptSubmit script, IsSubmitOptions options) => options -> Commands a -> script (Either SubmitError TransactionTree)
Equivalent to
trySubmit
but returns the full transaction tree.
- submitMustFail
: (HasCallStack, ScriptSubmit script, IsSubmitOptions options) => options -> Commands a -> script ()
submitMustFail p cmds
submits the commandscmds
as a single transaction from partyp
. See submitWithOptions for details on theoptions
fieldIt only succeeds if the submitting the transaction fails.
- submitMustFailWithOptions
: (HasCallStack, ScriptSubmit script, IsSubmitOptions options) => options -> Commands a -> script ()
Warning
DEPRECATED:
Daml 2.9 compatibility helper, use ‘submitMustFail’ instead
- submitMulti
: (HasCallStack, ScriptSubmit script) => [Party] -> [Party] -> Commands a -> script a
Warning
DEPRECATED:
Legacy API, usesubmit
,actAs
andreadAs
separatelysubmitMulti actAs readAs cmds
submitscmds
as a single transaction authorized byactAs
. Fetched contracts must be visible to at least one party in the union of actAs and readAs.Note: This behaviour can be achieved using
submit (actAs actors <> readAs readers) cmds
and is only provided for backwards compatibility.
- submitMultiMustFail
: (HasCallStack, ScriptSubmit script) => [Party] -> [Party] -> Commands a -> script ()
Warning
DEPRECATED:
Legacy API, usesubmitMustFail
,actAs
andreadAs
separatelysubmitMultiMustFail actAs readAs cmds
behaves likesubmitMulti actAs readAs cmds
but fails whensubmitMulti
succeeds and the other way around.Note: This behaviour can be achieved using
submitMustFail (actAs actors <> readAs readers) cmds
and is only provided for backwards compatibility.
- submitTreeMulti
: (HasCallStack, ScriptSubmit script) => [Party] -> [Party] -> Commands a -> script TransactionTree
Warning
DEPRECATED:
Legacy API, usesubmitTree
,actAs
andreadAs
separatelyEquivalent to
submitMulti
but returns the full transaction tree.Note: This behaviour can be achieved using
submitTree (actAs actors <> readAs readers) cmds
and is only provided for backwards compatibility.
- trySubmitMulti
: (HasCallStack, ScriptSubmit script) => [Party] -> [Party] -> Commands a -> script (Either SubmitError a)
Warning
DEPRECATED:
Legacy API, usetrySubmit
,actAs
andreadAs
separatelyAlternate version of
trySubmit
that allows specifying the actAs and readAs parties.Note: This behaviour can be achieved using
trySubmit (actAs actors <> readAs readers) cmds
and is only provided for backwards compatibility.
- trySubmitConcurrently
: HasCallStack => Party -> [Commands a] -> Script [Either SubmitError a]
Warning
DEPRECATED:
Legacy API, useconcurrent
andtrySubmit
separately
- submitWithDisclosures
: HasCallStack => Party -> [Disclosure] -> Commands a -> Script a
Warning
DEPRECATED:
Legacy API, usetrySubmit
anddisclosures
separately
- submitWithDisclosuresMustFail
: HasCallStack => Party -> [Disclosure] -> Commands a -> Script ()
Warning
DEPRECATED:
Legacy API, usesubmitMustFail
anddisclosures
separately
- fromTree
: Template t => TransactionTree -> TreeIndex t -> ContractId t
Finds the contract id of an event within a tree given a tree index Tree indices are created using the
created(N)
andexercised(N)
builders which allow building "paths" within a transaction to a create node For example,exercisedN @MyTemplate1 "MyChoice" 2 $ createdN @MyTemplate2 1
would find theContractId MyTemplate2
of the second (0 index) create event under the 3rd exercise event ofMyChoice
fromMyTemplate1
- created
: HasTemplateTypeRep t => TreeIndex t
Index for the first create event of a given template e.g.
created @MyTemplate
- createdN
: HasTemplateTypeRep t => Int -> TreeIndex t
Index for the Nth create event of a given template e.g.
createdN 2 @MyTemplate
created = createdN 0
- exercised
: HasTemplateTypeRep t => Text -> TreeIndex t’ -> TreeIndex t’
Index for the first exercise of a given choice on a given template e.g.
exercised @MyTemplate "MyChoice"
- exercisedN
: HasTemplateTypeRep t => Text -> Int -> TreeIndex t’ -> TreeIndex t’
Index for the Nth exercise of a given choice on a given template e.g.
exercisedN @MyTemplate "MyChoice" 2
exercised c = exercisedN c 0
- fromAnyContractId
: Template t => AnyContractId -> Optional (ContractId t)
- query
: (Template t, HasEnsure t, IsParties p) => p -> Script [(ContractId t, t)]
Query the set of active contracts of the template that are visible to the given party.
- queryFilter
: (Template c, HasEnsure c, IsParties p) => p -> (c -> Bool) -> Script [(ContractId c, c)]
Query the set of active contracts of the template that are visible to the given party and match the given predicate.
- queryContractId
: (Template t, HasEnsure t, IsParties p, HasCallStack) => p -> ContractId t -> Script (Optional t)
Query for the contract with the given contract id.
Returns
None
if there is no active contract the party is a stakeholder on.WARNING: Over the gRPC backend this performs a linear search over all contracts of the same type, so only use this if the number of active contracts is small.
This is semantically equivalent to calling
query
and filtering on the client side.
- queryDisclosure
: (Template t, IsParties p, HasCallStack) => p -> ContractId t -> Script (Optional Disclosure)
Queries a Disclosure for a given ContractId. Same performance caveats apply as to
queryContractId
.
- queryInterface
: (Template i, HasInterfaceView i v, IsParties p) => p -> Script [(ContractId i, Optional v)]
Query the set of active contract views for an interface that are visible to the given party. If the view function fails for a given contract id, The
Optional v
will beNone
.
- queryInterfaceContractId
: (Template i, HasInterfaceView i v, IsParties p, HasCallStack) => p -> ContractId i -> Script (Optional v)
Query for the contract view with the given contract id.
Returns
None
if there is no active contract the party is a stakeholder on.Returns
None
if the view function fails for the given contract id.WARNING: Over the gRPC backend this performs a linear search over all contracts of the same type, so only use this if the number of active contracts is small.
This is semantically equivalent to calling
queryInterface
and filtering on the client side.
- queryContractKey
: (HasCallStack, TemplateKey t k, IsParties p) => p -> k -> Script (Optional (ContractId t, t))
Returns
None
if there is no active contract with the given key that the party is a stakeholder on.WARNING: Over the gRPC backend this performs a linear search over all contracts of the same type, so only use this if the number of active contracts is small.
This is semantically equivalent to calling
query
and filtering on the client side.
- allocateParty
: HasCallStack => Text -> Script Party
Allocate a party with the given display name using the party management service.
- allocatePartyWithHint
: HasCallStack => Text -> PartyIdHint -> Script Party
Warning
DEPRECATED:
Daml 3.3 compatibility helper, use ‘allocatePartyByHint’ instead of ‘allocatePartyWithHint’
- allocatePartyByHint
: HasCallStack => PartyIdHint -> Script Party
Allocate a party with the given id hint using the party management service.
- allocatePartyOn
: Text -> ParticipantName -> Script Party
Allocate a party with the given display name on the specified participant using the party management service.
- allocatePartyWithHintOn
: Text -> PartyIdHint -> ParticipantName -> Script Party
Warning
DEPRECATED:
Daml 3.3 compatibility helper, use ‘allocatePartyByHintOn’ instead of ‘allocatePartyWithHintOn’
- allocatePartyByHintOn
: PartyIdHint -> ParticipantName -> Script Party
Allocate a party with the given id hint on the specified participant using the party management service.
- listKnownParties
: HasCallStack => Script [PartyDetails]
List the parties known to the default participant.
- listKnownPartiesOn
: HasCallStack => ParticipantName -> Script [PartyDetails]
List the parties known to the given participant.
- tryToEither
: (() -> Script t) -> Script (Either AnyException t)
Named version of the
try catch
behaviour of Daml-Script. Note that this is no more powerful thantry catch
in daml-script, and will not catch exceptions in submissions. (UsetrySubmit
for this) Input computation is deferred to catch pure exceptions
- tryFailureStatus
: Script a -> Script (Either FailureStatus a)
Runs a script for a result. If it fails either by Daml Exceptions or
failWithStatus
, returns theFailureStatus
that a Canton Ledger would return.
- secp256k1sign
: HasCallStack => PrivateKeyHex -> BytesHex -> Script BytesHex
Using a DER formatted private key (encoded as a hex string) use Secp256k1 to sign a hex encoded string message.
Note that this implementation uses a random source with a fixed PRNG and seed, ensuring it behaves deterministically during testing.
For example, CCTP attestation services may be mocked in daml-script code.
- secp256k1generatekeypair
: HasCallStack => Script Secp256k1KeyPair
Generate DER formatted Secp256k1 public/private key pairs.
- createCmd
: (Template t, HasEnsure 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.
- createAndExerciseWithCidCmd
: (Template t, Choice t c r, HasEnsure t) => t -> c -> Commands (ContractId t, r)
Create a contract and exercise a choice on it in the same transaction, returns the created ContractId, and the choice result.
- createAndExerciseCmd
: (Template t, Choice t c r, HasEnsure t) => t -> c -> Commands r
Create a contract and exercise a choice on it in the same transaction, returns only the choice result.
- createExactCmd
: (Template t, HasEnsure t) => t -> Commands (ContractId t)
Create a contract of the given template, using the exact package ID of the template given - upgrades are disabled.
- exerciseExactCmd
: Choice t c r => ContractId t -> c -> Commands r
Exercise a choice on the given contract, using the exact package ID of the template given - upgrades are disabled.
- exerciseByKeyExactCmd
: (TemplateKey t k, Choice t c r) => k -> c -> Commands r
Exercise a choice on the contract with the given key, using the exact package ID of the template given - upgrades are disabled.
- createAndExerciseWithCidExactCmd
: (Template t, Choice t c r, HasEnsure t) => t -> c -> Commands (ContractId t, r)
Create a contract and exercise a choice on it in the same transaction, returns the created ContractId, and the choice result. Uses the exact package ID of the template given - upgrades are disabled.
- createAndExerciseExactCmd
: (Template t, Choice t c r, HasEnsure t) => t -> c -> Commands r
Create a contract and exercise a choice on it in the same transaction, returns only the choice result.
- archiveCmd
: Choice t Archive () => ContractId t -> Commands ()
Archive the given contract.
archiveCmd cid
is equivalent toexerciseCmd cid Archive
.