Skip to main content
Practical, copy-paste examples for common Ethereum operations. Each example includes all necessary imports and is ready to run.
For quick patterns without explanation, see Recipes. For quick reference, see Cheatsheet.

Setup

import { Effect, Layer } from 'effect'
import { getBlockNumber, Provider, HttpTransport } from 'voltaire-effect'

// Compose layers first
const ProviderLayer = Provider.pipe(
  Layer.provide(HttpTransport('https://mainnet.infura.io/v3/YOUR_KEY'))
)

const program = Effect.gen(function* () {
  return yield* getBlockNumber()
}).pipe(Effect.provide(ProviderLayer))