Conditional Logic

Set Conditional Logic.

The conditional logic provides an additional layer of granular control over the combined conditions criteria that should be met for the execution of the Lit Action. The Lit Action execution can be tailored to respond to varying situations, such as when a certain threshold has been exceeded or a specific condition has been satisfied, and the conditions can be checked according to a specified time interval.

The default condition logic is set with type EVERY and no interval (i.e. continuous monitoring).

Keep in mind, if you've configured a WebhookCondition or ContractCondition with a very low interval, there's a possibility that your requests will get rejected due to rate limiting constraints from your provider or the endpoint that you're calling.

newCircuit.setConditionalLogic({
    type: "TARGET",
    targetCondition: "1",
    interval: 120000 // milliseconds, Circuit loop called every two minutes
})

Conditional Logic Parameters:

/* The type of the conditional logic. It can be "THRESHOLD", "TARGET", or "EVERY.*/
type: "THRESHOLD" | "TARGET" | "EVERY".

/* Used when the type is "THRESHOLD". It's the threshold number of conditions that 
    must have passed in order for the Lit Action to run.*/
value?: number;

/* Used when the type is "TARGET". It's the specific Condition Id (In order of Conditions Added to Array starting from id "1") that must be met in order for the Lit Action to run.*/
targetCondition?: string;

/* Optional. It's the frequency of condition checks. If omitted, the condition is checked 
    every 30 minutes (1,800,000 ms). Resolves in milliseconds.*/
interval?: number;

Last updated