• Wrap an existing Provider into one that will always use a specified blockTag for requests.

    This helper is to avoid plumbing the blockTag throughout the whatsabi stack, and because it's more ergonomic to use the same blockTag consistently across a given provider.

    Parameters

    Returns Provider

    • Provider that will use the specified blockTag for all requests.
    import { createPublicClient, http } from 'viem'
    import { mainnet } from 'viem/chains'
    const client = createPublicClient({ chain: mainnet, transport: http() })
    const blockNumber = await client.getBlockNumber() // or "latest", "earliest", etc.
    const blockProvider = whatsabi.providers.WithBlockNumber(client, blockNumber);
    const r = await whatsabi.autoload(address, { provider: blockProvider