@tevm/voltaire / primitives/UserOperation
primitives/UserOperation
Type Aliases
UserOperationType
UserOperationType =Defined in: src/primitives/UserOperation/UserOperationType.ts:16 UserOperation type - ERC-4337 v0.6 format User operations enable account abstraction by separating transaction validation from execution. Bundlers aggregate user operations and submit them to the EntryPoint contract for execution.object&object
Type Declaration
callData
Calldata to execute on the accountreadonlycallData:Uint8Array
callGasLimit
Gas limit for the execution phasereadonlycallGasLimit:Type
initCode
Account factory and initialization code for first-time deploymentreadonlyinitCode:Uint8Array
maxFeePerGas
Maximum total fee per gas (EIP-1559)readonlymaxFeePerGas:Type
maxPriorityFeePerGas
Maximum priority fee per gas (EIP-1559)readonlymaxPriorityFeePerGas:Type
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
verificationGasLimit
Gas limit for the verification phasereadonlyverificationGasLimit:Type
Type Declaration
[brand]
readonly[brand]:"UserOperation"
See
- https://eips.ethereum.org/EIPS/eip-4337
- https://voltaire.tevm.sh/primitives/user-operation for UserOperation documentation
Since
0.0.0Variables
UserOperation
Defined in: src/primitives/UserOperation/index.ts:32constUserOperation:object
Type Declaration
from()
from: (Create UserOperation from input objectparams) =>UserOperationType
Parameters
params
UserOperation parameterscallData
string | Uint8Array<ArrayBufferLike>
Calldata to execute
callGasLimit
string | number | bigint | Type
Gas for execution
initCode
string | Uint8Array<ArrayBufferLike>
Account initialization code
maxFeePerGas
string | number | bigint | Type
Max total fee per gas
maxPriorityFeePerGas
string | number | bigint | Type
Max priority fee per gas
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
verificationGasLimit
string | number | bigint | Type
Gas for verification
Returns
UserOperationType
UserOperation
Example
hash()
hash: (userOp,entryPoint,chainId) =>Uint8Array
Parameters
userOp
UserOperationType
entryPoint
string | number | bigint | Uint8Array<ArrayBufferLike> | AddressType
chainId
number | bigint
Returns
Uint8Array
pack()
pack: (userOp) =>PackedUserOperationType
Parameters
userOp
UserOperationType
Returns
PackedUserOperationType
Functions
_hash()
_hash(Defined in: src/primitives/UserOperation/hash.js:21 Compute userOpHash for signing userOpHash = keccak256(abi.encode(userOp, entryPoint, chainId))userOp,entryPoint,chainId):Uint8Array<ArrayBufferLike>
Parameters
userOp
UserOperationType
User operation
entryPoint
EntryPoint contract addressstring | number | bigint | Uint8Array<ArrayBufferLike> | AddressType
chainId
Chain IDnumber | bigint
Returns
Uint8Array<ArrayBufferLike>
32-byte hash for signing
Example
_pack()
_pack(Defined in: src/primitives/UserOperation/pack.js:14 Pack UserOperation (v0.6) to PackedUserOperation (v0.7) Packs gas limits and fees into bytes32 for v0.7 entry point.userOp):PackedUserOperationType
Parameters
userOp
UserOperationType
User operation v0.6
Returns
PackedUserOperationType
Packed user operation v0.7
Example
from()
from(Defined in: src/primitives/UserOperation/from.js:38 Create UserOperation from input objectparams):UserOperationType
Parameters
params
UserOperation parameterscallData
string | Uint8Array<ArrayBufferLike>
Calldata to execute
callGasLimit
string | number | bigint | Type
Gas for execution
initCode
string | Uint8Array<ArrayBufferLike>
Account initialization code
maxFeePerGas
string | number | bigint | Type
Max total fee per gas
maxPriorityFeePerGas
string | number | bigint | Type
Max priority fee per gas
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
verificationGasLimit
string | number | bigint | Type
Gas for verification
Returns
UserOperationType
UserOperation
Example
hash()
hash(Defined in: src/primitives/UserOperation/index.ts:16userOp,entryPoint,chainId):Uint8Array
Parameters
userOp
UserOperationType
entryPoint
string | number | bigint | Uint8Array<ArrayBufferLike> | AddressType
chainId
number | bigint
Returns
Uint8Array
pack()
pack(Defined in: src/primitives/UserOperation/index.ts:24userOp):PackedUserOperationType
Parameters
userOp
UserOperationType
Returns
PackedUserOperationType
