Skip to main content
TanStack Query pairs directly with @tevm/voltaire/provider and @tevm/voltaire/jsonrpc to provide request deduplication, caching, polling, and mutations in React without a framework-specific Web3 wrapper.

Installation

Shared Provider & Query Keys

Create a single HttpProvider instance and deterministic query keys:

Reading Chain State

Account Balance

Validate the address with Address.from, call Rpc.Eth.GetBalanceRequest, and format wei with Wei.toEther:

Block Number Polling and Immutable Historical Blocks

Set staleTime: Infinity for finalized or numbered blocks and refetchInterval: 12_000 for chain head polling:

Parallel Queries

Cache Invalidation After Writes

Invalidate affected account queries after a transaction confirms:

Caching Guidelines