Skip to main content

Function: pendingSwapFateFor

pendingSwapFateFor(error): "forget" | "forget_quietly" | "keep"

The fate of a queued swap whose confirmation (confirmAppliedTrade) just failed with error, from the SDK's classification alone: forget for a chain rejection (rejected), forget_quietly for a key that can never be confirmed (invalid_input), keep for every other outcome (unknown, not_queued, not_sent, transient) and for any value the SDK cannot judge. It accepts an SDK error or a plain-object view of one (see FailureView). It replaces the hand-written "forget it or keep it" table an app would otherwise keep.

Parameters​

ParameterType
errorunknown

Returns​

"forget" | "forget_quietly" | "keep"

Example​

try {
await confirmAppliedTrade(client, swap);
} catch (error) {
if ((await store.settle(swap.uniqueKey, error)) === 'forget') tellTheUserItFailed();
}