Daml.Trigger.LowLevel¶
Typeclasses¶
class HasTime m => ActionTrigger m where
Low-level trigger actions.
- liftTF
- : TriggerF a -> m a
instance ActionTrigger (TriggerRule s)
instance ActionTrigger TriggerSetup
Data Types¶
data ActiveContracts
Field Type Description activeContracts [Created] instance HasField "acs" TriggerSetupArguments ActiveContracts
instance HasField "activeContracts" ActiveContracts [Created]
instance HasField "initialState" (Trigger s) (Party -> [Party] -> ActiveContracts -> TriggerSetup s)
data AnyContractId
This type represents the contract id of an unknown template. You can use
fromAnyContractId
to check which template it corresponds to.instance Eq AnyContractId
instance Ord AnyContractId
instance Show AnyContractId
instance HasField "activeContracts" ACS (Map TemplateTypeRep (Map AnyContractId AnyTemplate))
instance HasField "contractId" AnyContractId (ContractId ())
instance HasField "contractId" Archived AnyContractId
instance HasField "contractId" Command AnyContractId
instance HasField "contractId" Created AnyContractId
instance HasField "pendingContracts" ACS (Map CommandId [AnyContractId])
instance HasField "pendingContracts" (TriggerAState s) (Map CommandId [AnyContractId])
instance HasField "templateId" AnyContractId TemplateTypeRep
data Archived
data BatchTrigger s
Batching trigger is (approximately) a left-fold over
Message
with an accumulator of types
.
Field Type Description initialState TriggerSetupArguments -> TriggerSetup s update [Message] -> TriggerRule s () registeredTemplates RegisteredTemplates heartbeat Optional RelTime instance HasField "heartbeat" (BatchTrigger s) (Optional RelTime)
instance HasField "initialState" (BatchTrigger s) (TriggerSetupArguments -> TriggerSetup s)
instance HasField "registeredTemplates" (BatchTrigger s) RegisteredTemplates
instance HasField "update" (BatchTrigger s) ([Message] -> TriggerRule s ())
data Command
A ledger API command. To construct a command use
createCmd
andexerciseCmd
.
Field Type Description templateArg AnyTemplate
Field Type Description contractId AnyContractId choiceArg AnyChoice
Field Type Description templateArg AnyTemplate choiceArg AnyChoice
Field Type Description tplTypeRep TemplateTypeRep contractKey AnyContractKey choiceArg AnyChoice instance HasField "choiceArg" Command AnyChoice
instance HasField "commands" Commands [Command]
instance HasField "commandsInFlight" (TriggerAState s) (Map CommandId [Command])
instance HasField "commandsInFlight" (TriggerState s) (Map CommandId [Command])
instance HasField "commandsInFlight" TriggerUpdateState (Map CommandId [Command])
instance HasField "contractId" Command AnyContractId
instance HasField "contractKey" Command AnyContractKey
instance HasField "templateArg" Command AnyTemplate
instance HasField "tplTypeRep" Command TemplateTypeRep
data CommandId
instance HasField "commandId" Commands CommandId
instance HasField "commandId" Completion CommandId
instance HasField "commandId" Transaction (Optional CommandId)
instance HasField "commandsInFlight" (TriggerAState s) (Map CommandId [Command])
instance HasField "commandsInFlight" (TriggerState s) (Map CommandId [Command])
instance HasField "commandsInFlight" TriggerUpdateState (Map CommandId [Command])
instance HasField "pendingContracts" ACS (Map CommandId [AnyContractId])
instance HasField "pendingContracts" (TriggerAState s) (Map CommandId [AnyContractId])
data Commands
data Completion
A completion message. Note that you will only get completions for commands emitted from the trigger. Contrary to the ledger API completion stream, this also includes synchronous failures.
Field Type Description commandId CommandId status CompletionStatus instance Show Completion
instance HasField "commandId" Completion CommandId
instance HasField "status" Completion CompletionStatus
data CompletionStatus
Field Type Description transactionId TransactionId instance Show CompletionStatus
instance HasField "message" CompletionStatus Text
instance HasField "status" Completion CompletionStatus
instance HasField "status" CompletionStatus Int
instance HasField "transactionId" CompletionStatus TransactionId
data Created
The data in a
Created
event.
Field Type Description eventId EventId contractId AnyContractId argument Optional AnyTemplate views [InterfaceView] instance HasField "activeContracts" ActiveContracts [Created]
instance HasField "argument" Created (Optional AnyTemplate)
instance HasField "contractId" Created AnyContractId
data Event
An event in a transaction. This definition should be kept consistent with the object
EventVariant
defined in triggers/runner/src/main/scala/com/digitalasset/daml/lf/engine/trigger/Converter.scalainstance HasField "events" Transaction [Event]
data EventId
data Message
Either a transaction or a completion. This definition should be kept consistent with the object
MessageVariant
defined in triggers/runner/src/main/scala/com/digitalasset/daml/lf/engine/trigger/Converter.scalainstance HasField "update" (BatchTrigger s) ([Message] -> TriggerRule s ())
instance HasField "update" (Trigger s) (Message -> TriggerRule s ())
instance HasField "updateState" (Trigger s) (Message -> TriggerUpdateA s ())
data RegisteredTemplates
Listen to events for all templates known by the triggers’ runner.RegisteredTemplates [RegisteredTemplate]
instance HasField "registeredTemplates" (BatchTrigger s) RegisteredTemplates
instance HasField "registeredTemplates" (Trigger s) RegisteredTemplates
instance HasField "registeredTemplates" (Trigger s) RegisteredTemplates
data Transaction
Field Type Description transactionId TransactionId commandId Optional CommandId events [Event] instance HasField "commandId" Transaction (Optional CommandId)
instance HasField "events" Transaction [Event]
instance HasField "transactionId" Transaction TransactionId
data TransactionId
instance Eq TransactionId
instance Show TransactionId
instance HasField "transactionId" CompletionStatus TransactionId
instance HasField "transactionId" Transaction TransactionId
data Trigger s
Field Type Description initialState Party -> [Party] -> ActiveContracts -> TriggerSetup s update Message -> TriggerRule s () registeredTemplates RegisteredTemplates heartbeat Optional RelTime instance HasField "heartbeat" (Trigger s) (Optional RelTime)
instance HasField "initialState" (Trigger s) (Party -> [Party] -> ActiveContracts -> TriggerSetup s)
instance HasField "registeredTemplates" (Trigger s) RegisteredTemplates
instance HasField "update" (Trigger s) (Message -> TriggerRule s ())
data TriggerConfig
Field Type Description maxInFlightCommands Int maximum number of commands that should be allowed to be in-flight at any point in time. Exceeding this value will eventually lead to the trigger run raising an InFlightCommandOverflowException exception. maxActiveContracts Int maximum number of active contracts that we will allow to be stored Exceeding this value will lead to the trigger runner raising an ACSOverflowException exception. instance HasField "config" (TriggerAState s) TriggerConfig
instance HasField "config" (TriggerState s) TriggerConfig
instance HasField "config" TriggerSetupArguments TriggerConfig
instance HasField "maxActiveContracts" TriggerConfig Int
instance HasField "maxInFlightCommands" TriggerConfig Int
data TriggerRule s a
Field Type Description runTriggerRule StateT s (Free TriggerF) a instance ActionTrigger (TriggerRule s)
instance Functor (TriggerRule s)
instance ActionState s (TriggerRule s)
instance HasTime (TriggerRule s)
instance Action (TriggerRule s)
instance Applicative (TriggerRule s)
instance HasField "runTriggerA" (TriggerA s a) (ACS -> TriggerRule (TriggerAState s) a)
instance HasField "runTriggerRule" (TriggerRule s a) (StateT s (Free TriggerF) a)
instance HasField "update" (BatchTrigger s) ([Message] -> TriggerRule s ())
instance HasField "update" (Trigger s) (Message -> TriggerRule s ())
data TriggerSetup a
Field Type Description runTriggerSetup Free TriggerF a instance ActionTrigger TriggerSetup
instance Functor TriggerSetup
instance HasTime TriggerSetup
instance Action TriggerSetup
instance Applicative TriggerSetup
instance HasField "initialState" (BatchTrigger s) (TriggerSetupArguments -> TriggerSetup s)
instance HasField "initialState" (Trigger s) (Party -> [Party] -> ActiveContracts -> TriggerSetup s)
instance HasField "runTriggerSetup" (TriggerSetup a) (Free TriggerF a)
Field Type Description actAs Party readAs [Party] acs ActiveContracts config TriggerConfig instance HasField "acs" TriggerSetupArguments ActiveContracts
instance HasField "actAs" TriggerSetupArguments Party
instance HasField "config" TriggerSetupArguments TriggerConfig
instance HasField "initialState" (BatchTrigger s) (TriggerSetupArguments -> TriggerSetup s)
instance HasField "readAs" TriggerSetupArguments [Party]
Functions¶
- toAnyContractId
: Template t => ContractId t -> AnyContractId
Wrap a
ContractId t
inAnyContractId
.
- fromAnyContractId
: Template t => AnyContractId -> Optional (ContractId t)
Check if a
AnyContractId
corresponds to the given template or returnNone
otherwise.
- fromCreated
: Template t => Created -> Optional (EventId, ContractId t, t)
Check if a
Created
event corresponds to the given template.
- fromArchived
: Template t => Archived -> Optional (EventId, ContractId t)
Check if an
Archived
event corresponds to the given template.
- registeredTemplate
- : Template t => RegisteredTemplate
- createCmd
: (Template t, HasAgreement t) => t -> Command
Create a contract of the given template.
- exerciseCmd
: Choice t c r => ContractId t -> c -> Command
Exercise the given choice.
- createAndExerciseCmd
: (Template t, Choice t c r) => t -> c -> Command
Create a contract of the given template and immediately exercise the given choice on it.
- exerciseByKeyCmd
- : (Choice t c r, TemplateKey t k) => k -> c -> Command
- fromCreate
: Template t => Command -> Optional t
Check if the command corresponds to a create command for the given template.
- fromCreateAndExercise
: (Template t, Choice t c r) => Command -> Optional (t, c)
Check if the command corresponds to a create and exercise command for the given template.
- fromExercise
: Choice t c r => Command -> Optional (ContractId t, c)
Check if the command corresponds to an exercise command for the given template.
- fromExerciseByKey
: (Choice t c r, TemplateKey t k) => Command -> Optional (k, c)
Check if the command corresponds to an exercise by key command for the given template.
- execStateT
- : Functor m => StateT s m a -> s -> m s
- simulateRule
: TriggerRule s a -> Time -> s -> (s, [Commands], a)
Run a rule without running it. May lose information from the rule; meant for testing purposes only.
- submitCommands
- : ActionTrigger m => [Command] -> m CommandId