|
| 1 | +# Free Bundler Usage Examples |
| 2 | + |
| 3 | +This guide provides example commands for running user operations (userops) using the Free Bundler client. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- Node.js >= 18.0.0 or Bun >= 1.0.0 |
| 8 | +- A private key for the smart account |
| 9 | +- RPC URL for the target chain (optional, defaults to free bundler endpoints) |
| 10 | + |
| 11 | +## Command Line Arguments |
| 12 | + |
| 13 | +The example script accepts the following command line arguments: |
| 14 | + |
| 15 | +- `--chain-id` (required): Chain ID for the userop |
| 16 | +- `--account-type` (required): Type of smart account implementation |
| 17 | +- `--private-key` (required): Private key that controls the smart account |
| 18 | +- `--rpc-url` (optional): RPC URL for the chain |
| 19 | +- `--paymaster-url` (optional): Paymaster URL to sponsor user ops |
| 20 | +- `--paymaster-context` (optional): JSON string for paymaster context |
| 21 | + |
| 22 | +## Example Commands |
| 23 | + |
| 24 | +### 1. Basic UserOp on Ethereum Mainnet |
| 25 | + |
| 26 | +```bash |
| 27 | +bun run ./examples/index.ts \ |
| 28 | + --chain-id 1 \ |
| 29 | + --account-type simple7702 \ |
| 30 | + --private-key "0x..." |
| 31 | +``` |
| 32 | + |
| 33 | +### 2. UserOp on Optimism with Custom RPC |
| 34 | + |
| 35 | +```bash |
| 36 | +bun run ./examples/index.ts \ |
| 37 | + --chain-id 10 \ |
| 38 | + --account-type simple7702 \ |
| 39 | + --private-key "0x..." \ |
| 40 | + --rpc-url "https://optimism-mainnet.infura.io/v3/YOUR_INFURA_KEY" |
| 41 | +``` |
| 42 | + |
| 43 | +### 3. UserOp on Optimism with Paymaster |
| 44 | + |
| 45 | +```bash |
| 46 | +bun run ./examples/index.ts \ |
| 47 | + --chain-id 10 \ |
| 48 | + --account-type simple7702 \ |
| 49 | + --private-key "0x..." \ |
| 50 | + --paymaster-url "https://api.stackup.sh/v1/paymaster/YOUR_STACKUP_KEY" \ |
| 51 | + --paymaster-context '{"sponsor": true}' |
| 52 | +``` |
| 53 | + |
| 54 | +## Supported Networks |
| 55 | + |
| 56 | +The following networks are supported by the free bundler: |
| 57 | + |
| 58 | +- **Ethereum Mainnet**: Chain ID `1` |
| 59 | +- **Optimism**: Chain ID `10` |
| 60 | +- **Arbitrum One**: Chain ID `42161` |
| 61 | + |
| 62 | +## Account Types |
| 63 | + |
| 64 | +Currently supported smart account implementations: |
| 65 | + |
| 66 | +- **simple7702**: EIP-7702 compatible smart account |
| 67 | + |
| 68 | +## What the Example Does |
| 69 | + |
| 70 | +The example script demonstrates: |
| 71 | + |
| 72 | +1. **Smart Account Creation**: Creates a Simple7702 smart account from a private key |
| 73 | +2. **Authorization Check**: Automatically handles EIP-7702 authorization if needed |
| 74 | +3. **UserOp Execution**: Sends a user operation that transfers 0.0000001 ETH to a test address |
| 75 | +4. **Paymaster Integration**: Optional paymaster support for sponsored transactions |
| 76 | + |
| 77 | +### Getting Help |
| 78 | + |
| 79 | +```bash |
| 80 | +bun run ./examples/index.ts --help |
| 81 | +``` |
| 82 | + |
| 83 | +This will display all available options and their descriptions. |
| 84 | + |
| 85 | +## Development |
| 86 | + |
| 87 | +To run in development mode with auto-reload: |
| 88 | + |
| 89 | +```bash |
| 90 | +bun run dev |
| 91 | +``` |
| 92 | + |
| 93 | +To build the project: |
| 94 | + |
| 95 | +```bash |
| 96 | +bun run build |
| 97 | +``` |
0 commit comments