Bundler Client
A Bundler Client is an interface to official ERC-4337 JSON-RPC API methods that include sending user operations, estimation user operation gas limits, getting user operation receipts and more.
To create a Bundler Client, create a basic client and extend it with the Bundler Actions.
Import
import { bundlerActions } from 'permissionless'
Usage
Initialize a Bundler Client with your desired Chain (e.g. mainnet) and Transport (e.g. http) from viem by creating a simple client and extending it with the standard bundler methods.
import { createClient, http } from 'viem'
import { sepolia } from 'viem/chains'
import { bundlerActions, ENTRYPOINT_ADDRESS_V07 } from 'permissionless'
const bundlerClient = createClient({
chain: sepolia,
transport: http("https://api.pimlico.io/v2/sepolia/rpc?apikey=YOUR_API_KEY_HERE")
}).extend(bundlerActions(ENTRYPOINT_ADDRESS_V07))
Then you can consume Bundler Actions:
const supportedEntryPoints = await bundlerClient.supportedEntryPoints()
Alternatively, you can initialize a Bundler Client with the createBundlerClient
method:
import { http } from 'viem'
import { sepolia } from 'viem/chains'
import { createBundlerClient, ENTRYPOINT_ADDRESS_V07 } from 'permissionless'
const bundlerClient = createBundlerClient({
chain: sepolia,
transport: http("https://api.pimlico.io/v2/sepolia/rpc?apikey=YOUR_API_KEY_HERE"),
entryPoint: ENTRYPOINT_ADDRESS_V07
})