fix(predict): harden claim gas-station preflight - #35567
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. |
Align claim batch submission with withdraw, validate Safe gas fee token availability before sign, and block confirmation when gas-station tokens are unavailable for insufficient native balance flows.
e695d65 to
4b31da9
Compare
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: PredictController.ts & PolymarketProvider.ts changes:
useInsufficientBalanceAlert.ts & useIsGaslessLoading.ts changes:
No performance impact: These are logic/behavioral changes to prediction claim flows and confirmation hooks, not rendering or data-loading performance changes. Performance Test Selection: |
🧪 Flaky unit test detectionRun history flaky detectionHistorical failure rate is a hint, not proof — review each suggestion in context. See the flaky-test-detection skill for the full pattern reference and manual audit workflow. Failures / runs sampled per window:
AI-detected flaky patterns
|
|



Description
Predict claim can fail on Polygon Safe wallets when a pUSD gas fee token is pre-selected but Sentinel returns an empty
gasFeeTokenslist and native POL is insufficient. Users see a generic confirmation failure (Gas fee token not found and insufficient native balance/intrinsic gas too low: gas 0).This PR hardens the mobile-side claim flow:
PredictController.claimWithConfirmation— align batch submission with withdraw: gategasFeeTokenon wallet type (omit for deposit-wallet), and removeskipInitialGasEstimateso gas estimates complete before confirm.PolymarketProvider.beforeSignClaim— for Safe wallets, fail early with a clear error when simulation has finished and the selected gas fee token is unavailable.useIsGaslessLoading— treat an emptygasFeeTokensarray as unavailable (not “done loading”) when native balance is insufficient, so confirm stays disabled.useInsufficientBalanceAlert— show the blocking insufficient-balance alert for forced gas-fee-token flows (isGasFeeTokenIgnoredIfBalance) when no gas-station tokens are available.Companion core fix: MetaMask/core#10071 (transaction-controller gas fee token preflight). Mobile should bump
@metamask/transaction-controllerafter core merges.Changelog
CHANGELOG entry: Fixed Predict claim failures for users with insufficient POL when gas-station fee tokens are unavailable
Related issues
Refs: https://consensyssoftware.atlassian.net/browse/CONF-1725
Manual testing steps
Screenshots/Recordings
N/A — preflight/confirmation gating change; manual verification on iOS/Android simulator recommended after core bump.
Before
N/A
After
N/A
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an examplePre-merge reviewer checklist