Skip to content

Add ERC-4337 bundler RPC client #28

Description

@ch4r10t33r

Title

Add ERC-4337 bundler RPC client

Labels

enhancement, account-abstraction, rpc, bundler

Description

Implement RPC client for interacting with ERC-4337 bundlers to submit and manage UserOperations, similar to viem's bundler client.

Requirements

Bundler Namespace

  • Create BundlerNamespace similar to existing EthNamespace
  • Implement bundler-specific RPC methods:
    • eth_sendUserOperation(userOp: UserOperation, entryPoint: Address) -> Hash
    • eth_estimateUserOperationGas(userOp: UserOperation, entryPoint: Address) -> UserOpGasEstimate
    • eth_getUserOperationByHash(hash: Hash) -> ?UserOperation
    • eth_getUserOperationReceipt(hash: Hash) -> ?UserOperationReceipt
    • eth_supportedEntryPoints() -> []Address

UserOperationReceipt Type

  • Define UserOperationReceipt struct with:
    • userOpHash: Hash - UserOperation hash
    • entryPoint: Address - EntryPoint contract used
    • sender: Address - Account that sent the operation
    • nonce: u256 - Nonce used
    • paymaster: ?Address - Paymaster if used
    • actualGasUsed: u256 - Total gas used
    • actualGasCost: u256 - Total gas cost in wei
    • success: bool - Execution status
    • reason: ?[]u8 - Revert reason if failed
    • logs: []Log - Event logs emitted
    • receipt: Receipt - Inner transaction receipt

UserOpGasEstimate

  • Define gas estimation result struct:
    • preVerificationGas: u256
    • verificationGasLimit: u256
    • callGasLimit: u256
    • paymasterVerificationGasLimit: ?u256
    • paymasterPostOpGasLimit: ?u256

Error Handling

  • Add bundler-specific error types:
    • InvalidUserOp
    • SimulationFailed
    • OpcodeValidationFailed
    • PaymasterRejected
    • AccountNotDeployed

File Location

src/rpc/bundler.zig           # Bundler RPC namespace
src/account_abstraction/
  └── types.zig               # AA-specific types

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions