Title
Add ERC-4337 UserOperation type and encoding
Labels
enhancement, account-abstraction, erc-4337
Description
Implement the core UserOperation struct according to ERC-4337 specification to enable account abstraction functionality, similar to viem's implementation.
Requirements
Core Type
Encoding & Hashing
Helper Methods
File Structure
src/account_abstraction/
├── user_operation.zig # Core UserOperation type
├── types.zig # AA-related types
└── root.zig # Module exports
References
Benefits
- Enable gasless transactions
- Smart contract wallet support
- Batch operations
- Session keys and permissions
- Social recovery
Title
Add ERC-4337 UserOperation type and encoding
Labels
enhancement,account-abstraction,erc-4337Description
Implement the core
UserOperationstruct according to ERC-4337 specification to enable account abstraction functionality, similar to viem's implementation.Requirements
Core Type
UserOperationstruct with all ERC-4337 required fields:sender: Address- Account making the operationnonce: u256- Anti-replay parameter (now using native u256!)init_code: []u8- Account creation code (for first tx)call_data: []u8- Data to pass to sender during executioncall_gas_limit: u256- Gas limit for main execution callverification_gas_limit: u256- Gas for account validationpre_verification_gas: u256- Fixed gas overheadmax_fee_per_gas: u256- Max fee per gas unit (EIP-1559)max_priority_fee_per_gas: u256- Max priority fee (EIP-1559)paymaster_and_data: []u8- Paymaster address and extra datasignature: []u8- Signature over the userOp hashEncoding & Hashing
getUserOpHash(op: UserOperation, entry_point: Address, chain_id: u64) HashpackUserOp(op: UserOperation) []u8for encodingHelper Methods
init()- Create new UserOperationdeinit()- Free allocated memoryisDeployment()- Check if this deploys a new account (has init_code)File Structure
References
Benefits