Repository navigation
feat(rewards): expose swaps and perps rebate quotes - #37251
Conversation
Confirmation screens need the money service rebate rate, and a validation failure, rate limit, and in-flight shed have to stay distinct from a quote that simply is not eligible. Co-authored-by: Cursor <cursoragent@cursor.com>
|
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. |
Smart E2E Test SelectionAI Confidence: 90 E2E reasoningExpand to readThe PR adds new rebate quote functionality (getSwapsRebateQuote, getPerpsRebateQuote) to the RewardsMoneyController and its data service. All changes are purely additive:
Running zero E2E smoke tags is appropriate here — the changes are backend controller additions with no UI surface impact and no modification to existing behavior. Performance reasoningExpand to readThe PR adds new controller methods for fetching rebate quotes. These are network-call-based methods that will be invoked from confirmation screens (not yet wired in this PR). No rendering code, Redux state shape, selector memoization, or UI component is changed. There is no impact on app launch, login, account list, swap flow performance, or any other measured performance scenario. No performance test tags are warranted. |
Type the swaps quote as the bridge-controller Quote (V1 or V2) and send only its feeData.metabridge, so passing the whole QuoteResponse is a type error instead of a silent FEE_TOKEN_NOT_ELIGIBLE. Leave out a perps trade the money service would refuse (coin and notionalUsd checked with its regexes), so an optional field it drops can no longer turn the quote into a 400. Refuse a 200 whose body is not a quote as a FAILED quote error, document that timeouts and network failures reject with a plain Error, and cover the Retry-After date form, the reason-only fallback and empty error bodies.
|
Pushed b77a864 with a few fixes after checking this against money
I also updated the description ( |
|



Description
Exposes the money service
POST /earnings/rebate/quotethroughRewardsMoneyController, the same way/vip/feesis reached throughRewardsController.Swaps and perps each get their own method so a confirmation screen does not have to learn the other product's body.
getSwapsRebateQuotesends the bridge quote'sfeeData.metabridge, which is all the backend reads.getPerpsRebateQuotesends an optional trade, and drops a trade that would not pass the backend's format checks. Both share one data-service POST. The answer is not cached: swaps eligibility depends on the fee token, and the rate has to disappear when an operator ends a window.A quote that is not eligible stays a normal response (
eligible: falseand areason). A refused request, or a 200 whose body is not a quote, is aRewardsMoneyRebateQuoteError, so a validation failure, a rate limit, and the in-flight shed stay distinct. A401stays aRewardsMoneyAuthorizationError. A timeout is a plainError.The endpoint is on money
mainbut not deployed to DEV, UAT, or PRD yet (Argo promotion freeze). Until it is, every call answers 404, which surfaces asRewardsMoneyRebateQuoteErrorwithfailure: 'FAILED'. A screen that consumes these methods has to wait for that deploy.Changelog
CHANGELOG entry: null
Related issues
Fixes: no tracked issue — controller wiring for the money rebate quote
Manual testing steps
N/A — no confirmation screen calls these methods yet. Unit tests cover the data-service POST, the product bodies, the feature gate, and the distinct refusal errors.
Screenshots/Recordings
Before
N/A
After
N/A
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