feat: show RewardsVipBadge in swap page#30410
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #30410 +/- ##
========================================
Coverage 82.01% 82.01%
========================================
Files 5444 5457 +13
Lines 145478 145939 +461
Branches 33292 33448 +156
========================================
+ Hits 119307 119696 +389
- Misses 18018 18050 +32
- Partials 8153 8193 +40 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Tag selection rationale:
The Performance Test Selection: |
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.
Reviewed by Cursor Bugbot for commit e1754ee. Configure here.
| activeQuote && | ||
| Boolean(baseBpsFee) && | ||
| Boolean(quoteBpsFee) && | ||
| baseBpsFee > quoteBpsFee; |
There was a problem hiding this comment.
Boolean() conflates zero with absent in discount check
Medium Severity
The isDiscounted check uses Boolean(quoteBpsFee) to verify the value exists, but Boolean(0) returns false. If a VIP user receives a 100% fee reduction (quoteBpsFee is 0 while baseBpsFee is positive), the discount is real but isDiscounted evaluates to false — hiding the VIP badge and strikethrough UI. The code already uses isNullOrUndefined (imported and applied on lines 23 and 29) to correctly distinguish 0 from null/undefined for the fee percentage calculations; the same approach fits here for consistency and correctness.
Reviewed by Cursor Bugbot for commit e1754ee. Configure here.
|





Description
Changes
Changelog
CHANGELOG entry: feat: show RewardsVipBadge in swap page
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/SWAPS-4465
Manual testing steps
Screenshots/Recordings
Before
After
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
Medium Risk
Touches fee-disclaimer logic in the Bridge confirmation flow and adds a new RewardsController API that calls
/vip/fees, which could affect pricing/UX if the quote fee fields or VIP lookup behave unexpectedly.Overview
Bridge footer now surfaces VIP fee discounts. A new
useFeeDisclaimerhook derives the disclaimer copy from quotebaseBpsFeevsquoteBpsFee, andBridgeViewFooterrenders a struck-through base fee plus discounted fee text when applicable.Adds a reusable VIP badge and controller support. Introduces
RewardsVipBadge(and tests) that fetches and displays the account VIP tier, exportsformatAccountToCaipAccountIdfor CAIP formatting, and addsRewardsController.getVipTierForAccount(with shared VIP fees fetch/dedup refactor + action type wiring) to support the badge.Also updates selectors/testIDs and i18n strings to support the new disclaimer/badge and adjusts unit tests for discounted/undefined-fee cases.
Reviewed by Cursor Bugbot for commit e1754ee. Bugbot is set up for automated code reviews on this repo. Configure here.