The Problem
Every Ethereum library throws. CallgetBalance() and it might return a bigint, or throw a rate limit error, or throw a connection timeout, or throw a revert. TypeScript shows none of this:
The Insight
Use the type system to track errors explicitly. Instead of functions that throw, functions return values that describe what can go wrong. The compiler becomes your first line of defense.TransportError or ProviderResponseError. Handle them or propagate them—the compiler tracks it.
The Solution
voltaire-effect combines Voltaire’s branded primitives with Effect’s typed errors:What You Get
Typed Errors
Errors have a_tag discriminant. Pattern match exhaustively:
Built-in Resilience
Retry, timeout, fallback—no external libraries:Testable by Design
Services are injected, not imported. Swap a live provider layer for a test layer without touching business logic:Schema Validation
Decode at boundaries, trust internally. Schema decodes directly to Voltaire’s branded types:Before/After
Trade-offs
voltaire-effect adds:- ~15KB for Effect runtime
- New mental model (Effect, services, layers, generators)
- More verbose for simple one-off scripts
- Typed errors everywhere
- Zero-cost retries, timeouts, concurrency
- Swappable dependencies without mocking
- Composable operations that short-circuit on failure
- The compiler tracks what can go wrong
See Also
- Effect Primer — 5-minute Effect.ts crash course
- Comparisons — How voltaire-effect compares to viem and ethers
- Error Handling — Deep dive on typed errors
- Why Effect — Effect’s own explanation

