Skip to content

feat: fetch gasless transactions for BatchSell quotes#8805

Open
micaelae wants to merge 16 commits into
mainfrom
swaps4444-batch-trades
Open

feat: fetch gasless transactions for BatchSell quotes#8805
micaelae wants to merge 16 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 obtainGaslessBatch fetch flow with new controller state and abort/error handling, plus a breaking selector output change for BatchSell fee data. Risk is moderate because it affects quote-refresh behavior and client integrations that previously read fees from selectBatchSellQuotes.

Overview
Adds first-class support for BatchSell gasless transaction batches and fee estimation by introducing BridgeController:updateBatchSellTrades, which calls the obtainGaslessBatch endpoint, tracks loading/error state, aborts stale in-flight requests, and resets batch data on new quote requests or resetState.

Introduces new state fields (batchSellTrades, batchSellTradesLoadingStatus) and a new selector selectBatchSellTrades to expose submittable status and totalNetworkFee derived from the batch response + exchange rates; breaking: removes totalNetworkFee from selectBatchSellQuotes.

Extends runtime validation/types for the new batch response and tighter Hex typing, adds fetch utilities/tests for batch trade retrieval and malformed responses, updates snapshots/tests accordingly, and removes some now-unnecessary Hex type assertions in bridge-status-controller and transaction-pay-controller.

Reviewed by Cursor Bugbot for commit 9c38d37. 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
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 28e4c4c. Configure here.

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
@micaelae micaelae enabled auto-merge May 18, 2026 18:31
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