Can we write triggers to react to choice observations?

Is there a way for a Choice Observer to automatically react via a trigger to an exercise of an event that they’re an observer on?

I think the answer is no as one would have to extend the RegisteredTempalte data type. But I think that this would be a pretty powerful feature.

Triggers are state-based, i.e., they only get to see the ACS and updates to the ACS via the flat transaction service. They cannot react to individual events. This is crucial to ensure that triggers can be restarted without storing things like the last consumed offset and worrying about whether “past” (however you define that) events should still be reacted to.

1 Like

Fair enough, though triggers do react to heartbeats.

Aside from the LedgerAPI, there is no other way to react to choice observations?

1 Like

Fair enough, though triggers do react to heartbeats.

Sort of, you can’t really reliably react to a heartbeat and only that. Heartbeats are more a way to ensure that your trigger gets woken up and can check time-dependent conditions even if there are no other ledger events.

Yes, at the moment the Java bindings and the transaction tree service are your best option here.

1 Like