Skip to main content

Function: pendingSwapFateFor()

gSwap SDK 2.0.0-rc.4


gSwap SDK 2.0.0-rc.4 / pendingSwapFateFor

Function: pendingSwapFateFor()

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

Defined in: packages/gswap-sdk/dist/index.d.ts:3586

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​

error​

unknown

Returns​

"forget" | "forget_quietly" | "keep"

Example​

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