Skip to main content
This page is a placeholder. All examples on this page are currently AI-generated and are not correct. This documentation will be completed in the future with accurate, tested examples.

Utils

Voltaire provides a collection of generic utilities essential for building robust Ethereum applications. These utilities handle common patterns like retry logic, rate limiting, polling, timeouts, and batch processing.

Why Utils?

Ethereum applications face unique challenges:
  • Transient failures: RPC nodes may be temporarily unavailable or rate-limited
  • Async operations: Transactions and state changes require polling for confirmation
  • Rate limits: Public RPC endpoints enforce strict rate limits
  • Long operations: Block production and transaction confirmation take time
  • Batch optimization: Multiple similar requests can be batched for efficiency
These utilities provide battle-tested solutions to these challenges.

Available Utilities

Retry with Exponential Backoff

Automatically retry failed operations with exponential backoff and jitter.
Learn more →

Rate Limiting

Throttle, debounce, and rate-limit function calls.
Learn more →

Polling

Poll operations until they succeed or timeout, with optional backoff.
Learn more →

Timeout

Add timeouts to promises and async operations.
Learn more →

Batch Processing

Automatically batch similar operations for efficiency.
Learn more →

Installation

Utils are included with Voltaire. No additional dependencies required.

Design Principles

Vanilla TypeScript

All utilities use standard Promise-based APIs. No framework dependencies.

Type Safe

Full TypeScript support with generic types for maximum type safety.

Tree Shakeable

Import only what you need. Each utility is independently importable.

Zero Runtime Overhead

Minimal abstractions. Direct, efficient implementations.

Common Patterns

Resilient RPC Calls

Combine retry and timeout for robust RPC calls:

Rate-Limited Batch Processing

Combine rate limiting and batching:

Poll with Timeout and Retry

Combine polling, timeout, and retry:

Next Steps