Hello community,
I’ve got this scenario where I would like to perform some tests and for that purpose reuse a function
implemented in a trigger.
I’ve got these two templates defined elsewhere similar to I show below:
template T1
with
a: Party
b: Text
c: Int
.. (other fields)
choice Processing_Choice
with
d : ContractId T2
controller a
template T2
with
a: Party
b: Text
c: Int
key (a,b,c) : (Party, Text, Int)
Then there is a trigger that is on the lookout for these templates as well as is processing them, a trigger with a code similar to what is described below:
trigger
t1s <- query T1
calls nontrivial_match_func t1s >>= case
Some (t1Cid, t2Cid) -> exercises t1Cid Processing_Choice
nontrivial_match_func t1s
find and return the first pair of t1 and t2 cid which match using a predicate by issuing queryContractKey repeatedly
I’ve tried several approaches to try to implement a function that could be used in the trigger as well as called in a script to perform the tests I want, but no luck so far.
I would kindly ask for your assistance.
Best Regards, João Santos