Skip to content

How to Bundle a User Operation

To bundle a user operation, you need to use your Pimlico API key and make a JSON-RPC request as follows:

viem
import { createClient, http } from "viem"
 
const pimlicoApiKey = "YOUR_PIMLICO_API_KEY_HERE"
const chain = "sepolia" // find the list of supported chains at https://docs.pimlico.io/bundler
const pimlicoEndpoint = `https://api.pimlico.io/v2/${chain}/rpc?apikey=${pimlicoApiKey}`
 
const userOperation = ...
const entryPoint = "0x0000000071727De22E5E9d8BAf0edAc6f37da032"
 
const pimlicoClient = createClient({ transport: http(pimlicoEndpoint) })
const userOperationHash = await pimlicoClient.request({ 
    method: "eth_sendUserOperation", 
    params: [userOperation, entryPoint] 
})