Module Daml.Trigger.Internal

Data Types

data ACS

Active contract set, you can use getContracts to access the templates of a given type.

ACS

Field Type Description
activeContracts [(AnyContractId, AnyTemplate)]  
pendingContracts Map CommandId [AnyContractId]  

instance HasField “acs” (TriggerState s) ACS

instance HasField “activeContracts” ACS [(AnyContractId, AnyTemplate)]

instance HasField “pendingContracts” ACS (Map CommandId [AnyContractId])

instance HasField “runTriggerA” (TriggerA s a) (ACS -> TriggerRule (TriggerAState s) a)

instance HasField “runTriggerInitializeA” (TriggerInitializeA a) (ACS -> a)

instance HasField “runTriggerUpdateA” (TriggerUpdateA s a) ((Map CommandId [Command], ACS) -> State s a)

data TriggerA s a

TriggerA is the type used in the rule of a DAML trigger. Its main feature is that you can call emitCommands to send commands to the ledger.

TriggerA

Field Type Description
runTriggerA ACS -> TriggerRule (TriggerAState s) a  

instance ActionTriggerAny (TriggerA s)

instance ActionTriggerUpdate (TriggerA s)

instance Functor (TriggerA s)

instance ActionState s (TriggerA s)

instance HasTime (TriggerA s)

instance Action (TriggerA s)

instance Applicative (TriggerA s)

instance HasField “rule” (Trigger s) (Party -> TriggerA s ())

instance HasField “runTriggerA” (TriggerA s a) (ACS -> TriggerRule (TriggerAState s) a)

data TriggerAState s

TriggerAState

Field Type Description
commandsInFlight Map CommandId [Command] Zoomed from TriggerState; used for dedupCreateCmd/dedupExerciseCmd helpers and extended by emitCommands.
pendingContracts Map CommandId [AnyContractId] Map from command ids to the contract ids marked pending by that command; zoomed from TriggerState’s acs.
userState s zoomed from TriggerState

instance HasField “commandsInFlight” (TriggerAState s) (Map CommandId [Command])

instance HasField “pendingContracts” (TriggerAState s) (Map CommandId [AnyContractId])

instance HasField “runTriggerA” (TriggerA s a) (ACS -> TriggerRule (TriggerAState s) a)

instance HasField “userState” (TriggerAState s) s

data TriggerInitializeA a

TriggerInitializeA is the type used in the initialize of a DAML trigger. It can query, but not emit commands or update the state.

TriggerInitializeA

Field Type Description
runTriggerInitializeA ACS -> a  

instance ActionTriggerAny TriggerInitializeA

instance Functor TriggerInitializeA

instance Action TriggerInitializeA

instance Applicative TriggerInitializeA

instance HasField “initialize” (Trigger s) (TriggerInitializeA s)

instance HasField “runTriggerInitializeA” (TriggerInitializeA a) (ACS -> a)

data TriggerState s

TriggerState

Field Type Description
acs ACS  
party Party  
userState s  
commandsInFlight Map CommandId [Command]  

instance HasField “acs” (TriggerState s) ACS

instance HasField “commandsInFlight” (TriggerState s) (Map CommandId [Command])

instance HasField “party” (TriggerState s) Party

instance HasField “userState” (TriggerState s) s

data TriggerUpdateA s a

TriggerUpdateA is the type used in the updateState of a DAML trigger. It has similar actions in common with TriggerA, but cannot use emitCommands or getTime.

TriggerUpdateA

Field Type Description
runTriggerUpdateA (Map CommandId [Command], ACS) -> State s a  

instance ActionTriggerAny (TriggerUpdateA s)

instance ActionTriggerUpdate (TriggerUpdateA s)

instance Functor (TriggerUpdateA s)

instance ActionState s (TriggerUpdateA s)

instance Action (TriggerUpdateA s)

instance Applicative (TriggerUpdateA s)

instance HasField “runTriggerUpdateA” (TriggerUpdateA s a) ((Map CommandId [Command], ACS) -> State s a)

instance HasField “updateState” (Trigger s) (Message -> TriggerUpdateA s ())