Skip to content

chore(runway): cherry-pick feat: support deposit-wallet polymarket withdraw#30265

Open
runway-github[bot] wants to merge 5 commits into
release/7.77.0from
cherry-pick-7-77-0-4997055
Open

chore(runway): cherry-pick feat: support deposit-wallet polymarket withdraw#30265
runway-github[bot] wants to merge 5 commits into
release/7.77.0from
cherry-pick-7-77-0-4997055

Conversation

@runway-github
Copy link
Copy Markdown
Contributor

@runway-github runway-github Bot commented May 15, 2026

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:

  • Lets Polymarket deposit-wallet users withdraw cross-chain through
    MetaMask Pay.
  • Gated behind a new remote feature flag, with the existing "withdraw
    unavailable" sheet preserved when off.
  • Polishes Predict withdraw activity rendering.

Changelog

CHANGELOG entry: null

Related issues

Manual testing steps

Feature: Polymarket deposit-wallet withdraw

  Scenario: deposit-wallet user with the flag on
    Given enableDepositWalletWithdraw is on
    And the user has a Polymarket deposit wallet with pUSD balance on Polygon
    When the user taps Withdraw on the Predict balance
    Then the standard Pay confirmation opens
    And confirming submits via the Polymarket strategy with no Polygon gas

  Scenario: deposit-wallet user with the flag off
    Given enableDepositWalletWithdraw is off
    When the user taps Withdraw on the Predict balance
    Then the existing "Withdraw unavailable" sheet is shown

Screenshots/Recordings

Before

After

Activity

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
  • I've tested with a power user scenario
  • I've instrumented key operations with Sentry traces for production
    performance metrics

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 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 predictWithdraw
through MetaMask Pay when the new
confirmations_pay_extended.enableDepositWalletWithdraw flag is on;
when off, the existing “withdraw unavailable” handling remains.

Updates Predict/Pay plumbing for deposit-wallet withdraws:
PredictController.prepareWithdraw now omits gasFeeToken for
deposit-wallet accounts, useTransactionPayPostQuote skips refundTo
and marks isPolymarketDepositWallet, 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 predictWithdraw by
adding a dedicated predict_withdraw title and treating it as a
receive-summary type using the source token/network metadata. Tests are
added/updated accordingly, and @metamask/transaction-pay-controller is
bumped to 22.5.0.

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

[4997055](https://github.com/MetaMask/metamask-mobile/commit/4997055ba34a24c404b34d249d48474304656bfb)

@runway-github runway-github Bot requested review from a team as code owners May 15, 2026 15:52
@metamaskbotv2 metamaskbotv2 Bot added the team-bots Bot team (for MetaMask Bot, Runway Bot, etc.) label May 15, 2026
Adopts the new Polymarket deposit-wallet support landed in
[@metamask/transaction-pay-controller@22.5.0](MetaMask/core#8754)
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:

- Lets Polymarket deposit-wallet users withdraw cross-chain through
MetaMask Pay.
- Gated behind a new remote feature flag, with the existing "withdraw
unavailable" sheet preserved when off.
- Polishes Predict withdraw activity rendering.

CHANGELOG entry: null

<!-- Internal -->

```gherkin
Feature: Polymarket deposit-wallet withdraw

  Scenario: deposit-wallet user with the flag on
    Given enableDepositWalletWithdraw is on
    And the user has a Polymarket deposit wallet with pUSD balance on Polygon
    When the user taps Withdraw on the Predict balance
    Then the standard Pay confirmation opens
    And confirming submits via the Polymarket strategy with no Polygon gas

  Scenario: deposit-wallet user with the flag off
    Given enableDepositWalletWithdraw is off
    When the user taps Withdraw on the Predict balance
    Then the existing "Withdraw unavailable" sheet is shown
```

<img width="300" alt="Activity"
src="https://github.com/user-attachments/assets/13d5a0e9-a39d-4c0a-9fde-468c5a0a7743"
/>

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable
- [x] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

- [ ] I've tested on Android
- [ ] I've tested with a power user scenario
- [ ] I've instrumented key operations with Sentry traces for production
performance metrics

- [ ] 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.

<!-- CURSOR_SUMMARY -->
---

> [!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 `predictWithdraw`
through MetaMask Pay when the new
`confirmations_pay_extended.enableDepositWalletWithdraw` flag is on;
when off, the existing “withdraw unavailable” handling remains.
>
> Updates Predict/Pay plumbing for deposit-wallet withdraws:
`PredictController.prepareWithdraw` now omits `gasFeeToken` for
deposit-wallet accounts, `useTransactionPayPostQuote` skips `refundTo`
and marks `isPolymarketDepositWallet`, 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 `predictWithdraw` by
adding a dedicated `predict_withdraw` title and treating it as a
receive-summary type using the source token/network metadata. Tests are
added/updated accordingly, and `@metamask/transaction-pay-controller` is
bumped to `22.5.0`.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
054697c. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
@matallui matallui force-pushed the cherry-pick-7-77-0-4997055 branch from a9bbef3 to 72cf037 Compare May 15, 2026 16:54
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 60.27397% with 29 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (release/7.77.0@3e598ba). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...transaction-pay-controller/polymarket-callbacks.ts 11.53% 23 Missing ⚠️
...ction-details-summary/source-hash-summary-line.tsx 78.57% 0 Missing and 3 partials ⚠️
...ansaction-details-summary/receive-summary-line.tsx 88.23% 0 Missing and 2 partials ⚠️
...edict/components/PredictBalance/PredictBalance.tsx 50.00% 1 Missing ⚠️
Additional details and impacted files
@@                Coverage Diff                @@
##             release/7.77.0   #30265   +/-   ##
=================================================
  Coverage                  ?   43.05%           
=================================================
  Files                     ?     5334           
  Lines                     ?   141836           
  Branches                  ?    32344           
=================================================
  Hits                      ?    61074           
  Misses                    ?    74975           
  Partials                  ?     5787           

☔ 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.

@github-actions
Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

⏭️ Smart E2E selection skipped - PR targets a release branch (release/*)

All E2E tests pre-selected.

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size-L team-bots Bot team (for MetaMask Bot, Runway Bot, etc.)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants