[pull] main from MetaMask:main#327
Merged
Merged
Conversation
…ces (#22676) <!-- 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? --> This PR hardens several Card flows: - Mailing-address consent now recreates or reuses onboarding consent defensively, mirroring the logic in the physical-address step. - useWrapWithCache, CardHome, and their test suites now treat cache errors and expired-card tokens consistently; the home screen shows a dedicated spinner while auth cleanup runs and only processes each auth error once. - Onboarding/Complete now calls navigation.dispatch(StackActions.replace(...)) (with updated tests) so we don’t stack duplicate routes after successful onboarding. - Card login path surfaces the new ACCOUNT_DISABLED error type with the correct localized messaging. - These fixes resolve missing-consent crashes, inconsistent priority-token balances, brittle token-expiration UX, and the lingering navigation issue after onboarding. ## **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: Improved MetaMask Card onboarding and home flows (defensive consent creation, consistent balance caching, robust expired-token handling, and navigation fixes). ## **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 - [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] > Defensively manage consent across onboarding, improve auth-error cleanup and navigation, refine balance fiat/caching logic, and add ACCOUNT_DISABLED handling with new consent lookup API. > > - **Onboarding**: > - **Mailing/Physical Address**: Add defensive consent flow (reuse/create via `getOnboardingConsentSetByOnboardingId`, link user, clear `consentSetId`); maintain validations and success paths. Navigation uses replace where appropriate. > - **Complete screen**: Switch to `navigation.dispatch(StackActions.replace(...))` and reset onboarding state before redirect. > - **Card Home**: > - Add robust auth-error handling (single-run cleanup, token removal, Redux reset/cache clear, `StackActions.replace` to welcome, loading spinner during cleanup) and initial authenticated data load. > - Preserve/compute balances and spending limit UI as before; minor UX tweaks. > - **Hooks**: > - `useAssetBalances`: Rework fiat formatting and fallbacks (handle `tokenRateUndefined`/loading strings, raw fiat parsing, proportional fiat, currency detection), keep Solana/EVM paths; expose consistent map. > - `useWrapWithCache`: Return real `Error`, avoid auto-retries on error, prevent refetch while loading, skip caching null/undefined; same API. > - `useCardDetails`: Surface `error` object (not enum), keep polling, warnings. > - `useGetCardExternalWalletDetails`: Guard auto-fetch on error; unchanged API. > - `useGetDelegationSettings`/`useRegistrationSettings`: Align to `Error` semantics. > - **SDK/Types**: > - `CardSDK.login`: detect and surface `ACCOUNT_DISABLED` error; OTP flows unchanged. > - Add `getConsentSetByOnboardingId` endpoint support; new `ConsentSet`/`GetOnboardingConsentResponse` types. > - **Tests**: Extensive updates/new cases across components and hooks to cover consent recovery, navigation replace, auth cleanup order, cache/error behavior, and fiat formatting. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 9e3b88d. 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** - Implement feature flag to turn on/off OTA updates - The app fetches updates and apply the updates in the App level and shows fox loading screen when fetching and loading the updates Test Builds: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/ab3447d5-abad-4e45-aeed-83e4ec14259f?tab=workflows iOS: search 7.60.99 build 3025 I used EAS Updates to remove Privacy Police, Terms of use and Attributions links in About MetaMask screen <!-- 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: Added feature flag to gate EAS updates ## **Related issues** Fixes: ## **Manual testing steps** ```gherkin Feature: Manage over-the-air EAS updates behind a remote feature flag Background: Given the app retrieves remote feature flags from the MetaMask config service And the app boot sequence evaluates the `otaUpdatesEnabled` flag for the current build Scenario: Remote flag disabled Given the remote config returns `otaUpdatesEnabled` as disabled for this build version When the application finishes bootstrapping Then the OTA update check is skipped And the user can access the wallet without waiting for EAS Scenario: Update available triggers download and reload Given the remote config resolves `otaUpdatesEnabled` to true for this build And EAS reports that a new update is available When the OTA update check runs Then the app downloads the update package And the app reloads to apply the new update ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** Before I turned the feature flag on, no updates  ### **After** After I turned the feature flag on, updates applied  <!-- [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** - [x] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [x] 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 an OTA updates hook gated by `otaUpdatesEnabled`, integrates it at app startup to fetch/reload via Expo Updates, and shows `FoxLoader` while checking, with comprehensive tests. > > - **Hooks**: > - `useOTAUpdates`: new hook using `expo-updates` to check/fetch/reload updates; returns `isCheckingUpdates`; skips in `__DEV__`; gated by `FeatureFlagNames.otaUpdatesEnabled`. > - **App**: > - Split `App` into `AppContent` and top-level `App` that uses `useOTAUpdates` and renders `FoxLoader` while `isCheckingUpdates`. > - **Feature Flags**: > - Add `otaUpdatesEnabled` to `FeatureFlagNames` and `util/feature-flags` descriptions. > - **Tests**: > - Add `app/components/hooks/useOTAUpdates.test.ts` covering flag states, dev mode, success/error, and call order. > - Update `app/components/Nav/App/App.test.tsx` to mock `useOTAUpdates` and assert `FoxLoader` rendering during update checks. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit e95195e. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: metamaskbot <metamaskbot@users.noreply.github.com>
) Correct translation for card onboarding flow in Spanish <!-- 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? --> A typo and poor translation in the card onboarding flow needed correcting for Spanish ## **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: n/a ## **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 - [ ] 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] > Refines Spanish text for MetaMask Card onboarding by correcting the non-cardholder title and description. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 356e6fb. 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** Fix issue where rewards calculations were broken for Solana by transitioning to BIP-44 compliant account selectors. <!-- 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: #22741 ## **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] > Use scope-based multichain account selector and CAIP-formatted chain IDs to compute rewards, with tests updated accordingly. > > - **Bridge Rewards (useRewards)** > - Replace `selectSelectedInternalAccountFormattedAddress`/`selectChainId` with `selectSelectedInternalAccountByScope` and `getFormattedAddressFromInternalAccount`. > - Derive `sourceChainId` via `formatChainIdToCaip` and use it when formatting CAIP-10 accounts. > - Update dependencies and guards in `estimatePoints` to use `sourceChainId` and selected account by scope. > - **Tests** > - Add mocks for `selectSelectedInternalAccountByScope` returning Solana/EVM accounts based on scope. > - Ensure rewards row scenarios use the new selector and CAIP chain handling. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit ab9db65. 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 is based on an external PR: #22532 Credit goes to @Nodonisko <!-- 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 Bridge token selection performance with memoized components/hooks, throttled search, refined selectors, and updated token icon URL API. > > - **Bridge UI**: > - Wrap `BridgeDestTokenSelector`, `BridgeSourceTokenSelector`, `BridgeTokenSelectorBase`, `SkeletonItem`, `LoadingSkeleton`, and `TokenInputArea` with `React.memo`; add `displayName`s; memoize `networksBar`, handlers, and effects; clean up debounced presses. > - Use `useStyles(createStyles)` without vars where not needed. > - **Hooks**: > - `useStyles`: add overloads to support optional `vars`. > - `useTokenSearch`: throttle token list updates and limit Fuse searches; return sorted, limited results. > - `useTokens`: memoize key computations, sets, and filtered lists; use callbacks. > - `useTokensWithBalance`: generate icon URLs via assetId and non-EVM flag; ensure consistent chainId handling. > - `useTopTokens`: reuse cached TokenListController tokens; normalize addresses; adjust dedupe; build icon URLs with assetId; simplify add-if-not-exists. > - `useNonEvmTokensWithBalance`: switch to multi-account selector. > - **Selectors/Utils**: > - `selectCurrencyRates`: switch to deep-equal selector. > - Replace `selectMultichainTokenListForAccountAnyChain` with `selectMultichainTokenListForAccountsAnyChain` to aggregate across accounts. > - `getTokenIconUrl`: change signature to accept `assetId` and `isNonEvmChain`; build URL without try/catch. > - **Tests/Snapshots**: > - Update unit tests and snapshots to reflect memoized components and new `ListEmptyComponent`/`handlerTag` values and icon URL API. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit b9504b1. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Nodonisko <suchydan@gmail.com> Co-authored-by: Bryan Fullam <bryan.fullam@consensys.net>
All we're doing is adding some examples to the readme file for deeplinks Changelog entry: Add more details to deeplink docs <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Expands deeplinking docs by adding a new "Custom URI Schemes" section with detailed explanations, flows, parameters, and examples for `metamask://`, `wc://`, `ethereum://`, and `dapp://`, and links it in the TOC. > > - **Docs (deeplinking)**: > - Add new section: **Custom URI Schemes Explained** detailing `metamask://`, `wc://`, `ethereum://` (EIP-681), and `dapp://`. > - Include usage purposes, processing flows, key parameters, and concise examples for each scheme. > - Clarify `dapp://` behavior vs universal links (bypasses interstitial) and `ethereum://` chain ID handling. > - Update Table of Contents to link to the new section. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit a5baad6. 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 : )