Title
Implement smart contract wallet interface for Account Abstraction
Labels
enhancement, account-abstraction, wallet, smart-account
Description
Add interfaces and utilities for interacting with ERC-4337 smart contract accounts (wallets), enabling advanced wallet functionality beyond EOAs.
Requirements
SmartAccount Interface
SimpleAccount Implementation
Account Factory Support
Utilities
Common Account Types Support
File Structure
src/account_abstraction/
├── account.zig # SmartAccount interface
├── simple_account.zig # SimpleAccount implementation
├── factory.zig # Account factory utilities
└── utils.zig # Helper functions
Example Usage
// Create a simple account
const factory = try SimpleAccountFactory.init(allocator, factory_address);
const account = try factory.createAccount(owner_wallet, 0);
// Use the account
const userOp = try account.execute(
recipient_address,
@as(u256, 1_000_000_000_000_000_000), // 1 ETH
&[_]u8{}, // empty data
);
const signed_userOp = try account.signUserOperation(userOp);
const hash = try bundler.sendUserOperation(signed_userOp, entry_point);
References
Title
Implement smart contract wallet interface for Account Abstraction
Labels
enhancement,account-abstraction,wallet,smart-accountDescription
Add interfaces and utilities for interacting with ERC-4337 smart contract accounts (wallets), enabling advanced wallet functionality beyond EOAs.
Requirements
SmartAccount Interface
SmartAccounttrait/interface:getAddress() Address- Get deployed account addressgetNonce(?key: u256) u256- Get current nonce for keysignUserOperation(userOp: UserOperation) []u8- Sign UserOpencodeExecute(to: Address, value: u256, data: []u8) []u8- Encode callencodeBatchExecute(calls: []Call) []u8- Encode batch callsgetInitCode() []u8- Get account deployment codeisDeployed() bool- Check if account is deployedSimpleAccount Implementation
SimpleAccount(ERC-4337 reference implementation):Account Factory Support
AccountFactoryinterface:getAccountAddress(owner: Address, salt: u256) Address- Predict addresscreateAccount(owner: Address, salt: u256) Address- Deploy accountgetInitCode(owner: Address, salt: u256) []u8- Get init codeUtilities
txToUserOp(tx: Transaction, account: SmartAccount) UserOperation- Convert txsignUserOperationHash(hash: Hash, signer: Wallet) []u8validateUserOpSignature(userOp: UserOperation, account: SmartAccount) boolCommon Account Types Support
File Structure
Example Usage
References