canton-network-docs/Daml ScriptModules
Daml.Script
Daml.Script
The Daml Script testing library.Module Snapshot
Lifecycle
Stable.
Notices
Status:
active
Introduced in: 3.4.9
Removed in: -
Warnings: 0
Deprecations: 0
Deprecated since: -Data Types
data InvalidUserId
Thrown if text for a user identifier does not conform to the format restriction.
Constructors:
InvalidUserId
instance Eq InvalidUserIdinstance Show InvalidUserIdinstance HasFromAnyException InvalidUserIdinstance HasMessage InvalidUserIdinstance HasThrow InvalidUserIdinstance HasToAnyException InvalidUserIdinstance GetField m InvalidUserId Textinstance GetField message InvalidUserId Textinstance SetField m InvalidUserId Text
data User
User-info record for a user in the user management service.
Constructors:
User
instance IsQuestion GetUser (Optional User)instance IsQuestion ListAllUsers [User]instance Eq Userinstance Ord Userinstance Show Userinstance GetField primaryParty User (Optional Party)instance GetField user CreateUser Userinstance GetField userId User UserIdinstance SetField primaryParty User (Optional Party)instance SetField user CreateUser Userinstance SetField userId User UserId
data UserAlreadyExists
Thrown if a user to be created already exists.
Constructors:
UserAlreadyExists
instance Eq UserAlreadyExistsinstance Show UserAlreadyExistsinstance HasFromAnyException UserAlreadyExistsinstance HasMessage UserAlreadyExistsinstance HasThrow UserAlreadyExistsinstance HasToAnyException UserAlreadyExistsinstance GetField message UserAlreadyExists Textinstance GetField userId UserAlreadyExists UserIdinstance SetField userId UserAlreadyExists UserId
data UserId
Identifier for a user in the user management service.
Constructors:
UserId Text
instance Eq UserIdinstance Ord UserIdinstance Show UserIdinstance GetField userId DeleteUser UserIdinstance GetField userId GetUser UserIdinstance GetField userId GrantUserRights UserIdinstance GetField userId ListUserRights UserIdinstance GetField userId RevokeUserRights UserIdinstance GetField userId User UserIdinstance GetField userId UserAlreadyExists UserIdinstance GetField userId UserNotFound UserIdinstance SetField userId DeleteUser UserIdinstance SetField userId GetUser UserIdinstance SetField userId GrantUserRights UserIdinstance SetField userId ListUserRights UserIdinstance SetField userId RevokeUserRights UserIdinstance SetField userId User UserIdinstance SetField userId UserAlreadyExists UserIdinstance SetField userId UserNotFound UserId
data UserNotFound
Thrown if a user cannot be located for a given user identifier.
Constructors:
UserNotFound
instance Eq UserNotFoundinstance Show UserNotFoundinstance HasFromAnyException UserNotFoundinstance HasMessage UserNotFoundinstance HasThrow UserNotFoundinstance HasToAnyException UserNotFoundinstance GetField message UserNotFound Textinstance GetField userId UserNotFound UserIdinstance SetField userId UserNotFound UserId
data UserRight
The rights of a user.
Constructors:
ParticipantAdmin
CanActAs Party
CanReadAs Party
CanReadAsAnyParty
instance IsQuestion GrantUserRights (Optional [UserRight])instance IsQuestion ListUserRights (Optional [UserRight])instance IsQuestion RevokeUserRights (Optional [UserRight])instance Eq UserRightinstance Show UserRightinstance GetField rights CreateUser [UserRight]instance GetField rights GrantUserRights [UserRight]instance GetField rights RevokeUserRights [UserRight]instance SetField rights CreateUser [UserRight]instance SetField rights GrantUserRights [UserRight]instance SetField rights RevokeUserRights [UserRight]
data ConcurrentSubmits a
Applicative that allows for multiple concurrent transaction submissions
See concurrently for usage of this type.
Constructors:
ConcurrentSubmits
instance ScriptSubmit ConcurrentSubmitsinstance Functor ConcurrentSubmitsinstance Applicative ConcurrentSubmitsinstance GetField continue (ConcurrentSubmits a) ([Either SubmitError ([CommandResult], TransactionTree)] -> a)instance GetField submits (ConcurrentSubmits a) [Submission]instance SetField continue (ConcurrentSubmits a) ([Either SubmitError ([CommandResult], TransactionTree)] -> a)instance SetField submits (ConcurrentSubmits a) [Submission]
data PackageId
Package-id newtype for package preference
Constructors:
PackageId Text
instance Eq PackageIdinstance Show PackageIdinstance GetField sPackagePreference Submission (Optional [PackageId])instance GetField soPackagePreference SubmitOptions (Optional [PackageId])instance SetField sPackagePreference Submission (Optional [PackageId])instance SetField soPackagePreference SubmitOptions (Optional [PackageId])
data SubmitOptions
Options to detemine the stakeholders of a transaction, as well as disclosures.
Intended to be specified using the actAs, readAs and disclose builders, combined using the Semigroup concat (<>) operator.
signatory, see their docs for examples.
All submissions must specify at least one actAs party, else a runtime error will be thrown.
A minimum submission may look like
SubmitOptions to
submit, which will represent the actAs field.
The above example could be reduced to
SubmitOptions
instance IsSubmitOptions SubmitOptionsinstance Monoid SubmitOptionsinstance Semigroup SubmitOptionsinstance GetField soActAs SubmitOptions [Party]instance GetField soDisclosures SubmitOptions [Disclosure]instance GetField soPackagePreference SubmitOptions (Optional [PackageId])instance GetField soPrefetchKeys SubmitOptions [AnyContractKey]instance GetField soReadAs SubmitOptions [Party]instance SetField soActAs SubmitOptions [Party]instance SetField soDisclosures SubmitOptions [Disclosure]instance SetField soPackagePreference SubmitOptions (Optional [PackageId])instance SetField soPrefetchKeys SubmitOptions [AnyContractKey]instance SetField soReadAs SubmitOptions [Party]
data CryptoErrorType
Daml Crypto (Secp256k1) related submission errors
Constructors:
MalformedByteEncoding
MalformedKey
MalformedSignature
instance Show CryptoErrorTypeinstance GetField cryptoErrorType SubmitError CryptoErrorTypeinstance GetField keyValue CryptoErrorType Textinstance GetField signatureValue CryptoErrorType Textinstance GetField value CryptoErrorType Textinstance SetField cryptoErrorType SubmitError CryptoErrorTypeinstance SetField keyValue CryptoErrorType Textinstance SetField signatureValue CryptoErrorType Textinstance SetField value CryptoErrorType Text
data SubmitError
Errors that can be thrown by a command submission via trySubmit
Constructors:
ContractNotFound
Provided as text, as we do not know the template ID of a contract if the lookup fails
should always be None in Canton’s case, see https://github.com/digital-asset/daml/issues/17154
ContractKeyNotFound
UnresolvedPackageName
AuthorizationError
ContractHashingError
DisclosedContractKeyHashingError
DuplicateContractKey
Canton will often not provide this key, IDELedger will
InconsistentContractKey
UnhandledException
Errors more complex than simple records cannot currently be encoded over the grpc status. Such errors will be missing here.
UserError
TemplatePreconditionViolated
ensure, strictly pre-exception.
According to docs, not throwable with LF >= 1.14.
On LF >= 1.14, a failed ensure will result in a PreconditionFailed
exception wrapped in UnhandledException.
CreateEmptyContractKeyMaintainers
FetchEmptyContractKeyMaintainers
WronglyTypedContract
Any contract Id of the actual contract
ContractDoesNotImplementInterface
ContractDoesNotImplementRequiringInterface
NonComparableValues
ContractIdInContractKey
ContractIdComparability
We do not know the template ID at time of comparison.
ValueNesting
Nesting limit that was exceeded
LocalVerdictLockedContracts
Locked contract ids
LocalVerdictLockedKeys
Locked contract keys
UpgradeError
FailureStatusError
failWithStatus
CryptoError
EffectfulRollbackError
DevError
UnknownError
TruncatedError
One of the constructor names of SubmitFailure except DevError, UnknownError, TruncatedError
instance IsQuestion Submit [Either SubmitError ([CommandResult], TransactionTree)]instance Show SubmitErrorinstance GetField actualTemplateId SubmitError TemplateTypeRepinstance GetField additionalDebuggingInfo SubmitError (Optional ContractNotFoundAdditionalInfo)instance GetField authorizationErrorMessage SubmitError Textinstance GetField continue (ConcurrentSubmits a) ([Either SubmitError ([CommandResult], TransactionTree)] -> a)instance GetField contractId SubmitError AnyContractIdinstance GetField contractKey SubmitError AnyContractKeyinstance GetField createArg SubmitError AnyTemplateinstance GetField cryptoErrorMessage SubmitError Textinstance GetField cryptoErrorType SubmitError CryptoErrorTypeinstance GetField devErrorMessage SubmitError Textinstance GetField devErrorType SubmitError DevErrorTypeinstance GetField dstTemplateId SubmitError TemplateTypeRepinstance GetField duplicateContractKey SubmitError (Optional AnyContractKey)instance GetField effectfulRollbackErrorMsg SubmitError Textinstance GetField errorMessage SubmitError Textinstance GetField errorType SubmitError UpgradeErrorTypeinstance GetField exc SubmitError (Optional AnyException)instance GetField expectedKey SubmitError AnyContractKeyinstance GetField expectedTemplateId SubmitError TemplateTypeRepinstance GetField failedTemplateKey SubmitError AnyContractKeyinstance GetField failureStatus SubmitError FailureStatusinstance GetField givenKeyHash SubmitError Textinstance GetField globalExistingContractId SubmitError Textinstance GetField interfaceId SubmitError TemplateTypeRepinstance GetField invalidTemplate SubmitError AnyTemplateinstance GetField limit SubmitError Intinstance GetField localVerdictLockedContracts SubmitError [AnyContractId]instance GetField localVerdictLockedKeys SubmitError [AnyContractKey]instance GetField packageName SubmitError Textinstance GetField requiredInterfaceId SubmitError TemplateTypeRepinstance GetField requiringInterfaceId SubmitError TemplateTypeRepinstance GetField templateId SubmitError TemplateTypeRepinstance GetField truncatedErrorMessage SubmitError Textinstance GetField truncatedErrorType SubmitError Textinstance GetField unknownContractIds SubmitError (NonEmpty Text)instance GetField unknownErrorMessage SubmitError Textinstance GetField userErrorMessage SubmitError Textinstance SetField actualTemplateId SubmitError TemplateTypeRepinstance SetField additionalDebuggingInfo SubmitError (Optional ContractNotFoundAdditionalInfo)instance SetField authorizationErrorMessage SubmitError Textinstance SetField continue (ConcurrentSubmits a) ([Either SubmitError ([CommandResult], TransactionTree)] -> a)instance SetField contractId SubmitError AnyContractIdinstance SetField contractKey SubmitError AnyContractKeyinstance SetField createArg SubmitError AnyTemplateinstance SetField cryptoErrorMessage SubmitError Textinstance SetField cryptoErrorType SubmitError CryptoErrorTypeinstance SetField devErrorMessage SubmitError Textinstance SetField devErrorType SubmitError DevErrorTypeinstance SetField dstTemplateId SubmitError TemplateTypeRepinstance SetField duplicateContractKey SubmitError (Optional AnyContractKey)instance SetField effectfulRollbackErrorMsg SubmitError Textinstance SetField errorMessage SubmitError Textinstance SetField errorType SubmitError UpgradeErrorTypeinstance SetField exc SubmitError (Optional AnyException)instance SetField expectedKey SubmitError AnyContractKeyinstance SetField expectedTemplateId SubmitError TemplateTypeRepinstance SetField failedTemplateKey SubmitError AnyContractKeyinstance SetField failureStatus SubmitError FailureStatusinstance SetField givenKeyHash SubmitError Textinstance SetField globalExistingContractId SubmitError Textinstance SetField interfaceId SubmitError TemplateTypeRepinstance SetField invalidTemplate SubmitError AnyTemplateinstance SetField limit SubmitError Intinstance SetField localVerdictLockedContracts SubmitError [AnyContractId]instance SetField localVerdictLockedKeys SubmitError [AnyContractKey]instance SetField packageName SubmitError Textinstance SetField requiredInterfaceId SubmitError TemplateTypeRepinstance SetField requiringInterfaceId SubmitError TemplateTypeRepinstance SetField templateId SubmitError TemplateTypeRepinstance SetField truncatedErrorMessage SubmitError Textinstance SetField truncatedErrorType SubmitError Textinstance SetField unknownContractIds SubmitError (NonEmpty Text)instance SetField unknownErrorMessage SubmitError Textinstance SetField userErrorMessage SubmitError Text
data UpgradeErrorType
SCU related submission errors
Constructors:
ValidationFailed
TranslationFailed
AuthenticationFailed
instance Show UpgradeErrorTypeinstance GetField coid UpgradeErrorType AnyContractIdinstance GetField createArg UpgradeErrorType AnyTemplateinstance GetField dstPackageName UpgradeErrorType Textinstance GetField dstTemplateId UpgradeErrorType TemplateTypeRepinstance GetField errorType SubmitError UpgradeErrorTypeinstance GetField mCoid UpgradeErrorType (Optional AnyContractId)instance GetField originalKeyOpt UpgradeErrorType (Optional (AnyContractKey, [Party]))instance GetField originalObservers UpgradeErrorType [Party]instance GetField originalSignatories UpgradeErrorType [Party]instance GetField recomputedKeyOpt UpgradeErrorType (Optional (AnyContractKey, [Party]))instance GetField recomputedObservers UpgradeErrorType [Party]instance GetField recomputedSignatories UpgradeErrorType [Party]instance GetField srcPackageName UpgradeErrorType Textinstance GetField srcTemplateId UpgradeErrorType TemplateTypeRepinstance SetField coid UpgradeErrorType AnyContractIdinstance SetField createArg UpgradeErrorType AnyTemplateinstance SetField dstPackageName UpgradeErrorType Textinstance SetField dstTemplateId UpgradeErrorType TemplateTypeRepinstance SetField errorType SubmitError UpgradeErrorTypeinstance SetField mCoid UpgradeErrorType (Optional AnyContractId)instance SetField originalKeyOpt UpgradeErrorType (Optional (AnyContractKey, [Party]))instance SetField originalObservers UpgradeErrorType [Party]instance SetField originalSignatories UpgradeErrorType [Party]instance SetField recomputedKeyOpt UpgradeErrorType (Optional (AnyContractKey, [Party]))instance SetField recomputedObservers UpgradeErrorType [Party]instance SetField recomputedSignatories UpgradeErrorType [Party]instance SetField srcPackageName UpgradeErrorType Textinstance SetField srcTemplateId UpgradeErrorType TemplateTypeRep
data Created
Constructors:
Created
instance Show Createdinstance GetField argument Created AnyTemplateinstance GetField contractId Created AnyContractIdinstance SetField argument Created AnyTemplateinstance SetField contractId Created AnyContractId
data CreatedIndexPayload t
Constructors:
CreatedIndexPayload
instance GetField offset (CreatedIndexPayload t) Intinstance GetField templateId (CreatedIndexPayload t) TemplateTypeRepinstance SetField offset (CreatedIndexPayload t) Intinstance SetField templateId (CreatedIndexPayload t) TemplateTypeRep
data Exercised
Constructors:
Exercised
instance Show Exercisedinstance GetField argument Exercised AnyChoiceinstance GetField childEvents Exercised [TreeEvent]instance GetField choice Exercised Textinstance GetField contractId Exercised AnyContractIdinstance SetField argument Exercised AnyChoiceinstance SetField childEvents Exercised [TreeEvent]instance SetField choice Exercised Textinstance SetField contractId Exercised AnyContractId
data ExercisedIndexPayload t
Constructors:
ExercisedIndexPayload
instance GetField child (ExercisedIndexPayload t) (TreeIndex t)instance GetField choice (ExercisedIndexPayload t) Textinstance GetField offset (ExercisedIndexPayload t) Intinstance GetField templateId (ExercisedIndexPayload t) TemplateTypeRepinstance SetField child (ExercisedIndexPayload t) (TreeIndex t)instance SetField choice (ExercisedIndexPayload t) Textinstance SetField offset (ExercisedIndexPayload t) Intinstance SetField templateId (ExercisedIndexPayload t) TemplateTypeRep
data TransactionTree
Constructors:
TransactionTree
instance IsQuestion Submit [Either SubmitError ([CommandResult], TransactionTree)]instance Show TransactionTreeinstance GetField continue (ConcurrentSubmits a) ([Either SubmitError ([CommandResult], TransactionTree)] -> a)instance GetField rootEvents TransactionTree [TreeEvent]instance SetField continue (ConcurrentSubmits a) ([Either SubmitError ([CommandResult], TransactionTree)] -> a)instance SetField rootEvents TransactionTree [TreeEvent]
data TreeEvent
Constructors:
CreatedEvent Created
ExercisedEvent Exercised
instance Show TreeEventinstance GetField childEvents Exercised [TreeEvent]instance GetField rootEvents TransactionTree [TreeEvent]instance SetField childEvents Exercised [TreeEvent]instance SetField rootEvents TransactionTree [TreeEvent]
data TreeIndex t
Constructors:
CreatedIndex (CreatedIndexPayload t)
ExercisedIndex (ExercisedIndexPayload t)
instance GetField child (ExercisedIndexPayload t) (TreeIndex t)instance SetField child (ExercisedIndexPayload t) (TreeIndex t)
data AnyContractId
Constructors:
AnyContractId
instance Eq AnyContractIdinstance Show AnyContractIdinstance GetField additionalInfoCid ContractNotFoundAdditionalInfo AnyContractIdinstance GetField coid UpgradeErrorType AnyContractIdinstance GetField contractId SubmitError AnyContractIdinstance GetField contractId Created AnyContractIdinstance GetField contractId Exercised AnyContractIdinstance GetField contractId AnyContractId (ContractId ())instance GetField localVerdictLockedContracts SubmitError [AnyContractId]instance GetField mCoid UpgradeErrorType (Optional AnyContractId)instance GetField templateId AnyContractId TemplateTypeRepinstance SetField additionalInfoCid ContractNotFoundAdditionalInfo AnyContractIdinstance SetField coid UpgradeErrorType AnyContractIdinstance SetField contractId SubmitError AnyContractIdinstance SetField contractId Created AnyContractIdinstance SetField contractId Exercised AnyContractIdinstance SetField contractId AnyContractId (ContractId ())instance SetField localVerdictLockedContracts SubmitError [AnyContractId]instance SetField mCoid UpgradeErrorType (Optional AnyContractId)instance SetField templateId AnyContractId TemplateTypeRep
data ParticipantName
Participant name for multi-participant script runs to address a specific participant
Constructors:
ParticipantName
instance GetField participantName ParticipantName Textinstance SetField participantName ParticipantName Text
data PartyDetails
The party details returned by the party management service.
Constructors:
PartyDetails
Party id
True if party is hosted by the backing participant.
instance IsQuestion ListKnownParties [PartyDetails]instance Eq PartyDetailsinstance Ord PartyDetailsinstance Show PartyDetailsinstance GetField isLocal PartyDetails Boolinstance GetField party PartyDetails Partyinstance SetField isLocal PartyDetails Boolinstance SetField party PartyDetails Party
data PartyIdHint
A hint to the backing participant what party id to allocate.
Must be a valid PartyIdString (as described in @value.proto@).
Constructors:
PartyIdHint
instance GetField partyIdHint PartyIdHint Textinstance SetField partyIdHint PartyIdHint Text
type PrivateKeyHex = BytesHex
A DER formatted private key to be used for ECDSA message signing
Instances:
instance GetField privateKey Secp256k1KeyPair PrivateKeyHexinstance SetField privateKey Secp256k1KeyPair PrivateKeyHex
data Secp256k1KeyPair
Secp256k1 key pair generated by secp256k1generatekeypair for testing.
Constructors:
Secp256k1KeyPair
instance IsQuestion Secp256k1GenerateKeyPair Secp256k1KeyPairinstance GetField privateKey Secp256k1KeyPair PrivateKeyHexinstance GetField publicKey Secp256k1KeyPair PublicKeyHexinstance SetField privateKey Secp256k1KeyPair PrivateKeyHexinstance SetField publicKey Secp256k1KeyPair PublicKeyHex
data AnyContractKey
Existential contract key type that can wrap an arbitrary contract key.
Instances:
instance Eq AnyContractKeyinstance Ord AnyContractKeyinstance GetField contractKey QueryNByKey AnyContractKeyinstance GetField contractKey SubmitError AnyContractKeyinstance GetField duplicateContractKey SubmitError (Optional AnyContractKey)instance GetField expectedKey SubmitError AnyContractKeyinstance GetField failedTemplateKey SubmitError AnyContractKeyinstance GetField getAnyContractKey AnyContractKey LedgerValueinstance GetField getAnyContractKeyTemplateTypeRep AnyContractKey TemplateTypeRepinstance GetField key QueryByKey AnyContractKeyinstance GetField keyE Command AnyContractKeyinstance GetField localVerdictLockedKeys SubmitError [AnyContractKey]instance GetField originalKeyOpt UpgradeErrorType (Optional (AnyContractKey, [Party]))instance GetField recomputedKeyOpt UpgradeErrorType (Optional (AnyContractKey, [Party]))instance GetField sPrefetchKeys Submission [AnyContractKey]instance GetField soPrefetchKeys SubmitOptions [AnyContractKey]instance SetField contractKey QueryNByKey AnyContractKeyinstance SetField contractKey SubmitError AnyContractKeyinstance SetField duplicateContractKey SubmitError (Optional AnyContractKey)instance SetField expectedKey SubmitError AnyContractKeyinstance SetField failedTemplateKey SubmitError AnyContractKeyinstance SetField getAnyContractKey AnyContractKey LedgerValueinstance SetField getAnyContractKeyTemplateTypeRep AnyContractKey TemplateTypeRepinstance SetField key QueryByKey AnyContractKeyinstance SetField keyE Command AnyContractKeyinstance SetField localVerdictLockedKeys SubmitError [AnyContractKey]instance SetField originalKeyOpt UpgradeErrorType (Optional (AnyContractKey, [Party]))instance SetField recomputedKeyOpt UpgradeErrorType (Optional (AnyContractKey, [Party]))instance SetField sPrefetchKeys Submission [AnyContractKey]instance SetField soPrefetchKeys SubmitOptions [AnyContractKey]
data Commands a
This is used to build up the commands sent 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 and the last statement in a do block
must be of the form return expr or pure expr.
Constructors:
Commands
instance Functor Commandsinstance Applicative Commandsinstance GetField commands (Commands a) [CommandWithMeta]instance GetField continue (Commands a) ([CommandResult] -> a)instance SetField commands (Commands a) [CommandWithMeta]instance SetField continue (Commands a) ([CommandResult] -> a)
data Disclosure
Contract disclosures which can be acquired via queryDisclosure
Constructors:
Disclosure
instance Eq Disclosureinstance Ord Disclosureinstance GetField blob Disclosure Textinstance GetField contractId Disclosure (ContractId ())instance GetField sDisclosures Submission [Disclosure]instance GetField soDisclosures SubmitOptions [Disclosure]instance GetField templateId Disclosure TemplateTypeRepinstance SetField blob Disclosure Textinstance SetField contractId Disclosure (ContractId ())instance SetField sDisclosures Submission [Disclosure]instance SetField soDisclosures SubmitOptions [Disclosure]instance SetField templateId Disclosure TemplateTypeRep
data Script a
This is the type of A Daml script. Script is an instance of Action,
so you can use do notation.
Constructors:
Script
HIDEWe use an inlined StateT () to separate evaluation ofsomething of type Script from execution and to ensureproper sequencing of evaluation. This is mainly so that
debug does somethingslightly more sensible.HIDEDummy field to make sure damlc does not consider this an old-styletypeclass.
instance ScriptSubmit Scriptinstance Functor Scriptinstance CanAssert Scriptinstance ActionCatch Scriptinstance ActionThrow Scriptinstance ActionFailWithStatus Scriptinstance CanAbort Scriptinstance HasTime Scriptinstance Action Scriptinstance ActionFail Scriptinstance Applicative Scriptinstance GetField dummy (Script a) ()instance GetField runScript (Script a) (() -> Free ScriptF (a, ()))instance SetField dummy (Script a) ()instance SetField runScript (Script a) (() -> Free ScriptF (a, ()))
Typeclasses
class IsSubmitOptions options
Defines a type that can be transformed into a SubmitOptions
Methods:
toSubmitOptions : options -> SubmitOptions
instance IsSubmitOptions SubmitOptionsinstance IsSubmitOptions Partyinstance IsSubmitOptions (NonEmpty Party)instance IsSubmitOptions (Set Party)instance IsSubmitOptions [Party]
class Applicative script => ScriptSubmit script
Defines an applicative that can run transaction submissions. Usually this is simply Script.
Methods:
liftSubmission : HasCallStack => ConcurrentSubmits a -> script a
instance ScriptSubmit Scriptinstance ScriptSubmit ConcurrentSubmits
Functions
userIdToText
validateUserId
createUser
createUserOn
getUser
getUserOn
listAllUsers
listAllUsersOn
grantUserRights
grantUserRightsOn
revokeUserRights
revokeUserRightsOn
deleteUser
deleteUserOn
listUserRights
listUserRightsOn
submitUser
submitUserOn
setTime
dpm 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
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
dpm 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, allowing for specifying parties as any of the following:
readAs
IsParties, allowing for specifying parties as any of the following:
discloseMany
disclose
packagePreference
prefetchKeys
concurrently
ConcurrentSubmits, which supports all the existing submit functions
that Script supports. It however does not implement Action, and thus does not support true binding and computation interdependence
NOTE: The submission order of transactions within concurrently 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:
submitResultAndTree
submit but returns the result and the full transaction tree.
trySubmitResultAndTree
trySubmit but returns the result and the full transaction tree.
submitWithError
submitMustFail but returns the error thrown.
submit
submit p cmds submits the commands cmds as a single transaction
from party p and returns the value returned by cmds.
The options field can either be any “Parties” like type (See IsParties) or SubmitOptions
which allows for finer control over parameters of the submission.
If the transaction fails, submit also fails.
submitWithOptions
submitTree
submit but returns the full transaction tree.
trySubmit
SubmitError.
In the majority of failures, this will not crash at runtime.
trySubmitTree
trySubmit but returns the full transaction tree.
submitMustFail
submitMustFail p cmds submits the commands cmds as a single transaction
from party p.
See submitWithOptions for details on the options field
It only succeeds if the submitting the transaction fails.
submitMustFailWithOptions
submitMulti
submitMulti actAs readAs cmds submits cmds as a single transaction
authorized by actAs. 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
submitMultiMustFail actAs readAs cmds behaves like submitMulti actAs readAs cmds
but fails when submitMulti 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
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
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
submitWithDisclosures
submitWithDisclosuresMustFail
fromTree
created(N) and exercised(N) builders
which allow building “paths” within a transaction to a create node
For example, exercisedN @MyTemplate1 "MyChoice" 2 $ createdN @MyTemplate2 1
would find the ContractId MyTemplate2 of the second (0 index) create event under
the 3rd exercise event of MyChoice from MyTemplate1
created
created @MyTemplate
createdN
createdN 2 @MyTemplate
created = createdN 0
exercised
exercised @MyTemplate "MyChoice"
exercisedN
exercisedN @MyTemplate "MyChoice" 2
exercised c = exercisedN c 0
fromAnyContractId
query
queryFilter
queryContractId
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
queryContractId.
queryInterface
Optional v will be None.
queryInterfaceContractId
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.
queryByKey
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.
queryNByKey
query
and filtering on the client side.
queryAllByKey
query
and filtering on the client side.
allocateParty
allocatePartyWithHint
allocatePartyByHint
allocatePartyOn
allocatePartyWithHintOn
allocatePartyByHintOn
listKnownParties
listKnownPartiesOn
tryToEither
try catch behaviour of Daml-Script.
Note that this is no more powerful than try catch in daml-script, and will not catch exceptions in submissions.
(Use trySubmit for this)
Input computation is deferred to catch pure exceptions
tryFailureStatus
failWithStatus, returns the
FailureStatus that a Canton Ledger would return.
secp256k1signWithEcdsaOnly
secp256k1sign
secp256k1generatekeypair
toAnyContractKey
AnyContractKey.
You must pass the template type t using an explicit type application.
For example toAnyContractKey @Proposal k.
fromAnyContractKey
AnyContractKey if the template and
choice types match, or return None.
You must pass the template type t using an explicit type application.
For example fromAnyContractKey @Proposal k.
createCmd
exerciseCmd
exerciseByKeyCmd
createAndExerciseWithCidCmd
createAndExerciseCmd
createExactCmd
exerciseExactCmd
exerciseByKeyExactCmd
createAndExerciseWithCidExactCmd
createAndExerciseExactCmd
archiveCmd
archiveCmd cid is equivalent to exerciseCmd cid Archive.
script
Script a is a valid script regardless of whether
it is implemented using script or not.