## Explanation
This PR implements quote polling for batched swap requests
#### Changes
- `updateBridgeQuoteRequest` now takes 2 extra params: the quote
request’s index and the total quoteRequestCount within the batch. no
changes in how we are using this handler for regular swaps
- the new `selectBatchSellQuotes` selector returns the recommended quote
for each quoteRequest, and aggregated amounts for display purposes
- `isValidBatchSellQuoteRequest`
#### Usage
- the clients will need to maintain a list of requests, each one
identified by an index. the index identifies the quoteRequest and its
related side effects (quotes, metrics, submission etc) once it’s passed
to updateBridgeQuoteRequest
- to access quotes for a single quoteRequest, use the same index used
during quoteRequest update
#### Minimal client examples
- extension: MetaMask/metamask-extension#42434.
Checkout this branch and resolve the package locally to test
- mobile: MetaMask/metamask-mobile#29831
<!--
Thanks for your contribution! Take a moment to answer these questions so
that reviewers have the information they need to properly understand
your changes:
* What is the current state of things and why does it need to change?
* What is the solution your changes offer and how does it work?
* Are there any changes whose purpose might not obvious to those
unfamiliar with the domain?
* If your primary goal was to update one package but you found you had
to update another one along the way, why did you do so?
* If you had to upgrade a dependency, why did you do so?
-->
## References
<!--
Are there any issues that this pull request is tied to?
Are there other links that reviewers should consult to understand these
changes better?
Are there client or consumer pull requests to adopt any breaking
changes?
For example:
* Fixes #12345
* Related to #67890
-->
Fixes https://consensyssoftware.atlassian.net/browse/SWAPS-4443
## 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](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md)
- [ ] I've introduced [breaking
changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> This is a breaking API/state-shape change (`quoteRequest` becomes an
array) that touches quote polling/streaming, analytics properties, and
exchange-rate lookup logic; regressions could affect quote fetching and
refresh behavior across swaps/bridges.
>
> **Overview**
> **Adds BatchSell (batched swap) quote support** by changing
`quoteRequest` state and polling inputs from a single request to an
array, allowing callers to update a specific request via new
`updateBridgeQuoteRequestParams(…, quoteRequestIndex,
quoteRequestCount)` parameters.
>
> Quote fetching/streaming is updated to accept multiple requests: SSE
uses a new `POST /getBatchQuoteStream` path when batching, tags incoming
quotes with `quoteRequestIndex`, traces via new Sentry trace name `Batch
Sell Quotes Fetched`, and adjusts polling stop/refresh logic to continue
as long as *any* request is sufficiently funded.
>
> Selectors and rate lookup are extended for batching: adds
`selectBatchSellQuotes` (per-request recommended quotes plus aggregated
received/fee totals), switches exchange-rate selection to
`selectExchangeRateByAssetId`, and exports
`isValidBatchSellQuoteRequest`; tests/snapshots are updated and a new
SSE batch test is added.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
9e2a7fa. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Description
Bumps the bridge-controller to 72.0.0, in which the
state.quoteRequest's type has changed from QuoteRequest to an array of QuoteRequests. This PR doesn't use BatchSell quotes yet but updates existing tests and implements thegetBatchSellQuotesselector.Changelog
CHANGELOG entry: feat: set up batch sell quotes
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/SWAPS-4443
Manual testing steps
N/A
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Medium risk because it updates bridge controller dependencies and changes the expected
quoteRequeststate shape to an array, which can subtly break selectors/tests if any remaining call sites assume a single object.Overview
Updates bridge integration to
@metamask/bridge-controller@72.0.0(andbridge-status-controller@71.1.1), whereBridgeController.state.quoteRequestis now treated as an array.Adjusts Sentry state masking, the bridge mock store, and e2e snapshot expectations to match the new
quoteRequestshape, and updatesupdateQuoteRequestParamsto passquoteRequestIndex/quoteRequestCountthrough to the background controller.Adds a new
getBatchSellQuotesselector (backed by controllerselectBatchSellQuotes) plus unit tests/snapshots for batch-sell quote selection/refresh behavior, while keeping existing single-quote flows usingquoteRequest[0].Reviewed by Cursor Bugbot for commit cbfe65c. Bugbot is set up for automated code reviews on this repo. Configure here.