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 “initialize” (Trigger s) (ACS -> s)

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

instance HasField “rule” (Trigger s) (Party -> ACS -> Time -> Map CommandId [Command] -> s -> TriggerA ())

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

data TriggerA 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 (State TriggerAState a)

instance Functor TriggerA

instance Action TriggerA

instance Applicative TriggerA

instance HasField “rule” (Trigger s) (Party -> ACS -> Time -> Map CommandId [Command] -> s -> TriggerA ())

data TriggerAState

TriggerAState

Field Type Description
commandsInFlight Map CommandId [Command]  
emittedCommands [Commands] Emitted commands in reverse because I can’t be bothered to implement a dlist.
pendingContracts Map CommandId [AnyContractId] Map from command ids to the contract ids marked pending by that command.
nextCommandId Int Command id used for the next submit

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

instance HasField “emittedCommands” TriggerAState [Commands]

instance HasField “nextCommandId” TriggerAState Int

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

data TriggerState s

TriggerState

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

instance HasField “acs” (TriggerState s) ACS

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

instance HasField “nextCommandId” (TriggerState s) Int

instance HasField “party” (TriggerState s) Party

instance HasField “userState” (TriggerState s) s

Functions

addCommands
: Map CommandId [Command] -> Commands -> Map CommandId [Command]
insertTpl
: AnyContractId -> AnyTemplate -> ACS -> ACS
groupActiveContracts
: a -> a
deleteTpl
: AnyContractId -> ACS -> ACS
lookupTpl
: Template a => AnyContractId -> ACS -> Optional a
applyEvent
: Event -> ACS -> ACS
applyTransaction
: Transaction -> ACS -> ACS
runRule
: (Party -> ACS -> Time -> Map CommandId [Command] -> s -> TriggerA ()) -> Time -> TriggerState s -> (TriggerState s, [Commands])
runTriggerA
: TriggerA a -> TriggerAState -> (a, TriggerAState)