UserOperation.fromPacked
Transforms a "packed" User Operation into a structured UserOperation.UserOperation
.
Imports
Named
import { UserOperation } from 'ox/erc4337'
Examples
import { UserOperation } from 'ox/erc4337'
const packed: UserOperation.Packed = {
accountGasLimits: '0x...',
callData: '0xdeadbeef',
initCode: '0x...',
gasFees: '0x...',
nonce: 69n,
paymasterAndData: '0x',
preVerificationGas: 100_000n,
sender: '0x9f1fdab6458c5fc642fa0f4c5af7473c46837357',
signature: '0x...',
}
const userOperation = UserOperation.fromPacked(packed)
Definition
function fromPacked(
packed: Packed,
): UserOperation<'0.7' | '0.8', true>
Source: src/erc4337/UserOperation.ts
Parameters
packed
- Type:
Packed
The packed user operation to transform.
packed.accountGasLimits
- Type:
0x${string}
Concatenation of verificationGasLimit
(16 bytes) and callGasLimit
(16 bytes)
packed.callData
- Type:
0x${string}
The data to pass to the sender
during the main execution call.
packed.gasFees
- Type:
0x${string}
Concatenation of maxPriorityFee
(16 bytes) and maxFeePerGas
(16 bytes)
packed.initCode
- Type:
0x${string}
Concatenation of factory
and factoryData
.
packed.nonce
- Type:
bigint
Anti-replay parameter.
packed.paymasterAndData
- Type:
0x${string}
Concatenation of paymaster fields (or empty).
packed.preVerificationGas
- Type:
bigint
Extra gas to pay the Bundler.
packed.sender
- Type:
abitype_Address
The account making the operation.
packed.signature
- Type:
0x${string}
Data passed into the account to verify authorization.
Return Type
The structured user operation.
UserOperation<'0.7' | '0.8', true>