[pull] main from MetaMask:main#451
Merged
Merged
Conversation
…24509) <!-- 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 fixes a test for the trending feature where the keyboard would be in front of the search results resulting in failures. <!-- 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: ## **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** - [ ] 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] > Improves reliability of Trending e2e by dismissing the keyboard after typing into `searchInput`. > > - Adds `hideKeyboard: true` to `Gestures.typeText` in `e2e/pages/Trending/TrendingView.ts` > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 50b84e5. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
## **Description** Restructure perps deeplinks with clear screen-to-view mapping, add dedicated deeplinks for home and market list views, support market category filtering, and properly handle HIP-3 assets. **What changed:** - Added `screen=home` deeplink → PerpsHomeView (explicit navigation) - Added `screen=market-list` deeplink → PerpsMarketListView (full market browser) - Added `tab` parameter support for `screen=market-list`: - `tab=crypto` → Crypto markets only - `tab=stocks` → HIP3 stocks & commodities - `tab=all` → All markets - Added HIP-3 symbol parsing for asset deeplinks (`dex:symbol` format) - Kept `screen=markets` for backwards compatibility (routes to PerpsHomeView) - Created comprehensive deeplink documentation at `docs/perps/PERPS_DEEPLINKS.md` **Why:** - Previous deeplinks were confusingly named (`screen=markets` went to PerpsHomeView, not market list) - No dedicated deeplink existed for PerpsMarketListView - HIP3 markets (stocks/commodities) need dedicated deeplinks for marketing campaigns - HIP-3 assets needed proper symbol parsing to include `marketSource` ## **Changelog** CHANGELOG entry: Added perps deeplinks for home view, market list with category filtering, and HIP-3 asset support ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/TAT-2108 ## **Manual testing steps** ```gherkin Feature: Perps deeplinks restructured Background: Given user has completed the Perps tutorial And user is on any screen in the app Scenario: Deeplink to PerpsHomeView When user opens deeplink "https://link.metamask.io/perps?screen=home" Then user sees the Perps home view (positions, orders, watchlist) Scenario: Deeplink to PerpsMarketListView (all markets) When user opens deeplink "https://link.metamask.io/perps?screen=market-list" Then user sees the full market list view And "All" markets are shown Scenario: Deeplink to crypto markets When user opens deeplink "https://link.metamask.io/perps?screen=market-list&tab=crypto" Then user sees the market list view And only crypto markets are shown Scenario: Deeplink to stocks markets (HIP3) When user opens deeplink "https://link.metamask.io/perps?screen=market-list&tab=stocks" Then user sees the market list view And only stocks & commodities are shown Scenario: Deeplink to crypto asset When user opens deeplink "https://link.metamask.io/perps?screen=asset&symbol=BTC" Then user sees the Bitcoin market details Scenario: Deeplink to HIP-3 asset When user opens deeplink "https://link.metamask.io/perps?screen=asset&symbol=xyz:TSLA" Then user sees the Tesla market details And the market is identified as HIP-3 (builder DEX) Scenario: Backwards compatibility - screen=markets When user opens deeplink "https://link.metamask.io/perps?screen=markets" Then user sees the Perps home view (same as screen=home) Scenario: First-time user Given user has NOT completed the Perps tutorial When user opens deeplink "https://link.metamask.io/perps?screen=market-list&tab=crypto" Then user sees the Perps tutorial screen And user does NOT see the market list directly ``` ### Testing deeplinks on device/simulator Validate directly on the testing website at https://metamask-deeplinks-perps.vercel.app/ <img width="1192" height="1081" alt="image" src="https://github.com/user-attachments/assets/2f4f26e7-22d9-4c9d-87d9-504f3f668136" /> **iOS Simulator:** ```bash # Home view xcrun simctl openurl booted "https://link.metamask.io/perps?screen=home" # Market list with filters xcrun simctl openurl booted "https://link.metamask.io/perps?screen=market-list" xcrun simctl openurl booted "https://link.metamask.io/perps?screen=market-list&tab=crypto" xcrun simctl openurl booted "https://link.metamask.io/perps?screen=market-list&tab=stocks" # Asset details xcrun simctl openurl booted "https://link.metamask.io/perps?screen=asset&symbol=BTC" xcrun simctl openurl booted "https://link.metamask.io/perps?screen=asset&symbol=xyz:TSLA" ``` **Android Emulator:** ```bash # Home view adb shell am start -W -a android.intent.action.VIEW -d "https://link.metamask.io/perps?screen=home" # Market list with filters adb shell am start -W -a android.intent.action.VIEW -d "https://link.metamask.io/perps?screen=market-list" adb shell am start -W -a android.intent.action.VIEW -d "https://link.metamask.io/perps?screen=market-list&tab=crypto" adb shell am start -W -a android.intent.action.VIEW -d "https://link.metamask.io/perps?screen=market-list&tab=stocks" # Asset details adb shell am start -W -a android.intent.action.VIEW -d "https://link.metamask.io/perps?screen=asset&symbol=BTC" adb shell am start -W -a android.intent.action.VIEW -d "https://link.metamask.io/perps?screen=asset&symbol=xyz:TSLA" ``` ## **Screenshots/Recordings** ### **Before** <!-- Previous deeplinks had confusing naming --> ### **After** https://github.com/user-attachments/assets/2d9ea9a3-21b0-4930-9974-96b28cf3158f <!-- Screenshots showing: 1. screen=home → PerpsHomeView 2. screen=market-list → PerpsMarketListView 3. screen=market-list&tab=crypto → Crypto markets filtered 4. screen=market-list&tab=stocks → HIP3 stocks filtered 5. screen=asset&symbol=xyz:TSLA → HIP-3 asset details --> ## **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] > Introduces a clearer deeplink model for Perps with new screens, filtering, HIP-3 assets, and universal link integration. > > - Adds `screen=home` → `PerpsHomeView` and `screen=market-list` → `PerpsMarketListView`; keeps `screen=markets` as backwards-compatible alias for home > - Supports `tab` filters for market list via `TAB_TO_FILTER_MAP` (`all`, `crypto`, `stocks` → `stocks_and_commodities`) > - Implements HIP-3 symbol parsing (`parseHip3Symbol`) for `dex:symbol` (e.g., `xyz:TSLA`) and passes `marketSource`; normalizes case > - Ensures navigation includes `params: { source: 'deeplink' }` and falls back to `PerpsHomeView` on errors/missing symbols > - Updates `handleUniversalLink` to whitelist perps actions and handle `PERPS_ASSET` by injecting `screen=asset` > - Expands tests for all new routes/filters/HIP-3 cases and adds docs at `docs/perps/perps-deeplinks.md` > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 5a97038. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
## **Description** This PR adds support for the `rampsUnifiedBuyV2` LaunchDarkly feature flag to enable Phase 2 of the Unified Buy feature. **What is the reason for the change?** - As part of the Unified Buy 2026 Phase 2 initiative (TRAM-2958), we need a new feature flag to control the V2 implementation independently from V1. **What is the improvement/solution?** - Added V2 selectors for the `rampsUnifiedBuyV2` remote feature flag - Added `useRampsUnifiedV2Enabled` hook with: - Build flag override support (`MM_RAMPS_UNIFIED_BUY_V2_ENABLED`) - Remote feature flag via Redux selectors - Minimum version checking (7.63.0) - Extracted `hasMinimumRequiredVersion` to a shared utility (DRY refactor) - Updated V1 hook to use the shared utility - Added V2 flag configuration to E2E remote feature flags mock ## **Changelog** CHANGELOG entry: null ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/TRAM-3027 ## **Manual testing steps** ```gherkin Feature: rampsUnifiedBuyV2 feature flag Scenario: V2 flag is disabled by default Given the app is running with remote feature flags loaded When the rampsUnifiedBuyV2 flag has active: false Then useRampsUnifiedV2Enabled returns false Scenario: V2 flag is enabled when active and version meets requirement Given the app is running version 7.63.0 or higher When the rampsUnifiedBuyV2 flag has active: true and minimumVersion: 7.63.0 Then useRampsUnifiedV2Enabled returns true Scenario: Build flag overrides remote flag Given MM_RAMPS_UNIFIED_BUY_V2_ENABLED is set to "true" When the remote flag has active: false Then useRampsUnifiedV2Enabled returns true (build flag takes precedence) ``` ## **Screenshots/Recordings** N/A - No UI changes, this is infrastructure code for feature flagging. ## **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] > Introduces Phase 2 flagging for Unified Buy with build-time override and version gating, plus shared utility reuse. > > - New `rampsUnifiedBuyV2` selectors and `useRampsUnifiedV2Enabled` hook (respects `MM_RAMPS_UNIFIED_BUY_V2_ENABLED` and remote flags with minimum version) > - Extracts `hasMinimumRequiredVersion` to `utils/hasMinimumRequiredVersion` and updates `useRampsUnifiedV1Enabled` to use it > - Adds comprehensive tests for V2 hook, V2 selectors, and the version-check util > - Updates `babel.config.tests.js` to avoid inlining env vars for new files > - Extends E2E remote feature flags mock to include `rampsUnifiedBuyV2` default config > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit f3a487f. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
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 : )