Skip to main content
@tevm/voltaire/utils provides timeout and cancellation primitives so stalled RPC sockets or hung promises fail predictably with TimeoutError. Source: timeout.ts.

Exports & Signatures

TimeoutOptions

Usage

Racing a Request Against a Deadline (withTimeout)

Wrapping Reusable Functions (wrapWithTimeout)

Fresh Timeout Per Attempt (executeWithTimeout)

executeWithTimeout(fn, timeoutMs, maxRetries) gives each attempt a fresh deadline, sleeps 100 ms between retries, and retries only when error instanceof TimeoutError. Non-timeout errors re-throw immediately.

Cancellable Delay (sleep) and Manual Promises (createDeferred)