Overview
Bundle provides type-safe construction and manipulation of MEV bundles for strategies like arbitrage, liquidations, and backrunning. Bundles guarantee atomic execution - either all transactions succeed in order, or none are included.- Type Definition
- BundleLike Input
Quick Start
- Create Bundle
- Add Transactions
- Submit to Flashbots
API Reference
Constructors
| Method | Description |
|---|---|
Bundle.from(value) | Create bundle from transactions and options |
Methods
| Method | Description |
|---|---|
addTransaction(bundle, tx) | Add a transaction to the bundle (immutable) |
size(bundle) | Get number of transactions in bundle |
toHash(bundle, { keccak256 }) | Compute bundle hash |
toFlashbotsParams(bundle) | Convert to Flashbots RPC format |
Bundle Options
| Property | Type | Description |
|---|---|---|
transactions | (Uint8Array | string)[] | Signed transactions in execution order |
blockNumber | bigint | Target block for inclusion |
minTimestamp | bigint | Earliest valid block timestamp |
maxTimestamp | bigint | Latest valid block timestamp |
revertingTxHashes | Hash[] | Tx hashes allowed to revert |
Practical Examples
Sandwich Attack Bundle
Arbitrage with Revert Protection
Time-Bounded Bundle
Computing Bundle Hash
Building Bundle Incrementally
Error Handling
Bundle provides typed errors that extend the Voltaire error hierarchy:Error Types
| Error | Extends | When Thrown |
|---|---|---|
InvalidBundleError | ValidationError | Invalid bundle format or transaction data |
MissingCryptoDependencyError | ValidationError | Required crypto function not provided |
Flashbots RPC Format
ThetoFlashbotsParams method converts bundles to the format expected by Flashbots relays:

