[pull] main from MetaMask:main#362
Merged
Merged
Conversation
…iew (#23340) <!-- 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** Add loading states, error fallback, and auto-refresh for position detail and sell preview components to improve UX when fetching order preview data. Changes: - Add skeleton loaders while preview data is loading (null state without error) - Fallback to position.currentValue when preview fetch fails - Display preview error messages to users - Recalculate PnL dynamically from preview minAmountReceived or position data - Auto-refresh preview data every 1 second in PredictPositionDetail to keep values fresh - Add comprehensive test coverage for loading and error states Components updated: - PredictPositionDetail: Show skeletons for currentValue and percentPnl during preview load, auto-refresh every 1s - PredictSellPreview: Show skeleton for cash out amount and display preview errors Test coverage: - Add 4 new tests for PredictPositionDetail preview states - Add 4 new tests for PredictSellPreview preview states - Fix test data inconsistencies (currentValue now matches percentPnl calculations) - All 22 tests passing for PredictPositionDetail - All 13 tests passing for PredictSellPreview Technical details: - Use isPreviewLoading = preview === null && !previewError to distinguish loading from error - Use useMemo for PnL calculations to optimize re-renders - Set autoRefreshTimeout: 1000 to keep position values updated in real-time - Gracefully degrade to position data when preview unavailable <!-- 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/PRED-333?atlOrigin=eyJpIjoiM2RmNjMwODg3MWY1NDhkOTg0M2JhZmRlMWQ5MmZhYmYiLCJwIjoiaiJ9 https://consensyssoftware.atlassian.net/browse/PRED-328?atlOrigin=eyJpIjoiZDQzNmEwMjA3YzVlNDcyNWIzOGVkZThmMTk3OGFlZTkiLCJwIjoiaiJ9 ## **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 loading skeletons, error fallback/display, PnL recalculation from preview, and periodic auto-refresh to position detail and sell preview, with hook support and comprehensive tests. > > - **UI** > - **`PredictPositionDetail`**: > - Integrates `usePredictOrderPreview` with `autoRefreshTimeout` (only when `useIsFocused` and market is open). > - Shows skeletons for `currentValue` and PnL while loading; recalculates PnL from preview; falls back to position data on error. > - Keeps cash-out flow; disables button for optimistic positions. > - **`PredictSellPreview`**: > - Uses preview `isLoading`/`error`; shows skeletons; displays preview errors. > - Falls back to `position.currentValue` on error; recalculates PnL from preview/position. > - Keeps hero button with loading state; auto-refresh set to 1000ms. > - **Hook**: `usePredictOrderPreview` > - Adds `isLoading`; debounced compute; schedules/clears auto-refresh timers; robust error handling/logging; cleans up on unmount; reacts to param changes. > - **Tests** > - Adds/updates unit tests covering loading, error fallback, PnL recalculation, and auto-refresh; fixes test data to match computed values; mocks `useIsFocused`/preview hook. > - **E2E** > - Tweaks synchronization points in cash-out/open-position flows. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 423ef35. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Curtis David <Curtis.David7@gmail.com>
## **Description** This PR makes it so that when there's no active season, we show a summary of the opted in state for the previous season. This is to prepare for the end of season 1. ## **Changelog** CHANGELOG entry: feat: previous season summary ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/RWDS-852 ## **Screenshots/Recordings** ### **After** Season ended and no rewards unlocked and lowest tier <img width="469" height="994" alt="image" src="https://github.com/user-attachments/assets/370a8e89-d2c7-46c6-a3a9-e7886e482a2d" /> --- Season ended and no rewards unlocked because data stale and not lowest tier <img width="467" height="849" alt="image" src="https://github.com/user-attachments/assets/8201d00e-76fc-48c4-a72c-d087ede97d17" /> --- Season ended and rewards unlocked (no stale data) and no minimum version to update could be found <img width="471" height="909" alt="image" src="https://github.com/user-attachments/assets/05b9294a-c683-479d-8b92-cc0a56f15daa" /> --- Season ended and rewards unlocked and a minimum version to update to <img width="470" height="911" alt="image" src="https://github.com/user-attachments/assets/c0ac5bbf-4493-4351-8139-4883f0d4d044" /> <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Show a Previous Season Summary when the season has ended, backed by new controller/service support for previous seasons and minimum-version prompts, plus state/selectors updates and comprehensive tests. > > - **UI/Views**: > - Add `PreviousSeasonSummary` and tiles: `PreviousSeasonBalance`, `PreviousSeasonLevel`, `PreviousSeasonReferralDetails`, `PreviousSeasonUnlockedRewards` (with store links and version prompt). > - Update `RewardsDashboard` to detect ended season via `seasonId/seasonEndDate` and conditionally render previous-season summary, hide referral button, and gate modals accordingly. > - Add test IDs and i18n strings for previous-season labels; include new SVG illustration. > - **State/Selectors**: > - Extend rewards state with `seasonShouldInstallNewVersion` and expose `selectSeasonShouldInstallNewVersion`. > - Wire selectors for `selectSeasonEndDate`; update tests and usage across components. > - **Engine/Controller**: > - Add `shouldInstallNewVersion` to `SeasonDto/State` and include in status conversion. > - Reduce season metadata cache TTL to 1 minute; improve `hasActiveSeason` check. > - Enhance `getSeasonMetadata` to support `'previous'`, invalidate expired cached current season, and persist metadata. > - **Service**: > - Extend `getDiscoverSeasons` to include `previous` season; parse previous/current date strings. > - **Types**: > - Add end-of-season fields to `SeasonRewardDto` and optional fields to `RewardDto`/season types. > - **Tests**: > - Add extensive unit tests for new components, dashboard behavior, hooks, reducer/selectors, controller/service changes; adjust mocks (Tabs ref, metrics, safe-area). > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 6894052. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
## **Description** This PR corrects the MetaMask brand name casing across multiple locale files. The proper formatting uses camelCase with capital letters at both the start and middle (MetaMask), but several locale files contained incorrect variations like "Metamask" in user-facing messages. This change ensures brand consistency across all translated content in the mobile application, matching the standards already applied in metamask-extension (#38332). **Files updated:** - German (de.json) - Greek (el.json) - English (en.json) - Spanish (es.json) - French (fr.json) - Indonesian (id.json) - Russian (ru.json) - Tagalog (tl.json) - Turkish (tr.json) - Chinese (zh.json) ## **Changelog** CHANGELOG entry: null ## **Related issues** Fixes: N/A Related to metamask-extension PR: MetaMask/metamask-extension#38332 ## **Manual testing steps** ```gherkin Feature: MetaMask brand name casing in locale files Scenario: Verify correct MetaMask casing in deprecation messages Given the app is set to any supported locale (de, el, en, es, fr, id, ru, tl, tr, or zh) When a user views network deprecation messages Then the brand name should display as "MetaMask" with proper camelCase Scenario: Verify correct MetaMask casing in gas fee messages Given the app is set to a locale with updated gas fee text (el, en, es, tl) When a user views gas fee information Then the brand name should display as "MetaMask" with proper camelCase ``` ## **Screenshots/Recordings** N/A - Text-only changes to locale files ### **Before** Inconsistent casing: "Metamask" in various locale strings ### **After** Consistent casing: "MetaMask" across all locale strings ## **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] > Standardizes MetaMask brand casing across multiple locale files, updating deprecation and gas fee messages. > > - **i18n/Locales**: > - Standardize brand casing from `Metamask` to `MetaMask` in `locales/languages/{de,el,en,es,fr,id,ru,tl,tr,zh}.json`. > - Update `networks.network_deprecated_description` in all listed locales. > - Update `tooltip_modal.estimated_gas_fee.gas_recipient` where present (`el`, `en`, `es`, `tl`). > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 5ea92a4. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
… chain (#23371) ## **Description** Display an alert if there is a pending transaction on the source chain from the same account. Also bump transaction and transaction pay controllers to retrieve only EIP-7702 gas fee tokens. ## **Changelog** CHANGELOG entry: null ## **Related issues** Fixes: #23348 #23350 ## **Manual testing steps** ## **Screenshots/Recordings** ### **Before** ### **After** <img width="300" alt="Alert" src="https://github.com/user-attachments/assets/2e7c8bc6-4ce2-4720-895f-47a4572fd1d2" /> ## **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 blocking alert when the same account has a signed/approved/submitted transaction on the pay token’s chain, plus minor alert/loading tweaks and controller version bumps. > > - **Confirmations / Alerts**: > - `useSignedOrSubmittedAlert`: Detects existing transactions in `INCOMPLETE`/`PENDING` states on the current chain or the selected pay token’s `chainId`; uses `useTransactionPayToken`; shows context-specific titles/messages. > - `alert-banner.tsx`: Uses full `transaction` with `hasTransactionType` to respect `ignoreTypes` when deciding visibility. > - `useInsufficientPayTokenBalanceAlert`: Adds loading guards in total amount/network fee calculations to avoid false insufficiency alerts. > - **i18n**: > - Adds `alert_system.signed_or_submitted_pay_token.{title,message}` strings. > - **Tests**: > - Expands `useSignedOrSubmittedAlert` tests to cover pay token chain scenarios and pending statuses. > - **Dependencies**: > - Bumps `@metamask/transaction-controller` to `62.3.1` and `@metamask/transaction-pay-controller` to `10.2.0`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit b2b5d66. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
…23218) ## **Description** Similar fix (technical details on this PR too): - MetaMask/metamask-extension#38061 ## **Changelog** CHANGELOG entry: Prevent any dialogs for multichain wallet Snaps (Solana, Bitcoin, Tron) ## **Related issues** Fixes: - #22465 ## **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** ### **Before** ### **After** ## **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] > Skip Snap account dialogs and naming for preinstalled multichain wallet Snaps under state 2, with E2E-safe fallback and updated tests. > > - **Core/SnapKeyring**: > - Enhance `addAccount` flow to auto-skip dialogs for preinstalled multichain wallet Snaps when multichain accounts state 2 is enabled. > - Introduce `isMultichainWalletSnap` and `isE2E` checks; derive `skipAll` to bypass confirmation, name suggestion, and selection steps. > - Set `accountNameSuggestion` to ``''`` when skipping to avoid race conditions; update `skipApprovalFlow` logic accordingly. > - Preserve legacy behavior in E2E runs by disabling skips. > - **Tests**: > - Mock `isMultichainWalletSnap` and extend scenarios for state 2, verifying dialog skipping and naming behavior. > - Minor adjustments to expectations around flows and account naming/selection. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit fd81303. 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 : )