ERC-4337 UserOperation struct (unpacked representation).
Holds the fields a consumer reasons about, independent of EntryPoint version.
Numeric fields (nonce, gas limits, fees) are stored as non-negative
integers; byte-array fields (sender, call_data, …) as 0x-prefixed hex
strings.
Version-specific fields
The struct carries the union of v0.6 and v0.7 fields. Which ones are used
depends on the EntryPoint version passed to Onchain.AA functions:
- v0.6 uses
init_codeandpaymaster_and_datadirectly. - v0.7 derives
initCode = factory ++ factory_dataandpaymasterAndData = paymaster ++ paymaster_verification_gas_limit (16 bytes) ++ paymaster_post_op_gas_limit (16 bytes) ++ paymaster_datafrom the unpackedfactory*/paymaster*fields when they are set. Iffactoryisnil,init_codeis used verbatim; ifpaymasterisnil,paymaster_and_datais used verbatim. This lets a v0.7 op be expressed either way.
Build instances with Onchain.AA.new/1, which applies defaults and validates.
Summary
Types
@type t() :: %Onchain.AA.UserOperation{ call_data: String.t(), call_gas_limit: non_neg_integer(), factory: String.t() | nil, factory_data: String.t() | nil, init_code: String.t(), max_fee_per_gas: non_neg_integer(), max_priority_fee_per_gas: non_neg_integer(), nonce: non_neg_integer(), paymaster: String.t() | nil, paymaster_and_data: String.t(), paymaster_data: String.t() | nil, paymaster_post_op_gas_limit: non_neg_integer() | nil, paymaster_verification_gas_limit: non_neg_integer() | nil, pre_verification_gas: non_neg_integer(), sender: String.t(), signature: String.t(), verification_gas_limit: non_neg_integer() }