Skip to content

feat(predict): add deposit wallet claim flow#29936

Merged
matallui merged 1 commit into
mainfrom
predict/dw-claim-flow
May 9, 2026
Merged

feat(predict): add deposit wallet claim flow#29936
matallui merged 1 commit into
mainfrom
predict/dw-claim-flow

Conversation

@matallui

@matallui matallui commented May 8, 2026

Copy link
Copy Markdown
Contributor

Description

Adds Deposit Wallet support for the Predict claim flow.

Polymarket Deposit Wallet users still create a normal MetaMask claim confirmation so the transaction is visible in activity, but the signed confirmation transaction is not published directly. Instead, Predict intercepts pending claim transactions in the publish hook, submits the actual claim calls as a Polymarket Deposit Wallet relayer WALLET batch, waits only until the relayer returns a transaction hash, and returns that hash to TransactionController.

This PR preserves legacy Safe claim behavior: Safe users continue to sign and publish the existing Safe claim transaction path.

Key changes:

  • Add Deposit Wallet claim planning that builds relayer calls from claimable positions.
  • Mark Deposit Wallet claim confirmation transactions as externally signed before signing.
  • Publish Deposit Wallet claims through the relayer batch and return as soon as a transaction hash is available.
  • Trigger best-effort CLOB balance-allowance sync after confirmed claims.
  • Wire Predict pending-claim context into beforeSign and publish.
  • Add skipInitialGasEstimate to claim confirmation batch creation.

Changelog

CHANGELOG entry: Fixed Predict claims for Polymarket Deposit Wallet users.

Related issues

Fixes: PRED-859

Manual testing steps

Feature: Predict Deposit Wallet claim flow

  Scenario: Deposit Wallet user claims resolved positions
    Given a Predict user is routed to a Polymarket Deposit Wallet
    And the user has claimable positions
    When the user starts the claim flow
    Then MetaMask shows the normal claim confirmation
    When the user approves the confirmation
    Then the claim is submitted through the Polymarket Deposit Wallet relayer
    And MetaMask activity tracks the returned transaction hash

  Scenario: legacy Safe user claims resolved positions
    Given a Predict user is routed to a legacy Safe wallet
    And the user has claimable positions
    When the user approves the claim confirmation
    Then the existing Safe claim publish path is used

Screenshots/Recordings

Before

N/A

After

N/A

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Medium Risk
Changes claim transaction beforeSign/publish behavior and introduces a new relayer-based submission path for deposit-wallet users, which could affect transaction lifecycle and activity tracking if metadata or batch matching is wrong.

Overview
Adds deposit-wallet support for Predict claims by intercepting pending predictClaim transactions in PredictController and delegating beforeSign/publish to new provider hooks (beforeSignClaim, publishClaim). Deposit-wallet claims are now marked as externally signed before signing and are published via a Polymarket relayer WALLET batch (planned by new planDepositWalletClaim) while legacy Safe claims continue to pass through.

Claim batch submission is tweaked to set skipInitialGasEstimate and include the MATIC collateral gas token, and confirmClaim now triggers a best-effort deposit-wallet collateral allowance sync after claim confirmation. Tests are expanded/added across PredictController, PolymarketProvider, and new preflight/claim coverage for requirement filtering and call ordering.

Reviewed by Cursor Bugbot for commit c11a3c6. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor

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.

@metamaskbotv2 metamaskbotv2 Bot added the team-predict Predict team label May 8, 2026
@github-actions github-actions Bot added the size-L label May 8, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 73.25581% with 23 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (predict/dw-order-flow@a0abdbe). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...Predict/providers/polymarket/PolymarketProvider.ts 65.90% 12 Missing and 3 partials ⚠️
...onents/UI/Predict/controllers/PredictController.ts 81.81% 3 Missing and 3 partials ⚠️
...UI/Predict/providers/polymarket/preflight/claim.ts 77.77% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@                   Coverage Diff                    @@
##             predict/dw-order-flow   #29936   +/-   ##
========================================================
  Coverage                         ?   81.54%           
========================================================
  Files                            ?     5343           
  Lines                            ?   142148           
  Branches                         ?    32416           
========================================================
  Hits                             ?   115909           
  Misses                           ?    18302           
  Partials                         ?     7937           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@matallui matallui force-pushed the predict/dw-order-flow branch from a0abdbe to 2da0b25 Compare May 8, 2026 20:32
@matallui matallui force-pushed the predict/dw-claim-flow branch from 9b5082a to db218b3 Compare May 8, 2026 20:32
@matallui matallui added the force-builds Forces e2e native builds to trigger label May 8, 2026
@matallui matallui force-pushed the predict/dw-order-flow branch from 2da0b25 to b2bf1ee Compare May 8, 2026 21:46
@matallui matallui force-pushed the predict/dw-claim-flow branch from db218b3 to f96097e Compare May 8, 2026 21:46
@matallui matallui marked this pull request as ready for review May 8, 2026 21:55
@matallui matallui requested a review from a team as a code owner May 8, 2026 21:55
@matallui matallui added skip-sonar-cloud Only used for bypassing sonar cloud when failures are not relevant to the changes. and removed force-builds Forces e2e native builds to trigger labels May 8, 2026
Base automatically changed from predict/dw-order-flow to main May 8, 2026 23:25
@matallui matallui force-pushed the predict/dw-claim-flow branch from f96097e to c11a3c6 Compare May 8, 2026 23:29
@matallui matallui added the force-builds Forces e2e native builds to trigger label May 8, 2026
@matallui matallui enabled auto-merge May 8, 2026 23:55
@github-actions

github-actions Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokePredictions, SmokeWalletPlatform, SmokeConfirmations
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 90%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes are focused on the Predict/Polymarket claim flow:

  1. PredictController.ts: Refactored beforeSign to handle claim transactions via a new getPendingClaimContext helper, implemented publish to delegate to provider.publishClaim for deposit wallet claims, and added skipInitialGasEstimate: true to claim transaction batches.

  2. PolymarketProvider.ts: Added beforeSignClaim and publishClaim methods for deposit wallet claim flows, plus syncDepositWalletBalanceAllowanceForSignerIfNeeded for post-claim balance sync.

  3. preflight/claim.ts: Added planDepositWalletClaim function for building deposit wallet claim calls.

  4. providers/types.ts: Extended PredictProvider interface with new claim-related types and optional methods.

These changes directly affect the claim winnings flow in Predictions (Polymarket), specifically for deposit wallet users. The predict-claim-positions.spec.ts test file is the primary E2E test that validates this flow.

Per tag descriptions:

  • SmokePredictions: Primary tag - claim winnings flow is directly modified
  • SmokeWalletPlatform: Required when selecting SmokePredictions (Trending section integration)
  • SmokeConfirmations: Required when selecting SmokePredictions (opening/closing positions are on-chain transactions; the beforeSign/publish hooks are part of the confirmation flow)

The changes are well-contained within the Predict domain and don't affect core infrastructure, navigation, or other wallet features.

Performance Test Selection:
The changes are business logic modifications to the Predict/Polymarket claim flow (beforeSign/publish hooks, deposit wallet claim planning). These are not UI rendering changes, don't affect list rendering or animations, and don't impact app startup or initialization. No performance tests are warranted.

View GitHub Actions results

@sonarqubecloud

sonarqubecloud Bot commented May 9, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
78.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@matallui matallui added this pull request to the merge queue May 9, 2026
Merged via the queue into main with commit 3751d9a May 9, 2026
152 of 166 checks passed
@matallui matallui deleted the predict/dw-claim-flow branch May 9, 2026 01:09
@github-actions github-actions Bot locked and limited conversation to collaborators May 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

force-builds Forces e2e native builds to trigger size-L skip-sonar-cloud Only used for bypassing sonar cloud when failures are not relevant to the changes. team-predict Predict team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants