@getclave/lifi-sdk
Version:
LI.FI Any-to-Any Cross-Chain-Swap SDK
11 lines • 787 B
TypeScript
/**
* Repeatedly calls a given asynchronous function until it resolves with a value
* @param fn The function that should be repeated
* @param interval The timeout in milliseconds between retries, defaults to 5000
* @param maxRetries Maximum number of retries before throwing an error, defaults to 3
* @param shouldRetry Optional predicate to determine if an error should trigger a retry
* @returns The result of the fn function
* @throws Error if maximum retries is reached, if function keeps returning undefined, or if shouldRetry returns false
*/
export declare const waitForResult: <T>(fn: () => Promise<T | undefined>, interval?: number, maxRetries?: number, shouldRetry?: (count: number, error: unknown) => boolean) => Promise<T>;
//# sourceMappingURL=waitForResult.d.ts.map