Repository navigation
feat(swaps): show fee rebate banner in Swaps and Quick Buy (SWAPS-5196) - #37623
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. |
PR template — items to address before "Ready for review"Warnings — informational, address before merging:
See docs/readme/ready-for-review.md for the full Definition of Ready for Review. |
Flaky unit test detectionNo same-SHA fail-then-pass history and no flaky pattern found for the 5 modified unit test files in the inspected range. History coverage incomplete: 2026-09-12 to 2026-10-15, 34 day(s), 9480 ci run(s). 26 day(s) inside the window were never fully walked. Nothing was found in the covered range, but this is not an all-clear. See the flaky-test-detection skill. |
…tate mock (SWAPS-5196)
Smart E2E Test SelectionSelected E2E tags: ALL Selected Performance tags: @PerformanceSwaps AI Confidence: 100 E2E reasoningExpand to readThe PR adds a new rebate banner feature used in both Bridge and Quick Buy trading flows, plus a new remote feature flag and locale strings. The banner is rendered in the Bridge market footer and Quick Buy footer, so the impacted user journeys are swap/bridge entry, quote display, and transaction confirmation. Per tag rules, SmokeSwap covers swap/bridge trading flows and requires SmokeConfirmations; SmokeWalletPlatform is also relevant because the change touches wallet actions entry surfaces and activity/trading platform UI. I am not selecting unrelated account/network/onboarding tags because the diff is localized to trading UI and feature-flagged banner behavior. Performance reasoningExpand to readThe change adds UI and selector work directly on the swap/bridge quote path and Quick Buy footer, which can affect swap flow rendering and quote/CTA responsiveness. @PerformanceSwaps is the only performance tag aligned with quote fetching, token selection, swap execution, and transaction completion times. |
|
⚡ Performance Test Results
✅ All tests passed · 2 tests · 1 device 📱 Devices tested (1)Android: Google Pixel 8 Pro (v14.0) ✅ Passed Tests (2)
Branch: |


Description
Adds a fee rebate banner, "You’re getting X% back on fees", directly above the CTA in the Swaps market order footer and in Quick Buy. Quick Buy covers both regular and "Copy trade" entries. Users who are eligible for a rebate (from the rebate test or a referral offer) see what share of the MetaMask fee they'll get back. Rebates are paid to the user's Money account.
How it works:
useSwapsRebatehook: callsRewardsMoneyController:getSwapsRebateQuote(#37251) with the selected quote.rebateBips / 100, but only wheneligibleis true andreasonis null.RebateBannercomponent: a shared banner made from design-system components, the existingmoney-balance.svgicon and the standard tooltip sheet. It renders nothing when there's no rebate.BridgeMarketViewFooter, above the Confirm button.QuickBuyActionFooter, between "Pay with" and the Buy button.swapsRebateBannerEnabledLaunchDarkly flag ({ enabled, minimumVersion }), which defaults to off. When it's off, the endpoint isn't called and no banner renders. The flag isn't in LaunchDarkly yet, so it's registered asinProd: falseinfeature-flag-registry.ts. Update that entry once the flag is created.Out of scope: the Perps UI and the Social team's post-trade card.
Changelog
CHANGELOG entry: Added a fee rebate banner to Swaps and Quick Buy for users eligible for a MetaMask fee rebate
Related issues
Fixes: SWAPS-5196
Manual testing steps
Until the endpoint is live, test by temporarily replacing the controller call in
useSwapsRebate.tswithPromise.resolve({ product: 'swaps', eligible: true, rebateBips: 1000, reason: null }).Screenshots/Recordings
Before
No rebate banner.
After
To be added once the banner has been tested against the live endpoint with final copy.
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Low Risk
Additive, flag-gated UI that fails closed (no banner on errors) and does not alter swap or payment execution.
Overview
Adds a fee rebate banner (“You’re getting X% back on fees”) above the confirm CTA in Swaps (
BridgeMarketViewFooter) and Quick Buy (QuickBuyActionFooter), including copy-trade.A new
useSwapsRebatehook loads eligibility viaRewardsMoneyController:getSwapsRebateQuotewhen the version-gated remote flagswapsRebateBannerEnabledis on. It refetches only when the MetaMask fee token changes (not on quote refresh), converts eligiblerebateBipsto a percent, and returnsnullon ineligible responses or errors so the trade flow stays unchanged.RebateBannerrenders the message and an info tooltip using newbridge.rebate_*strings.Registers the flag in the feature-flag registry (default off,
inProd: false) and adds unit tests for the hook, banner, and selector; parent footer tests mock the banner.Reviewed by Cursor Bugbot for commit 7cd9138. Bugbot is set up for automated code reviews on this repo. Configure here.