feat: cp-7.78.0 support deposit-wallet polymarket withdraw#29953
Conversation
4a62ff7 to
7b3c92f
Compare
0c8771c to
ff34c51
Compare
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
…eStrategy When a Predict withdraw originates from a Polymarket deposit wallet, flag the post-quote transaction with isPolymarketDepositWallet so that @metamask/transaction-pay-controller routes it to PolymarketBridgeStrategy. The deposit-wallet check resolves async via PredictController:getAccountState and runs as a follow-up update so the initial post-quote config setup stays synchronous.
Deposit-wallet withdraws are gas-sponsored by the Polymarket bridge relayer via TransactionPayPublishHook → PolymarketBridgeStrategy. The TransactionController gas-fee-token validation should not gate publish for these transactions, otherwise the 7702 batch path throws 'Gas fee token not found and insufficient native balance' because the simulation does not list pUSD as a supported gas-paying token. Branch on walletType === 'deposit-wallet' from PolymarketProvider's account state and omit gasFeeToken from the addTransactionBatch request for deposit-wallet users. Safe-wallet withdraws keep the existing gasFeeToken: MATIC_CONTRACTS_V2.collateral path.
- Add predictWithdraw to SUMMARY_SECTION_TYPES so the activity row
renders the bridge-style summary block.
- ReceiveSummaryLine: for predictWithdraw, show the destination token
(sourceTokenAddress on the source chain) instead of mUSD.
- SourceHashSummaryLine: for predictWithdraw, render the new
predict_withdraw string ("Withdraw pUSD from Polygon") since the
source leg always burns pUSD on Polygon.
- transactionController dedupe: drop the actionId-based dedupe key.
predictWithdraw produces multiple local transactions per actionId
(deposit-wallet batch + the original wrapper) and they were getting
incorrectly collapsed.
- Locale: add transaction_details.summary_title.predict_withdraw.
- PredictController: comment update PolymarketBridgeStrategy ->
PolymarketStrategy to reflect the core rename.
…ontroller TransactionPayController now accepts a polymarket option holding two callbacks (getDepositWalletAddress, submitDepositWalletBatch) that the controller invokes for the predictWithdraw flow. The Polymarket relayer protocol (signing, transport, polling, busy retry) stays mobile-side and is supplied at controller construction. - polymarket-callbacks.ts: builds the PolymarketCallbacks bag by wrapping the existing depositWallet.ts helpers (deriveDepositWalletAddress, executeDepositWalletBatch, waitForDepositWalletTransaction). Owns the wallet-busy retry loop so all controller-driven batches retry on the relayer's transient 'wallet action in progress' rejections. - transaction-pay-controller-init.ts: passes the callbacks at TransactionPayController construction. - transaction-pay-controller-messenger: delegates KeyringController:signTypedMessage and KeyringController:signPersonalMessage to the init messenger so the callback's inline Signer can call them. The existing PolymarketProvider.ts uses of executeDepositWalletBatch (deposit and claim flows) are unchanged.
…onController init messenger The publish hook running inside TransactionController calls the TransactionPayController:polymarketGetDepositWalletAddress and TransactionPayController:polymarketSubmitDepositWalletBatch actions via its messenger, so the TransactionController init messenger has to delegate them through alongside the existing getDelegationTransaction/getState/getStrategy actions. Also refactor polymarket-callbacks.ts: - Use executeDepositWalletBatchAndWaitForCompletion so the callback waits for the relayer's terminal STATE_MINED/STATE_CONFIRMED before returning the sourceHash. This means by the time Relay polling starts in core, the source tx is already on-chain, and any STATE_FAILED/STATE_INVALID is caught before Relay sees it. - Split each callback into a named private function for readability. - Extract createSigner as a private helper instead of inlining.
The relayer returns errors like:
Polymarket relayer proxy request failed: 400 {"error":"wallet busy: active action exists"}
The previous marker `wallet action` does not appear in that string, so
`isWalletBusyError` returned false and the call rejected on the first
attempt instead of retrying. Match the actual `wallet busy` substring
the relayer emits so the existing 5-attempt / 3s retry loop kicks in.
Also collapse the duplicate `@metamask/keyring-controller` imports into
a single statement to satisfy `no-duplicate-imports` in pre-commit
lint-staged.
e60e82c to
d9d0d29
Compare
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: Performance Test Selection: |
|
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 054697c. Configure here.




Description
Adopts the new Polymarket deposit-wallet support landed in @metamask/transaction-pay-controller@22.5.0 so Polymarket users whose pUSD lives in a deposit wallet (a per-user batch contract on Polygon) can withdraw cross-chain through MetaMask Pay.
Highlights:
Changelog
CHANGELOG entry: null
Related issues
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Performance checks (if applicable)
Pre-merge reviewer checklist
Note
Medium Risk
Changes withdrawal behavior and MetaMask Pay transaction configuration for Polymarket
predictWithdraw, including new controller callbacks and retry logic; mistakes could impact withdraw routing/fees for affected users. Gated by a remote feature flag, limiting blast radius.Overview
Enables Polymarket deposit-wallet users to run
predictWithdrawthrough MetaMask Pay when the newconfirmations_pay_extended.enableDepositWalletWithdrawflag is on; when off, the existing “withdraw unavailable” handling remains.Updates Predict/Pay plumbing for deposit-wallet withdraws:
PredictController.prepareWithdrawnow omitsgasFeeTokenfor deposit-wallet accounts,useTransactionPayPostQuoteskipsrefundToand marksisPolymarketDepositWallet, and Transaction Pay initialization wires new Polymarket callbacks that can derive deposit-wallet addresses and submit deposit-wallet batches (with “wallet busy” retries + keyring signing support).Polishes confirmations activity rendering for
predictWithdrawby adding a dedicatedpredict_withdrawtitle and treating it as a receive-summary type using the source token/network metadata. Tests are added/updated accordingly, and@metamask/transaction-pay-controlleris bumped to22.5.0.Reviewed by Cursor Bugbot for commit 054697c. Bugbot is set up for automated code reviews on this repo. Configure here.