Skip to content

refactor: handle multiple quotes in a swap batch transaction#8886

Open
micaelae wants to merge 14 commits into
mainfrom
swaps-tx-utils-batch-sell
Open

refactor: handle multiple quotes in a swap batch transaction#8886
micaelae wants to merge 14 commits into
mainfrom
swaps-tx-utils-batch-sell

Conversation

@micaelae
Copy link
Copy Markdown
Member

@micaelae micaelae commented May 21, 2026

Explanation

This doesn't include any BatchSell submission functionality yet. Just refactoring the transaction utils to enable processing multiple quotes within a batch. See cursor comment and changelog for more details

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Changes how swap/bridge gas is estimated and removes a breaking GasFeeController messenger dependency; batch and 7702 submission paths were heavily reworked though behavior is covered by updated tests.

Overview
This PR refactors bridge-status-controller EVM batch submission around a QuoteAndTxMetadata list built by toQuoteAndTxMetadata, so reset approval, approval, and trade steps share one path and can later support multiple quotes in one batch (BatchSell groundwork).

Gas handling is centralized in toTransactionParams: when the bridge API supplies txFee, those limits are used; otherwise fees come from TransactionController:estimateGasFee only. The unused GasFeeController:getState messenger action is removed (breaking for consumers that wired it). #handleEvmTransactionBatch now takes the full quote, sets atomic: true, and applies explicit 7702 / gas-included / delegated-account flags when building batch params.

Post-batch matching uses findAllTransactionsInBatch and updateTransactionsInBatch instead of the old txDataByType map. Single-tx submission reuses the same param builder. Failed-event tracking no longer bails on featureId at the handler level; a new test covers failure metrics when history was wiped but txMeta remains.

Tests and snapshots reflect fewer messenger calls, hex gas values, default location, and new coverage for delegated batch paths.

Reviewed by Cursor Bugbot for commit c2854f9. Bugbot is set up for automated code reviews on this repo. Configure here.

@micaelae micaelae force-pushed the swaps-tx-utils-batch-sell branch from 43d1fca to f48d8e0 Compare May 21, 2026 19:31
@micaelae micaelae marked this pull request as ready for review May 21, 2026 19:35
@micaelae micaelae requested review from a team as code owners May 21, 2026 19:35
@micaelae micaelae changed the title chore: update bridge transaction utils to handle multiple quotes in a batch refactor: update bridge transaction utils to handle multiple quotes in a batch May 21, 2026
@micaelae micaelae temporarily deployed to default-branch May 21, 2026 19:35 — with GitHub Actions Inactive
Comment thread packages/bridge-status-controller/src/utils/transaction.ts Outdated
Comment thread packages/bridge-status-controller/src/utils/transaction.ts
@micaelae micaelae force-pushed the swaps-tx-utils-batch-sell branch 2 times, most recently from 840cd5d to dbe1e17 Compare May 21, 2026 23:25
Comment on lines +1712 to +1715
txFee: {
maxFeePerGas: '50000000000000000',
maxPriorityFeePerGas: '50000000000000000',
},
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed this mock data to match an actual quote

Comment on lines +1878 to +1879
"maxFeePerGas": "0xb1a2bc2ec50000",
"maxPriorityFeePerGas": "0xb1a2bc2ec50000",
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the txFee provided by the quote

@micaelae micaelae force-pushed the swaps-tx-utils-batch-sell branch from dbe1e17 to 81afbff Compare May 21, 2026 23:34
@micaelae micaelae force-pushed the swaps-tx-utils-batch-sell branch from 81afbff to effa5f4 Compare May 21, 2026 23:38
Comment thread packages/bridge-status-controller/src/utils/transaction.ts Outdated
@micaelae micaelae marked this pull request as draft May 22, 2026 01:08
fix: delegated account + gasIncluded7702=false
@micaelae micaelae force-pushed the swaps-tx-utils-batch-sell branch from effa5f4 to eae8297 Compare May 22, 2026 01:25
@micaelae micaelae marked this pull request as ready for review May 26, 2026 17:24
@micaelae micaelae changed the title refactor: update bridge transaction utils to handle multiple quotes in a batch refactor: handle multiple quotes in a swap batch transaction May 26, 2026
@micaelae micaelae enabled auto-merge May 26, 2026 17:30
Comment thread packages/bridge-status-controller/src/utils/transaction.ts
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c2854f9. Configure here.

Comment thread packages/bridge-status-controller/src/bridge-status-controller.ts
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.

1 participant