-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat: allow add account predict flow #22856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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. |
f0efe05 to
9db7aa2
Compare
app/components/UI/Predict/views/PredictBuyPreview/PredictBuyPreview.tsx
Outdated
Show resolved
Hide resolved
9db7aa2 to
dadabd0
Compare
| setEstimatedPoints(null); | ||
| setEnabled(false); | ||
| setAccountOptedIn(null); | ||
| setShouldShowRewardsRow(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Zero Fees Break Rewards Logic
The early return condition treats totalFeeAmountUsd of 0 as missing data, causing rewards logic to skip when fees are zero. The check !totalFeeAmountUsd evaluates to true for 0, preventing opted-in users from seeing rewards when total fees are exactly zero. This should check for undefined or null instead of falsy values.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsFallback: AI analysis did not complete successfully. Running all tests. |
|



Description
Switches the reward point calculation for predict from a hard coded approach to using the rewards API. It also uses the same approach recently introduced in the swaps flow, to allow add their account if it's not correctly tied to their rewards subscription.
Changelog
CHANGELOG entry: Estimate reward points in predict flow
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/RWDS-801
Screenshots/Recordings
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Switch Predict to API-based points estimation with opt-in handling, update UI to show points/add-account, and extend rewards types/tests.
PredictBuyPreviewto useusePredictRewards(totalFee)and drive rewards UI; computeshouldShowRewardsRowand passaccountOptedIn,estimatedPoints, loading/error toPredictFeeSummary.PredictFeeSummaryprops renamedshouldShowRewards→shouldShowRewardsRow; addaccountOptedIn, error tooltip; renderAddRewardsAccountwhen not opted in; wireRewardPointsAnimationstates.usePredictRewards:totalFeeAmountUsd; selects multichain account byPOLYGON_MAINNET_CAIP_CHAIN_IDand formats CAIP-10 without bridge-controller.RewardsController:estimatePointsusingPOLYGON_USDC_CAIP_ASSET_IDandparseUnitswith 6 decimals.RewardsController:accountLinked; returns{enabled,isLoading,accountOptedIn,shouldShowRewardsRow,estimatedPoints,hasError}.RewardPointsAnimation: makeinfoOnPressoptional; hide info icon unless provided; supporthideValuefrom hook.EstimatePredictContextDto, addPREDICTtoPointsEventEarnType.POLYGON_USDC_CAIP_ASSET_IDconstant.Written by Cursor Bugbot for commit dadabd0. This will update automatically on new commits. Configure here.