feat: Swaps quotes selector#26640
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
GeorgeGkas
left a comment
There was a problem hiding this comment.
on useInsufficentBalance line 72 // TODO: use totalNetworkFee
on useHasSufficientGas on line 54 // TODO: use totalNetworkFee
| ? (quote.includedTxFees?.usd ?? '0') | ||
| : (quote.totalNetworkFee?.usd ?? | ||
| quote.gasFee?.effective?.usd ?? |
There was a problem hiding this comment.
These should use .valueInCurrency instead of .usd, otherwise we get unit mismatch.
Example:
- Assume user currency is EUR.
- sentAmount.usd = 100, sentAmount.valueInCurrency = 92
- networkFee.usd = 5, networkFee.valueInCurrency = 4.6
- Current code formats 100 + 5 = 105 as EUR => shows about €105
- Correct EUR total should be €96.6
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
SmokeTrade is selected because it tests DeFi trading features including cross-chain bridging, which is exactly what this PR modifies. The bridge-action-smoke.spec.ts test directly tests bridge functionality. SmokeConfirmations is selected because per the tag description: "When selecting SmokeTrade for swap or bridge flows, also select SmokeConfirmations" since transaction confirmations are part of the bridge flow. The changes are scoped to the Bridge UI feature and don't affect:
Risk is medium because while the changes are significant (new view, Redux state, hooks), they are well-contained within the Bridge feature and include comprehensive unit tests. Performance Test Selection: |
|
|
✅ E2E Fixture Validation — Schema is up to date |



Description
Add select quotes functionality in swaps.
Changelog
CHANGELOG entry: add select quotes functionality
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/SWAPS-3642, https://consensyssoftware.atlassian.net/browse/SWAPS-4149, https://consensyssoftware.atlassian.net/browse/SWAPS-4203
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Touches quote-selection and fee-formatting logic and introduces a new navigation flow, which could affect which quote is executed and what costs are displayed if edge cases (expired/refreshing quotes, missing requestId) are mishandled.
Overview
Adds a new Quote Selector screen that lists sorted swap/bridge quotes by estimated total cost and lets users pick a specific quote; the
raterow inQuoteDetailsCardnow navigates to this selector via newrate-info-button/rate-arrow-buttonactions.Introduces
selectedQuoteRequestIdto the bridge Redux slice and threads it throughselectBridgeQuotesanduseBridgeQuoteDataso a manually chosen quote becomes theactiveQuote(with auto-reset when the selection is no longer valid/available).Refactors fiat/amount display by adding
useDisplayCurrencyValueand switchingTokenInputAreato use it (and the renameduseFormattedBalanceWithThreshold), and updatesformatNetworkFeeto correctly handle gasless quotes viaincludedTxFeeswith agasFee.effectivefallback. Includes new route wiring (Routes.BRIDGE.QUOTE_SELECTOR_VIEW), i18n strings, and extensive new/updated unit tests covering the selector UI, analytics (useTrackAllQuotesSortedEvent), and various BridgeView behaviors (Blockaid banner, approval disclaimer, input constraints, sponsored-network handling).Written by Cursor Bugbot for commit 701dd24. This will update automatically on new commits. Configure here.