Skip to main content

ConditionalTask

This task will run the attempt on the subtasks in an effort to produce a valid numerical result. If attempt. fails to produce an acceptable result, on_failure subtasks will be run instead.

Input: The current running numerical result output from a task.

Returns: A numerical result, else run on_failure subtasks.

Example: Returns the numerical result from the conditionalTask’s subtasks, else on_failure returns the numerical result from its subtasks.

{
"conditionalTask": {
"attempt": [
{
"tasks": [
{
"jupiterSwapTask": {
"inTokenAddress": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"outTokenAddress": "DUALa4FC2yREwZ59PHeu1un4wis36vHRv5hWVBmzykCJ"
}
}
]
}
],
"onFailure": [
{
"lpExchangeRateTask": {
"orcaPoolAddress": "7yJ4gMRJhEoCR48aPE3EAWRmCoygakik81ZS1sajaTnE"
}
}
]
}
}

See the ConditionalTask typescript definition in @switchboard-xyz/common

Fields

NameTypeDescription
 attempt

A list of subtasks to process in an attempt to produce a valid numerical result.

 onFailure

A list of subtasks that will be run if attempt subtasks are unable to produce an acceptable / result.