Skip to content

feat: perps / predict withdraw support money account as recipient#30734

Merged
jpuri merged 96 commits into
mainfrom
perps_withdraw_money_acc
Jun 4, 2026
Merged

feat: perps / predict withdraw support money account as recipient#30734
jpuri merged 96 commits into
mainfrom
perps_withdraw_money_acc

Conversation

@jpuri

@jpuri jpuri commented May 28, 2026

Copy link
Copy Markdown
Contributor

Description

Perps and predict withdraw support money account as recipient

Changelog

CHANGELOG entry:

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/CONF-1406

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Screen.Recording.2026-05-29.at.11.12.53.AM.mov

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

High Risk
Changes how money-account payment override builds on-chain deposit/withdraw batches and delegation payloads, which are security- and funds-critical paths.

Overview
Enables perps/predict withdraw flows to treat the money account as the payout destination by extending PaymentOverride.MoneyAccount through post-quote confirmation and pay-token selection.

Confirmation UI: The money-account pay row now uses the withdraw “receive as” label when applicable (aligned with the interactive pay row).

Pay token logic: MoneyAccount override no longer excludes post-quote transactions—switching to money account re-selects MUSD on Monad, including when a preferred token was set for moneyAccountWithdraw post-quote.

Payment override data: Withdraw paths build calldata via buildMoneyAccountWithdrawBatch (vault config, provider, rounded MUSD amount) instead of the legacy withdraw helper. When transactionData.isPostQuote is set, the callback builds a deposit batch (buildMoneyAccountDepositBatch) and returns recipient, authorizationList, and delegation calls so funds land in the primary money account.

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

@github-actions github-actions Bot added risk:medium AI analysis: medium risk and removed risk:high AI analysis: high risk labels Jun 2, 2026
@github-actions github-actions Bot added risk:high AI analysis: high risk and removed risk:medium AI analysis: medium risk labels Jun 2, 2026
@github-actions github-actions Bot added risk:medium AI analysis: medium risk and removed risk:high AI analysis: high risk labels Jun 3, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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 df1f549. Configure here.

@github-actions github-actions Bot added risk:high AI analysis: high risk and removed risk:medium AI analysis: medium risk labels Jun 3, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.46154% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.86%. Comparing base (dd6e274) to head (c3dd64e).

Files with missing lines Patch % Lines
...saction-pay-controller/paymentoverride-callback.ts 91.30% 0 Missing and 2 partials ⚠️
...ions/components/rows/pay-with-row/pay-with-row.tsx 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #30734   +/-   ##
=======================================
  Coverage   82.86%   82.86%           
=======================================
  Files        5570     5570           
  Lines      143557   143578   +21     
  Branches    33299    33302    +3     
=======================================
+ Hits       118960   118982   +22     
+ Misses      16629    16627    -2     
- Partials     7968     7969    +1     

☔ 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

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

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

E2E Test Selection:
The changes are focused on the MetaMask Card/Money Account feature:

  1. paymentoverride-callback.ts (Engine controller): Adds a new deposit path (getMoneyAccountDepositPaymentOverrideData) for isPostQuote transactions, and refactors the withdraw path to use buildMoneyAccountWithdrawBatch. This is a critical file in the transaction-pay-controller that handles EIP-7702 batch transactions for Money Account operations. The function now returns authorizationList and recipient for deposit flows.

  2. useAutomaticTransactionPayToken.ts: Removes the postQuoteTransactionType guard from isMoneyPaymentOverride, meaning MUSD token selection now applies to both withdraw AND deposit (post-quote) flows. This is a behavioral change that affects how the pay token is automatically selected.

  3. pay-with-row.tsx: UI label change - shows "Receive as" instead of "Pay with" when isWithdraw is true in the MoneyAccount payment row in the confirmation screen.

SmokeMoney is selected because these changes directly affect the Card/Money Account Add Funds (Deposit) and withdraw flows, which are core SmokeMoney scenarios.

SmokeConfirmations is selected because:

  • The pay-with-row.tsx is a confirmation screen component
  • The paymentoverride-callback.ts handles EIP-7702 batch transaction construction (advanced account abstraction features explicitly covered by SmokeConfirmations)
  • Per SmokeMoney tag description: "When selecting SmokeMoney for Card Add Funds or similar flows that execute swaps, also select SmokeSwap and SmokeConfirmations"
  • The deposit/withdraw flows involve on-chain transactions that go through the confirmation UI

No other tags are needed as the changes are scoped to Money Account/Card functionality and the confirmation layer, with no impact on swaps, staking, network management, accounts, or other areas.

Performance Test Selection:
No performance-sensitive changes detected. The modifications are focused on business logic for Money Account deposit/withdraw flows (new function, refactored batch transaction building) and a UI label change. There are no changes to list rendering, app startup, Redux state structure, or other performance-critical paths that would warrant performance testing.

View GitHub Actions results

@OGPoyraz OGPoyraz requested a review from dan437 June 3, 2026 15:00
@jpuri jpuri added this pull request to the merge queue Jun 4, 2026
Merged via the queue into main with commit 1566844 Jun 4, 2026
304 of 308 checks passed
@jpuri jpuri deleted the perps_withdraw_money_acc branch June 4, 2026 08:59
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 4, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.81.0 Issue or pull request that will be included in release 7.81.0 label Jun 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed release-7.81.0 Issue or pull request that will be included in release 7.81.0 risk:high AI analysis: high risk size-M team-confirmations Push issues to confirmations team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants