Skip to main content

Function: confirmationStateOf()

gSwap SDK 2.0.0-rc.4


gSwap SDK 2.0.0-rc.4 / confirmationStateOf

Function: confirmationStateOf()

confirmationStateOf(error): ConfirmationState | undefined

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

The ConfirmationState of a failure, or undefined when it is not a failed confirmation. Accepts an SDK error or a plain-object view of one (an app's wrapper with a code), and decides from the code alone, so a screen never matches 'CONFIRMATION_ABORTED' itself.

Parameters​

error​

unknown

Returns​

ConfirmationState | undefined

Example​

switch (confirmationStateOf(error)) {
case 'aborted': return; // the person closed the dialog
case 'timeout': return showStillPending(error.uniqueKey);
case 'failed': return showCouldNotCheck(error.uniqueKey);
case undefined: return showFailure(error);
}