A TypeScript library for creating ERC-4337 bundler clients with preconfigured free endpoints.
- π Zero Configuration - Works out of the box with free Etherspot bundlers
- π Multi-Chain Support - Ethereum, Arbitrum, Optimism
- π§ Fully Configurable - Override any default settings
- π¦ TypeScript First - Full type safety with viem integration
- π― Tree Shakeable - Import only what you need
- β‘ Bun Compatible - Optimized for Bun runtime and toolchain
bun add @etherspot/free-bundler viem
# or
npm install @etherspot/free-bundler viem
# or
yarn add @etherspot/free-bundler viem
# or
pnpm add @etherspot/free-bundler viemimport { createFreeBundler } from '@etherspot/free-bundler'
import { mainnet } from 'viem/chains'
// Create bundler client for Ethereum Sepolia
const bundlerClient = createFreeBundler({ chain: mainnet })
// Send a user operation
const hash = await bundlerClient.sendUserOperation({
smartAccount,
userOperation: {
sender: '0x...',
nonce: 0n,
callData: '0x...',
// ... other fields
},
entryPoint: '0x43370900c8de573dB349BEd8DD53b4Ebd3Cce709'
})This package is optimized for Bun and includes specific Bun configurations:
# Install dependencies
bun install
# Run development build
bun run dev
# Run tests with Bun's built-in test runner
bun test
# Run tests with coverage
bun test --coverage
# Build the package
bun run build
# Type checking
bun run typecheck
# Linting
bun run lint
bun run lint:fix| Chain | Chain ID | Network |
|---|---|---|
| Ethereum | 1 | Mainnet |
| Ethereum Sepolia | 11155111 | Testnet |
| Arbitrum Sepolia | 421614 | Testnet |
| Optimism | 10 | Mainnet |
| Optimism Sepolia | 11155420 | Testnet |
Creates a bundler client with preconfigured settings.
options(object, optional):bundlerUrl?(string): Custom bundler URLchain(Chain): Viem chain configurationaccount?(Smart Account): Viem smart account configurationtransport?(object): HTTP transport optionstimeout?(number): Request timeout in ms (default: 30000)retryCount?(number): Number of retries (default: 3)retryDelay?(number): Delay between retries in ms (default: 150)
client?(object): Additional client optionsname?(string): Client name (default: "Free Bundler Client")pollingInterval?(number): Polling interval in ms (default: 4000)
A viem bundler client with all bundler actions available.
import {
getSupportedChainIds,
isChainSupported,
getBundlerConfig,
getChainName
} from '@etherspot/free-bundler'
// Check supported chains
const chainIds = getSupportedChainIds() // [1, 11155111, ...]
const isSupported = isChainSupported(1) // true
// Get chain information
const config = getBundlerConfig(1)
// { chainId: 1, name: 'Ethereum Mainnet', url: '...', isTestnet: false }
const name = getChainName(1) // 'Ethereum Mainnet'const bundlerClient = createFreeBundler({
transport: {
timeout: 15000,
retryCount: 5,
retryDelay: 200
},
chain: mainnet
})const bundlerClient = createFreeBundler({
bundlerUrl: 'https://your-custom-bundler.com',
chain: mainnet
})import { createFreeBundler } from '@etherspot/free-bundler'
import { mainnet } from 'viem/chains'
import { toSmartAccount } from 'viem/account-abstraction'
const account = toSmartAccount({...});
const bundlerClient = createFreeBundler({
chain: mainnet,
account,
client: {
name: 'My Custom Bundler',
pollingInterval: 2000
}
})import { createFreeBundler, isChainSupported } from '@etherspot/free-bundler'
try {
// Check if chain is supported first
if (!isChainSupported(999)) {
throw new Error('Chain not supported')
}
const bundlerClient = createFreeBundler(999)
} catch (error) {
console.error('Failed to create bundler:', error.message)
}This package takes advantage of Bun's capabilities:
- Fast Installation: Uses Bun's lightning-fast package manager
- Built-in Testing: Leverages Bun's native test runner
- TypeScript Support: No additional transpilation needed
- ESM First: Optimized for modern JavaScript modules
- Bun: >=1.0.0 (recommended)
- Node.js: >=18.0.0
- Browser: Modern browsers with ESM support
MIT