interface FloodWaiterOptions {
    maxRetries?: number;
    maxWait?: number;
    minStoredWait?: number;
    onBeforeWait?: (ctx: RpcCallMiddlewareContext, seconds: number) => void;
    store?: boolean;
}

Properties

maxRetries?: number

Maximum number of retries to perform when a FLOOD_WAIT_X error is encountered. After this number of retries, the last error will be thrown

5
maxWait?: number

Maximum number of ms to wait when a FLOOD_WAIT_X error is encountered. If the wait time is greater than this value, the request will throw an error instead

This can be overwritten on a per-request basis by setting floodSleepThreshold in the request parameters

10_000
minStoredWait?: number

If the stored wait time is less than this value, the request will not be delayed

2_000
onBeforeWait?: (ctx: RpcCallMiddlewareContext, seconds: number) => void

Function that will be called before we are about to wait for seconds seconds before retrying the request.

print a warning to the console, except some methods that often result in flood waits
store?: boolean

Whether to store the last flood wait time and delay the consecutive requests accordingly

true