[pull] main from MetaMask:main#448
Merged
Merged
Conversation
<!-- 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** Gate gas fee token usage for Perps (Arbitrum USDC) and Predict (Polygon USDC.e). Add shared helper for gas-fee-token eligibility and update controller tests. ## **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: MetaMask/MetaMask-planning#6352 ## **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] > Implements chain/token-gated gasless-style deposits by wiring `gasFeeToken` into submission paths where eligible. > > - Perps: In `PerpsController.depositWithConfirmation`, set `gasFeeToken` when `assetChainId` is `ARBITRUM_MAINNET_CHAIN_ID_HEX` and `transaction.to` equals `USDC_ARBITRUM_MAINNET_ADDRESS`; pass to `TransactionController.addTransaction` (skips initial gas estimate). Added `Hex` and chain/token constants. > - Predict: `PolymarketProvider.prepareDeposit` now returns `gasFeeToken` (Polygon only, set to collateral) and `PredictController.depositWithConfirmation` forwards it to `addTransactionBatch`. > - Types: Extend `PrepareDepositResponse` to include optional `gasFeeToken`. > - Tests: Update Perps/Predict controller tests to mock `estimateGas/estimateGasFee`, account balances, and assert `gasFeeToken` is set when conditions match (and `undefined` otherwise). > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 894892b. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
…ents (#24308) ## **Description** Previously, both `PerpsTabView` (the Perps tab on wallet home screen) and `PerpsHomeView` (the dedicated Perps home screen) were using the same `screen_type` value (`homescreen`) for `PERPS_SCREEN_VIEWED` analytics events. This made it impossible to distinguish between the two screens in analytics dashboards. This PR introduces two distinct screen type values: - `wallet_home_perps_tab` - Used when viewing the Perps tab within the wallet home screen - `perps_home` - Used when viewing the full dedicated Perps home screen The legacy `HOMESCREEN` value is preserved with a comment indicating it should not be used for new implementations. ## **Changelog** CHANGELOG entry: null ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/TAT-1835 ## **Manual testing steps** ```gherkin Feature: Perps screen analytics differentiation Scenario: user views Perps tab on wallet home Given user is on the wallet home screen When user taps on the Perps tab Then PERPS_SCREEN_VIEWED event is fired with screen_type: "wallet_home_perps_tab" Scenario: user navigates to Perps home screen Given user is on any screen in the app When user navigates to the Perps home screen (via manage balance or navigation) Then PERPS_SCREEN_VIEWED event is fired with screen_type: "perps_home" ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Separates analytics tracking to uniquely identify Perps views across app surfaces. > > - Updates `PerpsTabView` to emit `PERPS_SCREEN_VIEWED` with `screen_type` `wallet_home_perps_tab` > - Updates `PerpsHomeView` to emit `PERPS_SCREEN_VIEWED` with `screen_type` `perps_home` > - Extends `constants/eventNames.ts` with `WALLET_HOME_PERPS_TAB` and `PERPS_HOME`; marks `HOMESCREEN` as legacy > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit a3fbd97. 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** <!-- 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? --> Fix Smart E2E Selection job failure blocking PR builds and tests by adding a fallback ### Changes: - Add `final-outputs` step with `if: always()` to guarantee outputs are set even if AI analysis fails - Use `|| echo` to prevent script failures from stopping the action - Fix JSON quoting issue using `printf` to preserve `["ALL"]` format - Improve user-facing PR comment when AI is unavailable - Outputs `["ALL"]` with confidence `0` on failure, triggering all applicable tests ### How it works: 1. AI analysis runs and sets outputs 2. If AI fails, the `final-outputs` step catches it and sets fallback values 3. Downstream jobs receive guaranteed outputs and run tests accordingly ## **Related issues** - Failing job: https://github.com/MetaMask/metamask-mobile/actions/runs/20932157126/job/60146624935?pr=22076 ## **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). - [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] > Strengthens the `smart-e2e-selection` action to avoid blocking builds when AI analysis fails and to guarantee consumable outputs. > > - New `final-outputs` step (with `if: always()`) sets `ai_e2e_test_tags` (fallback to `["ALL"]`) and passes through `ai_confidence` when analysis fails > - Wraps AI script with `|| echo` so failures don’t break the job; initializes default outputs in `ai-analysis` > - Updates outputs to read from `final-outputs` and always displays them > - PR comment logic: uses `pr_comment.md` if present; otherwise posts a clear fallback message; preserves skip messaging > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit c33e87b. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
…4281) <!-- 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** Predict withdraw transactions were missing `simulation_receiving_assets_total_value`, limiting visibility into total value withdrawn. Attach `assetsFiatValues.receiving` to Predict withdraw transactions during signing and add tests to verify the value is emitted through the metrics pipeline. ## **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: MetaMask/MetaMask-planning#6392 ## **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] > Adds missing simulation receiving value for Predict withdraws and validates metrics propagation. > > - Updates `PredictController.beforeSign` to set updated `txParams` and `assetsFiatValues.receiving` (stringified amount), and conditionally apply gas estimates > - Extends tests: `PredictController.test` asserts `assetsFiatValues.receiving`; `metrics.test` verifies `simulation_receiving_assets_total_value` is included when present and adds coverage for Smart Transactions metrics properties > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 574d483. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
## **Description** Fixes missing max leverage badge in the asset screen header when navigating from Recent Activity → Trade Details → "Trade again" button. **Root cause:** `PerpsPositionTransactionView` was creating a minimal market object with only `symbol` and `name` fields, missing `maxLeverage` and other required properties. **Solution:** Use `usePerpsMarkets` hook to get the complete market data (same pattern as `PerpsCard`). This hook: - Uses shared cached market data (no duplicate network requests) - Provides immediate data if already cached - Follows established patterns in the codebase ## **Changelog** CHANGELOG entry: null ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/TAT-2187 ## **Manual testing steps** ```gherkin Feature: Max leverage badge in asset screen header Scenario: User navigates from Recent Activity to asset details Given user has recent trading activity And user is on Perps home screen When user taps on a recent activity item Then user sees trade details screen When user taps "Trade again" button Then user sees asset details screen And max leverage badge is visible in header (e.g., "25x" for ETH) ``` ## **Screenshots/Recordings** ### **Before** Max leverage badge missing in header when navigating from Recent Activity https://github.com/user-attachments/assets/41ddb087-9c41-419d-ade9-29d0c47b091d ### **After** Max leverage badge visible in header (e.g., "25x" for ETH) https://github.com/user-attachments/assets/e1aa5432-abb4-4ae9-9404-9c7290bb40a1 ## **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] > Ensures the market header shows correct max leverage by enriching minimal route market data via `usePerpsMarkets` and hiding the badge when unavailable, with accompanying tests. > > - **Perps Market Details**: > - Enriches route `market` using `usePerpsMarkets` when `maxLeverage` is missing; skips fetch if not needed. > - Uses enriched/route `market` across the view; updates navbar setup accordingly. > - **Header**: > - Renders `PerpsLeverage` only when `market.maxLeverage` exists. > - **Transactions**: > - `PerpsPositionTransactionView` navigates with minimal `{ symbol, name }`; relies on details view enrichment. > - **Tests**: > - Add market data enrichment tests in `PerpsMarketDetailsView.test.tsx` (full, minimal, and missing enrichment cases). > - Update transaction view test to assert navigation with minimal market data. > - Add header test for rendering without `maxLeverage`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 9ed6c86. 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 : )