Kit
Functions

getTimeoutPromise

getTimeoutPromise(config): Promise<unknown>

When no other heuristic exists to infer that a transaction has expired, you can use this promise factory with a commitment level. It throws after 30 seconds when the commitment is processed, and 60 seconds otherwise. You would typically race this with another confirmation strategy.

Parameters

ParameterTypeDescription
configConfig

Returns

Promise<unknown>

Example

import { safeRace } from '@solana/promises';
import { getTimeoutPromise } from '@solana/transaction-confirmation';
 
try {
    await safeRace([getCustomTransactionConfirmationPromise(/* ... */), getTimeoutPromise({ commitment })]);
} catch (e) {
    if (e instanceof DOMException && e.name === 'TimeoutError') {
        console.log('Could not confirm transaction after a timeout');
    }
    throw e;
}

On this page