feat(predict): add deposit wallet deposit foundation#29917
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. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## predict/dw-confirmation-hooks #29917 +/- ##
================================================================
Coverage ? 81.41%
================================================================
Files ? 5309
Lines ? 141008
Branches ? 32096
================================================================
Hits ? 114800
Misses ? 18344
Partials ? 7864 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
7c87db3 to
61b290a
Compare
The base branch was changed.
61b290a to
4a42a4a
Compare
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 3da3ea8. Configure here.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: Key changes:
SmokePredictions is the primary tag - these changes directly affect the Polymarket deposit flow, account state detection, and position lifecycle (opening positions requires deposits). Per SmokePredictions tag description: "When selecting SmokePredictions, also select SmokeWalletPlatform (Trending section) and SmokeConfirmations (opening/closing positions are on-chain transactions)." No changes to shared infrastructure (navigation, Engine, controllers outside Predict, etc.) so other tags are not warranted. Performance Test Selection: |
|



Description
This is PR 2 for the Predict Deposit Wallet migration and is temporarily opened against
predict/dw-confirmation-hooksto accelerate review while PR 1 is reviewed. Once PR 1 merges, this PR should be rebased/retargeted tomain.Polymarket migrated new API users from the legacy Safe/proxy wallet model to deterministic Deposit Wallets. This PR adds the shared Predict Deposit Wallet foundation and enables the deposit flow while preserving legacy Safe behavior for users with existing Polymarket activity.
Included changes:
walletTypeto Predict account state and routes users by legacy Safe activity:beforePublish.Validation performed:
yarn jest app/components/UI/Predict/providers/polymarket/depositWallet.test.ts app/components/UI/Predict/providers/polymarket/preflight/legacySafeMigration.test.ts app/components/UI/Predict/providers/polymarket/preflight/depositWallet.test.ts app/components/UI/Predict/providers/polymarket/preflight/v2AllowanceRequirements.test.ts app/components/UI/Predict/providers/polymarket/PolymarketProvider.test.ts app/components/UI/Predict/controllers/PredictController.test.ts app/components/UI/Predict/hooks/usePredictAccountState.test.ts --runInBand --forceExityarn lint:tscChangelog
CHANGELOG entry: Added support for Polymarket Deposit Wallet deposits in Predict
Related issues
Fixes: PRED-858
Manual testing steps
Screenshots/Recordings
N/A — core/provider flow changes covered by tests and manual wallet-flow validation.
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
Note
High Risk
High risk because it changes how Predict chooses deposit addresses and adds new pre-publish relayer/batch execution plus post-confirm sync, which directly affects deposit and deposit+order transaction flows and fund routing.
Overview
Adds first-class support for Polymarket Deposit Wallet accounts in Predict by extending
AccountStatewithwalletTypeand routing users to either legacy Safe or a deterministic deposit wallet based on legacy Safe deployment and Polymarket Activity API results (failing closed on API errors).Implements deposit-wallet infrastructure in the Polymarket provider: deterministic address derivation, relayer proxy calls/polling, EIP-712 batch execution, allowance-preflight planning (excluding Permit2), and a legacy Safe “sweep” preflight to migrate stranded USDC.e/pUSD to the deposit wallet.
Updates the deposit pipeline to (1) build deposits targeting the deposit wallet (with optional sweep), (2) run a new
beforePublishdeposit-wallet preflight to ensure wallet deployment and required allowances, and (3) on confirmed deposits/deposit+order, invalidate cached account state and best-effort sync CLOB balance/allowance—waiting for that sync before placing the follow-on order.Reviewed by Cursor Bugbot for commit c5f61e2. Bugbot is set up for automated code reviews on this repo. Configure here.