Client
To use the OP Stack functionality of Viem, you must configure your Client accordingly. This is just a matter of extending your existing (or new) Viem Client with OP Stack Actions.
Usage
ts
import { createPublicClient, http } from 'viem'
import { base } from 'viem/chains'
import { opStackPublicActions } from 'viem/chains/opStack'
const client = createPublicClient({
chain: base,
transport: http(),
}).extend(opStackPublicActions)
const l1Gas = await client.estimateL1Gas({/* ... */})
import { createPublicClient, http } from 'viem'
import { base } from 'viem/chains'
import { opStackPublicActions } from 'viem/chains/opStack'
const client = createPublicClient({
chain: base,
transport: http(),
}).extend(opStackPublicActions)
const l1Gas = await client.estimateL1Gas({/* ... */})
Decorators
opStackPublicActions
A suite of Public Actions for the OP Stack.
ts
import { opStackPublicActions } from 'viem/chains/opStack'
import { opStackPublicActions } from 'viem/chains/opStack'