[pull] main from MetaMask:main#385
Merged
Merged
Conversation
…ebounce for old orders cp-7.61.0 (#23427) ## **Description** This PR fixes a bug where the Stop Loss banner was not displaying at the correct Return on Equity (ROE) threshold, and adds an enhancement to bypass the debounce delay for established positions. ## **Changelog** CHANGELOG entry: Fixed Stop Loss banner to display at -10% ROE instead of -20% ROE and skip debounce for old orders ## **Related issues** Jira issue: https://consensyssoftware.atlassian.net/browse/TAT-2163 Fixes #23473 ## **Manual testing steps** ```gherkin Feature: Stop Loss Banner Display Scenario: user has position with -10% ROE Given user has an open Perps position And position ROE is between -10% and -20% And liquidation distance is greater than 3% And position has no existing stop loss set And ROE has been below -10% for at least 60 seconds When user views the position details Then Stop Loss prompt banner should be displayed And banner should suggest setting a stop loss ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** N/A <!-- [screenshots/recordings] --> ### **After** N/A <!-- [screenshots/recordings] --> ## **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. ## **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] > Stop-loss prompt now triggers at -10% ROE and skips debounce for positions >2 minutes old using order fills; integrated into market details view with updated tests. > > - **Perps Stop-Loss Prompt Logic**: > - Update `STOP_LOSS_PROMPT_CONFIG.ROE_THRESHOLD` to `-10` in `constants/perpsConfig.ts`. > - Enhance `useStopLossPrompt`: > - Add `positionOpenedTimestamp` param and bypass 60s debounce when ROE below threshold and position age ≥ 2 minutes. > - Add `finishDebounce` helper and `hasBeenShownRef` to show once per position lifecycle; reset appropriately. > - **View Integration**: > - In `PerpsMarketDetailsView.tsx`, fetch fills via `usePerpsOrderFills`, compute `positionOpenedTimestamp` from latest matching "Open" fill, and pass to `useStopLossPrompt`. > - **Tests**: > - Extend `useStopLossPrompt.test.ts` for new threshold and debounce-bypass behavior, including edge cases and priority rules. > - In `PerpsMarketDetailsView.test.tsx`, mock `usePerpsOrderFills` and add test verifying position opened timestamp computation. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit cf3a2a9. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->
## **Description**
Updates mUSD conversion toasts to match the latest design
specifications.
### UI Changes
- **In-progress toast**: Now displays a token icon with an animated
spinning gradient ring, shows "Converting {token} → mUSD" with an
estimated time (~15 seconds)
- **Success toast**: Updated to show "Your mUSD has been delivered!"
with a green checkmark icon
- **Failed toast**: Updated to use `CircleX` icon for error state
- Added close button to all toasts for manual dismissal
### Behavioral Changes
- Changed in-progress toast trigger from `TransactionStatus.submitted`
to `TransactionStatus.approved` to show immediately after user confirms
- Added token symbol and icon lookup using `metamaskPay` transaction
metadata
- After confirmation, navigates user to wallet home screen
- Excluded `musdConversion` transactions from standard notification
system (toasts handle this)
### Technical Changes
- Created `TokenIconWithSpinner` component with custom SVG-based
gradient spinner using `react-native-reanimated`
- `inProgress` toast option changed from static object to function
accepting `{ tokenSymbol, tokenIcon, estimatedTimeSeconds }`
- Added `formatEstimatedTime` utility for human-readable ETA display
## Manual Testing Steps
1. Initiate an mUSD conversion transaction
2. Confirm the transaction
3. Verify in-progress toast appears immediately with token icon +
spinner
4. Verify success toast appears when transaction confirms
5. Test failure scenarios (rejected/dropped transactions)
Note: there are some intermittent issues with conversion at the moment
but they are outside the scope of this PR. If needed, test manually to
see what the notification toasts would be in cases.
<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->
## **Changelog**
<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`
If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`
(This helps the Release Engineer do their job more quickly and
accurately)
-->
CHANGELOG entry: null
## **Related issues**
Fixes: https://consensyssoftware.atlassian.net/browse/MUSD-102
## **Manual testing steps**
```gherkin
Feature: mUSD Conversion Toasts
Scenario: In-progress toast appears when user confirms transaction
Given I initiated an mUSD conversion
When my transaction status changes to "approved"
Then I see a toast with token icon, spinner, and "Converting {token} → mUSD"
Scenario: Success toast appears when transaction confirms
Given my mUSD conversion is in progress
When my transaction status changes to "confirmed"
Then I see a toast showing "Your mUSD has been delivered!"
And I am navigated to wallet home
Scenario: Failed toast appears when transaction fails
Given my mUSD conversion is in progress
When my transaction status changes to "failed"
Then I see a toast showing "mUSD conversion failed"
Scenario: Non-mUSD transactions do not show conversion toasts
Given I have a swap transaction
When my transaction status changes
Then I do not see any mUSD conversion toasts
```
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<!-- [screenshots/recordings] -->
### **After**
<!-- [screenshots/recordings] -->
https://github.com/user-attachments/assets/62e8c78f-dd4f-41f3-984f-6b9fb7247e47
## **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.
## **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]
> Overhauls mUSD conversion toasts to show a token icon with a rotating
gradient spinner and ETA (triggered on approved), adds close buttons,
fetches token/icon/ETA from state, navigates to Wallet Home
post-confirmation, and excludes these txs from standard notifications.
>
> - **UI/Components**:
> - Add `TokenIconWithSpinner` (SVG + reanimated gradient ring) used as
toast `startAccessory`.
> - **Hooks/Toasts**:
> - Refactor `useEarnToasts`:
> - `mUsdConversion.inProgress` now a function accepting `{ tokenSymbol,
tokenIcon, estimatedTimeSeconds }`.
> - Uses `IconName.Confirmation`/`CircleX`, new colors, close button,
and ETA via `descriptionOptions`.
> - Update `useMusdConversionStatus`:
> - Trigger in-progress toast on `TransactionStatus.approved`.
> - Resolve token symbol/icon from `metamaskPay` + token
cache/`getAssetImageUrl`; read ETA from `TransactionPayController`
(`selectTransactionPayTransactionData`).
> - Duplicate prevention and cleanup adjusted for `approved` flow.
> - **Navigation/Notifications**:
> - `useTransactionConfirm`: navigate to `Routes.WALLET.HOME` after
`TransactionType.musdConversion` confirm.
> - `NotificationManager`: skip notifications for
`TransactionType.musdConversion`.
> - **State/Selectors**:
> - Add `selectTransactionPayTransactionData` to expose transaction pay
data map.
> - **i18n**:
> - Replace toasts copy with `earn.musd_conversion.toasts.converting`,
`eta`, `delivered`, `failed`.
> - **Tests**:
> - Comprehensive updates for new toast API, spinner accessory,
approved-status trigger, selector-driven token/icon/ETA, close button,
and navigation behavior.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
57a0cae. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Updates the mUSD confirmation screen's header to display the mUSD token and target network icon. <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: updated the mUSD confirmation screen's header to display the mUSD token and target network icon. ## **Related issues** Fixes: [MUSD-134: Update mUSD Conversion Screen Header](https://consensyssoftware.atlassian.net/browse/MUSD-134) ## **Manual testing steps** ```gherkin Feature: Updated mUSD confirmation screen header Scenario: user wants to convert supported stablecoins to mUSD Given user has stablecoins to convert When user visits the mUSD conversion confirmation screen Then the updated header displays the mUSD icon with the target network. Then the updated header displays "Convert to mUSD" ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> The mUSD conversion header displayed "Earn rewards with mUSD" ### **After** <!-- [screenshots/recordings] --> https://www.loom.com/share/0fb8bc1a18a84cf9a0adcfad3ac5ef06 ## **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. ## **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] > Adds a dedicated mUSD conversion header with token/network badge, enables per-chain mUSD conversion, and updates hooks, routes, UI, tests, and strings. > > - **UI/Navigation**: > - Add `getMusdConversionNavbarOptions` with mUSD token icon + network badge and back button; integrate into `EarnScreenStack` `REDESIGNED_CONFIRMATIONS` options to avoid flicker. > - **Hooks/Flow**: > - Extend `useMusdConversionTokens` with `isMusdSupportedOnChain`; export and use in `StakeButton` to validate chain and set `outputChainId` to asset chain; improved error handling. > - **Constants**: > - Expand `MUSD_TOKEN_ADDRESS_BY_CHAIN` and `MUSD_TOKEN_ASSET_ID_BY_CHAIN` to include Linea and BSC. > - **Confirmations**: > - Update button label to `earn.musd_conversion.convert_to_musd` in `custom-amount-info`. > - Refactor `MusdConversionInfo` to use `outputChainId` param, remove navbar hook, and auto-add mUSD token per chain. > - **CTA/Components**: > - Minor cleanup in `MusdConversionAssetListCta`; maintain default `outputChainId` usage. > - **Tests**: > - Add unit tests for navbar options; update tests across Earn/Stake to mock `isMusdSupportedOnChain` and new behaviors. > - **i18n**: > - Replace `confirmation_button`/`earn_rewards_with` with `earn.musd_conversion.convert_to_musd`; keep related copy consistent. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 99947c2. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
## **Description**
This PR updates the copy text in the "escape hatch" modals that allow
users to switch between the Aggregator (classic) and Deposit (new) buy
experiences.
**Reason for change:**
The current copy text ("Use new buy experience" / "Try new native on
ramp" and "More ways to buy" / "Use a different payment provider") was
confusing users about the action being performed. Users didn't realize
they were switching to a completely different feature/experience.
**Solution:**
Updated the modal copy to be clearer about switching between versions:
- **Aggregator → Native (Deposit):** "More ways to buy" / "Switch to the
new version"
- **Native (Deposit) → Aggregator:** "More ways to buy" / "Switch to the
classic version"
## **Changelog**
CHANGELOG entry: Improved clarity of the "More ways to buy" modal copy
when switching between buy experiences
## **Related issues**
Fixes: https://consensyssoftware.atlassian.net/browse/TRAM-2858
Fixes #23716
## **Manual testing steps**
```gherkin
Feature: More ways to buy escape hatch copy
Scenario: user views escape hatch modal from Aggregator (classic) experience
Given user is in the Aggregator buy flow
When user opens the settings modal
Then user sees "More ways to buy" with description "Switch to the new version"
Scenario: user views escape hatch modal from Deposit (new) experience
Given user is in the Deposit buy flow
When user opens the configuration modal
Then user sees "More ways to buy" with description "Switch to the classic version"
```
## **Screenshots/Recordings**
### **Before**
| Aggregator | Deposit |
|:--:|:--:|
| <img width="299" alt="before_agg"
src="https://github.com/user-attachments/assets/5a01ef8b-7cad-4c2e-a149-c43cc4b6aec2"
/> | <img width="299" alt="before_deposit"
src="https://github.com/user-attachments/assets/f4f88802-f42d-4cf6-ae2f-61e95ad9dbae"
/> |
### **After**
| Aggregator | Deposit |
|:--:|:--:|
| <img width="299" alt="after_agg"
src="https://github.com/user-attachments/assets/9b05bdb7-bae8-427c-bc3d-153fb82d895c"
/> | <img width="299" alt="after_deposit"
src="https://github.com/user-attachments/assets/9ec3e323-0e58-4c98-875d-219cdddba271"
/> |
## **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.
## **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.
---
You can drop your 4 screenshots in the Before/After sections where I've
left the placeholders!
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Updates copy and tests for the buy experience switcher: “More ways to
buy” with “Switch to the new version” (Aggregator) and “Switch to the
classic version” (Deposit).
>
> - **UI copy updates**
> - `fiat_on_ramp_aggregator.settings_modal`:
> - `use_new_buy_experience` → `More ways to buy`
> - Description → `Switch to the new version`
> - `deposit.configuration_modal`:
> - `more_ways_to_buy_description` → `Switch to the classic version`
> - **Tests & snapshots**
> - Update `SettingsModal.test.tsx` and related snapshots to assert new
labels and descriptions.
> - Update `ConfigurationModal` snapshot to reflect new description.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
faecee2. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## **Description** Updates `github-tools` to v1.1.3 in release workflows. ### Changes - Updated `update-release-changelog.yml` to use `github-tools@v1.1.3` ### What's included in v1.1.3 - **Fixed**: Prevent changelog PR creation when branches are in sync ([#177](MetaMask/github-tools#177)) See [github-tools v1.1.3 release notes](https://github.com/MetaMask/github-tools/releases/tag/v1.1.3). ## **Changelog** CHANGELOG entry: null ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/INFRA-3167 ## **Manual testing steps** ```gherkin Feature: Release changelog workflow Scenario: Workflow uses updated github-tools version Given the workflow configuration is updated When a release branch receives a push Then the workflow uses github-tools v1.1.3 ``` ## **Screenshots/Recordings** N/A - workflow configuration change only ### **Before** N/A ### **After** N/A ## **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. ## **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.
## **Description** Disable tokens in asset picker for MetaMask Pay if there is no native balance and gas station is not supported. ## **Changelog** CHANGELOG entry: Disable token selection in Perps and Predict deposits if no native balance and gas station not supported ## **Related issues** Fixes: [#6361](MetaMask/MetaMask-planning#6361) ## **Manual testing steps** ## **Screenshots/Recordings** ### **Before** ### **After** ## **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. ## **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] > Disables MetaMask Pay asset-picker tokens when no native balance unless allowed by gas station feature flags, adding selector support and tests. > > - **Confirmations utils**: > - Enhance `getAvailableTokens` to mark tokens as `disabled` with `disabledMessage` when no native balance and token isn’t supported by gas station; keep selection/required-token behavior. Uses `store`, new `selectGasFeeTokenFlags`, and `strings('pay_with_modal.no_gas')`. > - Add helper to compute supported gas-fee tokens per `chainId`. > - **Feature flags**: > - Add `GasFeeTokenFlags` type and `selectGasFeeTokenFlags` selector in `selectors/featureFlagController/confirmations`. > - Strengthen `selectMetaMaskPayFlags` typing. > - **Tests**: > - Update `transaction-pay.test.ts` to cover disabled/enabled cases (native balance present/absent, gas station support) and mock store/selector. > - Update `pay-with-modal.test.tsx` to mock `getAvailableTokens` instead of `useAccountTokens` and remove mUSD allowlist token filtering tests. > - Update `useTransactionPayAvailableTokens.test.ts` to mock `getAvailableTokens` and expect returned tokens. > - Add tests for `selectGasFeeTokenFlags` selector behavior. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 5222012. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
## **Description** Bump controller versions to improve accuracy of provider and network fees in Perps and Predict deposits. ## **Changelog** CHANGELOG entry: Improved accuracy of provider and network fees in Perps and Predict deposits ## **Related issues** Fixes: #23698 [#6394](MetaMask/MetaMask-planning#6394) ## **Manual testing steps** ## **Screenshots/Recordings** ### **Before** ### **After** ## **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. ## **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] > Updates MetaMask controller dependencies, notably `@metamask/transaction-controller` to 62.5.0 and `@metamask/transaction-pay-controller` to 10.4.0, plus aligned assets/network/bridge packages and remote feature flag controller. > > - **Dependencies**: > - **Transactions**: > - Update `@metamask/transaction-controller` to `62.5.0` (patch resolution and lockfile). > - Update `@metamask/transaction-pay-controller` to `^10.4.0`. > - **Assets/Network/Bridge**: > - Bump `@metamask/assets-controllers` to `^93.1.0`. > - Bump `@metamask/network-controller` to `^27.0.0`. > - Bump `@metamask/bridge-controller` to `^64.0.0` and `@metamask/bridge-status-controller` to `^64.0.1`. > - **Feature Flags**: > - Align `@metamask/remote-feature-flag-controller` to `^3.0.0` where referenced. > - Update `yarn.lock` to reflect the above version changes and dependency realignments. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit c7552f6. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->
## **Description**
This PR implements the `navigateToInternalBrowserPage` method in the
`useNavigateToCardPage` hook to support navigation to Card, Travel, and
Terms of Service (TOS) pages with proper URL verification and analytics
tracking.
**Key changes:**
1. Created `CardInternalBrowserPage` enum to define the three page
types: `CARD`, `TRAVEL`, and `TOS`
2. Implemented `PAGE_CONFIG` mapping that associates each page type with
its URL check function, URL getter, and analytics action
3. For Card and Travel pages: navigates to the internal browser, reusing
existing tabs when available
4. For TOS page: opens the URL externally using `Linking.openURL` (PDF
document)
5. Added convenience wrapper functions (`navigateToCardPage`,
`navigateToTravelPage`, `navigateToCardTosPage`) via
`useNavigateToCardPage` hook
6. Connected Travel and TOS navigation to their respective UI elements
in `CardHome`
7. Added comprehensive unit test coverage for all navigation scenarios
## **Changelog**
CHANGELOG entry: Implement MM Travel and ToS links on Card Home
## **Related issues**
Fixes:
## **Manual testing steps**
```gherkin
Feature: Card internal page navigation
Scenario: user navigates to Card page
Given user is on the Card Home screen
When user taps on the Advanced Card Management item
Then the Card page opens in the internal browser
Scenario: user navigates to Travel page
Given user is on the Card Home screen
When user taps on the Travel item
Then the Travel page opens in the internal browser
Scenario: user navigates to Card TOS page
Given user is on the Card Home screen and authenticated
When user taps on the Card Terms of Service item
Then the TOS PDF opens in the device's default PDF viewer/browser
```
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<!-- [screenshots/recordings] -->
### **After**
<!-- [screenshots/recordings] -->
#### Non-authenticated (only MM Travel)
<img width="300" height="900" alt="Simulator Screenshot - iPhone 16 -
2025-12-02 at 13 35 47"
src="https://github.com/user-attachments/assets/cda55257-b954-43f0-b1b7-6de6aa315dab"
/>
#### Authenticated (MM Travel + ToS)
https://github.com/user-attachments/assets/542a6847-8972-4eba-8b7a-8e6854cead31
## **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.
## **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]
> Adds internal browser navigation for Card and Travel plus external ToS
linking, wires new actions into Card Home, and updates URLs, metrics,
selectors, locales, and tests.
>
> - **Card Home UI (`CardHome.tsx`)**:
> - Add "MetaMask Travel" and "Card Terms and Conditions" list items
with `navigateToTravelPage` and `navigateToCardTosPage` handlers; keep
existing advanced management item.
> - Gate ToS item behind authentication; update tests and snapshots.
> - **Navigation Hook (`useNavigateToCardPage.tsx`)**:
> - Introduce `useNavigateToInternalBrowserPage` with
`CardInternalBrowserPage` enum and `PAGE_CONFIG` to open Card/Travel in
internal browser (reuse existing tab) and ToS via `Linking.openURL`.
> - Expose `navigateToCardPage`, `navigateToTravelPage`,
`navigateToCardTosPage`; track `CARD_BUTTON_CLICKED` with new
`CardActions`.
> - Add comprehensive unit tests for tab reuse, analytics, and edge
cases.
> - **URL Utilities (`app/util/url`)**:
> - Add `isCardTravelUrl` and `isCardTosUrl` (with logging) alongside
`isCardUrl`; extend tests.
> - **Constants/Selectors/Locales**:
> - Add `CARD.TRAVEL_URL` and `CARD.CARD_TOS_URL` in `AppConstants`.
> - Add e2e selectors for `travel-item` and `card-tos-item`.
> - Add i18n strings for Travel and Card ToS labels/descriptions.
> - **Metrics**:
> - Add `NAVIGATE_TO_TRAVEL_PAGE`, `NAVIGATE_TO_CARD_TOS_PAGE`,
`NAVIGATE_TO_CARD_PAGE` actions.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
e924cd6. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
…t tests (#23709) <!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> - Disable predict feature in main feature flag mock - Suppress predict modal as this can cause other tests to fail <img width="409" height="913" alt="Screenshot 2025-12-05 at 10 27 20" src="https://github.com/user-attachments/assets/001e7b1e-a3f5-4a63-81c1-5cb4086e11fb" /> ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: ## **Related issues** Fixes: ## **Manual testing steps** ```gherkin 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** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **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 - [ ] I’ve included tests if applicable - [ ] 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. ## **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] > Adds a disabled Predict GTM onboarding modal flag to mocks and sets CI env to suppress the modal, keeping Predict trading disabled by default. > > - **E2E API Mocks**: > - Add `predictGtmOnboardingModalEnabled` (disabled; `minimumVersion: '7.60.0'`) to `DEFAULT_FEATURE_FLAGS_ARRAY` in `e2e/api-mocking/helpers/remoteFeatureFlagsHelper.ts` and to `remoteFeatureFlagPredictEnabled` in `e2e/api-mocking/mock-responses/feature-flags-mocks.ts`. > - Ensure `predictTradingEnabled` remains disabled by default in mocks. > - **CI Workflows**: > - Set `MM_PREDICT_GTM_MODAL_ENABLED: 'false'` in `/.github/workflows/build-android-e2e.yml` and `/.github/workflows/build-ios-e2e.yml` to suppress the modal during E2E builds. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit a737aac. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
…3679) <!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Fixes this: Cannot read property toLowerCase of undefined. ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: Fixes this: Cannot read property toLowerCase of undefined ## **Related issues** Fixes: #23533 ## **Manual testing steps** ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] 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). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] 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. ## **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] > Adds support for extracting the recipient from ERC-721 `safeTransferFrom` transactions and adds a unit test to verify it. > > - **Hooks**: > - Update `useTransferRecipient` to handle `TransactionType.tokenMethodSafeTransferFrom`, parsing the recipient from transaction `data`. > - **Tests**: > - Add `NFT safeTransferFrom` case in `useTransferRecipient.test.ts` to assert correct recipient extraction. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit c850fab. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Signed-off-by: dan437 <80175477+dan437@users.noreply.github.com>
…lance cp-7.61.0 (#23719) ## **Description** The `useBalance` hook in the Ramp Aggregator was using `selectContractBalances`, which returns token balances only for the **currently selected network**. This caused incorrect behavior. **Solution:** Changed the hook to use `selectContractBalancesPerChainId` and access the correct chain's balances using the `asset.chainId` parameter that is already passed to the hook. ## **Changelog** CHANGELOG entry: Fixed incorrect token balance check in Ramp when selecting tokens from non-active networks ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/TRAM-2875?atlOrigin=eyJpIjoiNDE5YjQ4YjQ3NGRkNGUzMGFkODUxNjI0M2QxMzlkNjUiLCJwIjoiaiJ9 Fixes #23722 ## **Manual testing steps** ```gherkin Feature: Ramp token balance check Scenario: user sells USDC on Arbitrum while connected to different network Given user has 40 USDC on Arbitrum And user's wallet is connected to Mainnet When user navigates to Sell flow in Ramp And user selects USDC on Arbitrum as the asset to sell And user enters an amount less than their balance (e.g. 22) Then the "this amount is higher than your balance" error should NOT appear And the balance should correctly reflect the Arbitrum USDC balance ``` ## **Screenshots/Recordings** ### **Before** `balanceBN` was `null` for tokens on non-active networks, causing false insufficient balance errors. (quick amount selector isn't shown because amount is not being detected) <img width="300" alt="image" src="https://github.com/user-attachments/assets/6c45f7b0-f5d6-4dd5-a413-350a3fa2bf3f" /> ### **After** `balanceBN` correctly reflects the token balance on the asset's chain regardless of the currently active network. <img width="300" alt="image" src="https://github.com/user-attachments/assets/987d5eba-e430-4a1a-b678-850a40259373" /> ## **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. ## **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] > Compute token balances from the asset’s chain using per-chain balances, fixing incorrect balances when the active network differs. > > - **Ramp Aggregator `useBalance`** (`app/components/UI/Ramp/Aggregator/hooks/useBalance.ts`): > - Switch to `selectContractBalancesPerChainId` and index by the asset’s `chainId` (via `toHex`) to retrieve correct per-chain ERC-20 balances. > - Update balance computations (`balance`, `balanceBN`, `balanceFiat`) to use chain-scoped balances and existing exchange rates. > - Ensure native balance lookup uses `accountsByChainId[hexChainId]` guard for the asset’s chain. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 2fa36f1. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: Pedro Pablo Aste Kompen <wachunei@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 : )