Skip to content

feat: fetch gasless transactions for BatchSell quotes#8805

Merged
micaelae merged 17 commits into
mainfrom
swaps4444-batch-trades
May 19, 2026
Merged

feat: fetch gasless transactions for BatchSell quotes#8805
micaelae merged 17 commits into
mainfrom
swaps4444-batch-trades

Conversation

@micaelae
Copy link
Copy Markdown
Member

@micaelae micaelae commented May 14, 2026

Explanation

Implements the updateBatchSellTrades handler which calls the obtainGaslessBatch to estimate network fees for BatchSell quotes. Clients will need to call the handler whenever the selectBatchQuotes selector's recommended quotes change

A new selector selectBatchSellTrades has also been added, which returns whether a batch is submittable, and the totalNetworkFee provided by the obtainGaslessBatch endpoint and its converted values

References

Fixes https://consensyssoftware.atlassian.net/browse/SWAPS-4444

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
Adds a new network call and state flow for BatchSell fee/transaction batch fetching, including abort/error handling and breaking selector output changes. Risk is moderate due to new API integration and fee display/submittability gating logic.

Overview
BatchSell quotes now have a separate fetch path for gasless transaction batches and fees. BridgeController adds updateBatchSellTrades, stores results in new state fields (batchSellTrades, batchSellTradesLoadingStatus), and aborts in-flight requests on new quote requests/resets to avoid stale fee data.

Selectors and API/types were updated to support this flow. selectBatchSellQuotes no longer returns totalNetworkFee (breaking); new selectBatchSellTrades derives totalNetworkFee from the obtainGaslessBatch response (with exchange-rate conversion) and reports whether the batch is submittable based on fetched transactions.

Validation/test coverage expanded. Adds request/response formatting + strict validators for batch responses and gasless fee fields, updates snapshots, and removes unnecessary Hex type assertions in bridge transaction construction.

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

@micaelae micaelae force-pushed the swaps4444-batch-trades branch from 812aa2e to c01f799 Compare May 14, 2026 00:46
@micaelae micaelae marked this pull request as ready for review May 14, 2026 01:04
@micaelae micaelae requested a review from a team as a code owner May 14, 2026 01:04
@micaelae micaelae temporarily deployed to default-branch May 14, 2026 01:05 — with GitHub Actions Inactive
@micaelae micaelae requested a review from a team as a code owner May 14, 2026 01:06
Comment thread packages/bridge-controller/src/bridge-controller.ts
Comment thread packages/bridge-controller/src/bridge-controller.ts
@micaelae micaelae requested a review from a team as a code owner May 15, 2026 19:16
@micaelae micaelae enabled auto-merge May 15, 2026 19:50
Comment thread packages/bridge-controller/src/bridge-controller.ts
@micaelae micaelae disabled auto-merge May 15, 2026 19:58
@micaelae micaelae enabled auto-merge May 15, 2026 20:00
GeorgeGkas
GeorgeGkas previously approved these changes May 15, 2026
Comment thread packages/bridge-controller/src/selectors.ts
@GeorgeGkas GeorgeGkas marked this pull request as draft May 18, 2026 18:14
auto-merge was automatically disabled May 18, 2026 18:14

Pull request was converted to draft

@GeorgeGkas GeorgeGkas marked this pull request as ready for review May 18, 2026 18:14
GeorgeGkas
GeorgeGkas previously approved these changes May 18, 2026
@micaelae micaelae enabled auto-merge May 18, 2026 18:31
infiniteflower
infiniteflower previously approved these changes May 18, 2026
matthewwalsh0
matthewwalsh0 previously approved these changes May 19, 2026
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 de47eb4. Configure here.

Comment thread packages/bridge-controller/src/utils/fetch.ts
@micaelae micaelae added this pull request to the merge queue May 19, 2026
Merged via the queue into main with commit be21a3b May 19, 2026
370 checks passed
@micaelae micaelae deleted the swaps4444-batch-trades branch May 19, 2026 15:50
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.

4 participants