@metamask/multichain-account-service
Version:
Service to manage multichain accounts
41 lines • 1.53 kB
text/typescript
/** Timeout error. */
export declare class TimeoutError extends Error {
constructor(message: string);
}
/**
* Check if an error is a `TimeoutError`.
*
* @param error - The error to check.
* @returns `true` if the error is a `TimeoutError`, otherwise `false`.
*/
export declare function isTimeoutError(error: unknown): error is TimeoutError;
/**
* Check if an error is a `KeyringControllerLockedError`.
*
* @param error - The error to check.
* @returns `true` if the error is a `KeyringControllerLockedError`, otherwise `false`.
*/
export declare function isKeyringControllerLockedError(error: unknown): boolean;
/**
* Execute a function with exponential backoff on transient failures.
*
* @param fnToExecute - The function to execute.
* @param options - The options for the retry.
* @param options.maxAttempts - The maximum number of attempts.
* @param options.backOffMs - The backoff in milliseconds.
* @throws An error if the transaction count cannot be retrieved.
* @returns The result of the function.
*/
export declare function withRetry<T>(fnToExecute: () => Promise<T>, { maxAttempts, backOffMs, }?: {
maxAttempts?: number;
backOffMs?: number;
}): Promise<T>;
/**
* Execute a promise with a timeout.
*
* @param fn - A callback that returns the promise to execute.
* @param timeoutMs - The timeout in milliseconds.
* @returns The result of the promise.
*/
export declare function withTimeout<T>(fn: () => Promise<T>, timeoutMs?: number): Promise<T>;
//# sourceMappingURL=utils.d.cts.map