Skip to main content

PackedUserOperation

PackedUserOperation represents an ERC-4337 v0.7+ user operation with optimized field packing. Gas limits and fees are packed into bytes32 fields, reducing calldata size and lowering costs for bundlers.

Quick Start

Type Definition

Field Packing

accountGasLimits (bytes32)

Packs verification and call gas limits:

gasFees (bytes32)

Packs priority fee and max fee:

API Reference

from

Create PackedUserOperation from parameters.

hash

Compute userOpHash for signing.

unpack

Convert PackedUserOperation (v0.7) to UserOperation (v0.6).

Packing Implementation

Pack Gas Limits

Pack Gas Fees

Benefits Over v0.6

  1. Reduced calldata: Smaller operation size
  2. Lower gas costs: Less data to submit
  3. Bundler efficiency: Lower costs for bundlers
  4. Backward compatible: Can convert to/from v0.6

Usage Patterns

Round-trip Conversion

Direct Creation

References