Do triggers get full ACS or prefiltered?
App Development3 posts582 views5 likesLast activity May 2020
TA
Tamas_KalczaOP
May 2020How does getContracts work in triggers? Does it operate on the full ACS of the ledger or is the ACS prefiltered by the registeredTemplates?
Given the example below would I get anything in the list cs (assuming there are any C contracts)?
example : Trigger ()
example = Trigger
{ initialize = const ()
, updateState = \_ _ _ -> ()
, rule = exampleRule
, registeredTemplates = RegisteredTemplates [
registeredTemplate @A
, registeredTemplate @B
]
, heartbeat = None
}
exampleRule : Party -> ACS -> Time -> Maps.Map CommandId [Command] -> () -> TriggerA ()
exampleRule party activeContracts _ _ () = do
let cs = getContracts @C activeContracts
pure ()
RO
rohanjr
May 2020Hey @Tamas_Kalcza, it looks like this post answers your question: Does the registeredTemplates field in a DAML Trigger affect the ACS which is threaded through my rule?.
So the ACS seen by your exampleRule would be prefiltered by registeredTemplates and getContracts should return an empty list.
TA
Tamas_Kalcza
May 2020Thanks @rohanjr