Skip to content

[pull] main from MetaMask:main#798

Merged
pull[bot] merged 1 commit into
Reality2byte:mainfrom
MetaMask:main
May 30, 2026
Merged

[pull] main from MetaMask:main#798
pull[bot] merged 1 commit into
Reality2byte:mainfrom
MetaMask:main

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented May 30, 2026

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

…ds" action (#30713)

## **Description**

Modifies the Money Hub "Deposit Funds" flow to use `initiateDeposit`
with auto-fiat-selection instead of the Ramps `goToBuy` flow. When the
user taps "Deposit Funds" in the Add Money sheet, the confirmation
screen now auto-selects the first available fiat payment method
(bank/card) rather than showing the crypto token selector.

**Key implementation details:**

- Extended `useAutomaticTransactionPayToken` to handle fiat
auto-selection atomically: when `autoSelectFiatPayment` is true, the
hook waits for Ramps payment methods to load, then calls
`updateFiatPayment` without calling `setPayToken` (since
`updatePaymentToken` resets `fiatPayment` to `{}` in the controller).
- All three effects in `useAutomaticTransactionPayToken` are guarded
with `hasFiatPaymentSelected` to prevent any instance of the hook from
calling `setPayToken` when a fiat payment method is active — this
protects against the second instance in `usePayWithPreferredToken` (used
by the pay-with bottom sheet) from wiping the fiat selection.
- The "Deposit Funds" option is gated on the `confirmations_pay_fiat`
remote feature flag including `moneyAccountDeposit` in
`enabledTransactionTypes`.

## **Changelog**

CHANGELOG entry: null

## **Related issues**

Fixes:

## **Manual testing steps**

```gherkin
Feature: Auto-select fiat payment for money account deposits

  Scenario: user deposits funds via fiat payment
    Given the user is on the Money Hub with moneyAccountDeposit enabled in confirmations_pay_fiat feature flag
    When user taps "Add funds" then "Deposit funds"
    Then the confirmation screen shows with fiat payment method pre-selected (no crypto token flicker)
    And the PayAccountSelector and percentage buttons are hidden initially

  Scenario: user switches from fiat to crypto payment
    Given the confirmation screen shows with fiat payment method pre-selected
    When user taps the "Pay with" row and selects a crypto token
    Then the PayAccountSelector appears
    And percentage buttons appear
    And the selected crypto token is shown in the Pay with row

  Scenario: deposit funds hidden when feature flag is off
    Given moneyAccountDeposit is NOT in the confirmations_pay_fiat enabledTransactionTypes
    When user opens the Add Money sheet
    Then the "Deposit funds" option is not shown
```

## **Screenshots/Recordings**

### **Before**



https://github.com/user-attachments/assets/31d85902-70b1-46d4-b987-1aaefb8d7ee8



### **After**



https://github.com/user-attachments/assets/09fd4583-3a21-4c2b-a819-464d5ae52458



## **Pre-merge author checklist**

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

#### 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](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/edit-v2/401401446401?draftShareId=9d77e1e1-4bdc-4be1-9ebb-ccd916988d93)
to import wallets with many accounts and tokens
- [ ] I've instrumented key operations with Sentry traces for production
performance metrics
- See [`trace()`](/app/util/trace.ts) for usage and
[`addToken`](/app/components/Views/AddAsset/components/AddCustomToken/AddCustomToken.tsx#L274)
for an example

For performance guidelines and tooling, see the [Performance
Guide](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/400085549067/Performance+Guide+for+Engineers).

## **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.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes payment routing and Transaction Pay fiat/token selection for
money account deposits; mitigated by feature flags and tests, but
affects funds-in UX and controller state.
> 
> **Overview**
> Money Hub **Deposit funds** now routes through `initiateDeposit` with
**`autoSelectFiatPayment`** instead of the Ramps buy flow, and the sheet
only shows that option when **`confirmations_pay_fiat`** includes
`moneyAccountDeposit`.
> 
> On the money-account deposit confirmation screen,
**`autoSelectFiatPayment`** is threaded from navigation params into
**`useAutomaticTransactionPayToken`**, which picks the first eligible
Ramps payment method (respecting max delay) via **`updateFiatPayment`**
and skips **`setPayToken`** so fiat selection is not cleared.
**`CustomAmountInfo`** can hide the account selector and percentage
shortcuts until the user switches to crypto, and hook effects bail out
when a fiat method is already selected.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
1737fd5. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
@pull pull Bot locked and limited conversation to collaborators May 30, 2026
@pull pull Bot added the ⤵️ pull label May 30, 2026
@pull pull Bot merged commit 3a51914 into Reality2byte:main May 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant