@tevm/voltaire / primitives/PackedUserOperation
primitives/PackedUserOperation
Type Aliases
PackedUserOperationType
PackedUserOperationType =Defined in: src/primitives/PackedUserOperation/PackedUserOperationType.ts:19 PackedUserOperation type - ERC-4337 v0.7+ format Optimized format that packs gas limits and fees into bytes32 fields, reducing calldata size and gas costs for bundlers. Gas packing format:object&object
- accountGasLimits: verificationGasLimit (128 bits) || callGasLimit (128 bits)
- gasFees: maxPriorityFeePerGas (128 bits) || maxFeePerGas (128 bits)
Type Declaration
accountGasLimits
Packed gas limits: verificationGasLimit (128) || callGasLimit (128)readonlyaccountGasLimits:Uint8Array
callData
Calldata to execute on the accountreadonlycallData:Uint8Array
gasFees
Packed fees: maxPriorityFeePerGas (128) || maxFeePerGas (128)readonlygasFees:Uint8Array
initCode
Account factory and initialization code for first-time deploymentreadonlyinitCode:Uint8Array
nonce
Anti-replay nonce (key + sequence)readonlynonce:Type
paymasterAndData
Paymaster address and data (empty if self-paying)readonlypaymasterAndData:Uint8Array
preVerificationGas
Fixed gas overhead for bundler compensationreadonlypreVerificationGas:Type
sender
Smart account address initiating the operationreadonlysender:AddressType
signature
Account signature over userOpHashreadonlysignature:Uint8Array
Type Declaration
[brand]
readonly[brand]:"PackedUserOperation"
See
- https://eips.ethereum.org/EIPS/eip-4337
- https://voltaire.tevm.sh/primitives/packed-user-operation for PackedUserOperation documentation
Since
0.0.0Variables
PackedUserOperation
Defined in: src/primitives/PackedUserOperation/index.ts:34constPackedUserOperation:object
Type Declaration
from()
from: (Create PackedUserOperation from input objectparams) =>PackedUserOperationType
Parameters
params
PackedUserOperation parametersaccountGasLimits
string | Uint8Array<ArrayBufferLike>
Packed gas limits (32 bytes)
callData
string | Uint8Array<ArrayBufferLike>
Calldata to execute
gasFees
string | Uint8Array<ArrayBufferLike>
Packed gas fees (32 bytes)
initCode
string | Uint8Array<ArrayBufferLike>
Account initialization code
nonce
string | number | bigint | Type
Anti-replay nonce
paymasterAndData
string | Uint8Array<ArrayBufferLike>
Paymaster address and data
preVerificationGas
string | number | bigint | Type
Fixed gas overhead
sender
string | number | bigint | Uint8Array<ArrayBufferLike> | AddressType
Smart account address
signature
string | Uint8Array<ArrayBufferLike>
Account signature
Returns
PackedUserOperationType
PackedUserOperation
Example
hash()
hash: (packedUserOp,entryPoint,chainId) =>Uint8Array
Parameters
packedUserOp
PackedUserOperationType
entryPoint
string | number | bigint | Uint8Array<ArrayBufferLike> | AddressType
chainId
number | bigint
Returns
Uint8Array
unpack()
unpack: (packedUserOp) =>UserOperationType
Parameters
packedUserOp
PackedUserOperationType
Returns
UserOperationType
Functions
_hash()
_hash(Defined in: src/primitives/PackedUserOperation/hash.js:21 Compute userOpHash for PackedUserOperation userOpHash = keccak256(abi.encode(packedUserOp, entryPoint, chainId))packedUserOp,entryPoint,chainId):Uint8Array<ArrayBufferLike>
Parameters
packedUserOp
PackedUserOperationType
Packed user operation
entryPoint
EntryPoint contract addressstring | number | bigint | Uint8Array<ArrayBufferLike> | AddressType
chainId
Chain IDnumber | bigint
Returns
Uint8Array<ArrayBufferLike>
32-byte hash for signing
Example
_unpack()
_unpack(Defined in: src/primitives/PackedUserOperation/unpack.js:16 Unpack PackedUserOperation (v0.7) to UserOperation (v0.6) Extracts gas limits and fees from packed bytes32 fields.packedUserOp):UserOperationType
Parameters
packedUserOp
PackedUserOperationType
Packed user operation v0.7
Returns
UserOperationType
User operation v0.6
Example
from()
from(Defined in: src/primitives/PackedUserOperation/from.js:34 Create PackedUserOperation from input objectparams):PackedUserOperationType
Parameters
params
PackedUserOperation parametersaccountGasLimits
string | Uint8Array<ArrayBufferLike>
Packed gas limits (32 bytes)
callData
string | Uint8Array<ArrayBufferLike>
Calldata to execute
gasFees
string | Uint8Array<ArrayBufferLike>
Packed gas fees (32 bytes)
initCode
string | Uint8Array<ArrayBufferLike>
Account initialization code
nonce
string | number | bigint | Type
Anti-replay nonce
paymasterAndData
string | Uint8Array<ArrayBufferLike>
Paymaster address and data
preVerificationGas
string | number | bigint | Type
Fixed gas overhead
sender
string | number | bigint | Uint8Array<ArrayBufferLike> | AddressType
Smart account address
signature
string | Uint8Array<ArrayBufferLike>
Account signature
Returns
PackedUserOperationType
PackedUserOperation
Example
hash()
hash(Defined in: src/primitives/PackedUserOperation/index.ts:16packedUserOp,entryPoint,chainId):Uint8Array
Parameters
packedUserOp
PackedUserOperationType
entryPoint
string | number | bigint | Uint8Array<ArrayBufferLike> | AddressType
chainId
number | bigint
Returns
Uint8Array
unpack()
unpack(Defined in: src/primitives/PackedUserOperation/index.ts:24packedUserOp):UserOperationType
Parameters
packedUserOp
PackedUserOperationType
Returns
UserOperationType
