Skip to main content
@tevm/voltaire/utils provides a token-bucket RateLimiter for async RPC quotas plus throttle and debounce for high-frequency event handlers. Source: rateLimit.ts.

RateLimiter

Constructor & Options (RateLimiterOptions)

Methods

Example

When strategy: 'drop' is configured and the bucket is empty, execute() resolves to undefined cast to T. Check for undefined before dereferencing results under 'drop'.

throttle

Executes fn immediately on the first call, then returns the cached lastResult without re-invoking fn until wait milliseconds have elapsed.

debounce

Delays execution until wait milliseconds pass without another call. Exposes .cancel() to clear any pending timer.