Skip to content

IND-369 | Add support for batched UserOperations#7

Merged
DrenIncentiv merged 2 commits intomainfrom
IND-369-add-support-for-batched-user-operations
Feb 4, 2025
Merged

IND-369 | Add support for batched UserOperations#7
DrenIncentiv merged 2 commits intomainfrom
IND-369-add-support-for-batched-user-operations

Conversation

@enis-incentiv
Copy link
Collaborator

@enis-incentiv enis-incentiv commented Jan 22, 2025

Story

https://incentiv-net.atlassian.net/browse/IND-369

Description

This PR implements support for batched transactions in the UI-SDK, allowing developers to submit multiple transactions as a single UserOperation. This feature optimizes gas fees and ensures atomicity for dependent transactions.

Key Features

  • Added batch transaction support in SimpleAccountAPI and ERC4337EthersSigner
  • Implemented atomic execution for batched operations
  • Added gas estimation for batch transactions

Technical Implementation

  1. Batch Transaction Interface:

    • Added BatchTransactionRequest interface supporting multiple transactions
    • Each transaction includes: target address, value, and calldata
  2. Atomic Execution:

    • Implemented encodeExecuteBatch for bundling multiple transactions
    • All transactions in a batch are executed atomically
    • If any transaction fails, the entire batch is reverted
  3. Gas Handling:

    • Added gas estimation for batch operations
    • Proper handling of gas limits for the entire batch
    • Support for custom gas parameters (maxFeePerGas, maxPriorityFeePerGas)

Example Usage

await signer.sendBatchTransaction({
  targets: ["0xaddress1", "0xaddress2"],
  datas: ["0x", "0x"],
  values: [
    ethers.utils.parseEther("1.5"),
    ethers.utils.parseEther("2.0")
  ]
});

Testing

  • Verified atomic execution of batch transactions
  • Tested transfer functionality
  • Validated gas estimation for batch operations
  • Confirmed proper handling of transaction failures

Breaking Changes

None. This is a new feature that maintains compatibility with existing functionality.

@DrenIncentiv DrenIncentiv merged commit 677d3ab into main Feb 4, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants