Skip to content
Alchemy Logo

Bundler API - Using SDK

The v5 stack uses viem's createBundlerClient for direct interaction with Alchemy's ERC-4337 bundler. @alchemy/aa-infra's estimateFeesPerGas helper wraps rundler_getUserOperationGasPrice so the bundler picks user-op-aware fees. Below: estimate-and-send a UserOperation, and retrieve a UserOperation by hash.

config.ts
import { sepolia } from "viem/chains";
 
export const chain = sepolia;
export const ALCHEMY_API_KEY = "<YOUR_API_KEY>";
export const PRIVATE_KEY = "<YOUR_PRIVATE_KEY>";

Make sure your environment has the correct ALCHEMY_API_KEY and PRIVATE_KEY. These examples target EntryPoint v0.7 by default via Modular Account V2.

Was this page helpful?