@dima_aryze/reforge
Version:
TypeScript/JavaScript SDK for Reforge - Cross-chain token operations
46 lines • 1.33 kB
TypeScript
/**
* Retry handler for HTTP requests with exponential backoff
*/
import type { ILogger, RetryConfig } from '../types';
/**
* Function type that can be retried
*/
type RetryableFunction<T> = (_attempt: number) => Promise<T>;
/**
* Handles retry logic for HTTP requests with intelligent backoff strategies
*/
export declare class RetryHandler {
private readonly logger?;
private readonly config;
constructor(config: RetryConfig, logger?: ILogger | undefined);
/**
* Execute a function with retry logic
*/
execute<T>(fn: RetryableFunction<T>, customConfig?: Partial<RetryConfig>): Promise<T>;
/**
* Determine if an error should trigger a retry
*/
private shouldRetry;
/**
* Determine if an API error should be retried
*/
private shouldRetryApiError;
/**
* Get current retry configuration
*/
getConfig(): Required<RetryConfig>;
/**
* Update retry configuration
*/
updateConfig(newConfig: Partial<RetryConfig>): void;
/**
* Calculate the total maximum time that could be spent retrying
*/
calculateMaxRetryTime(): number;
/**
* Create a child retry handler with modified configuration
*/
child(config: Partial<RetryConfig>): RetryHandler;
}
export {};
//# sourceMappingURL=retry.d.ts.map