-
Notifications
You must be signed in to change notification settings - Fork 5.2k
chore: upgrade multichain-networks-controllers-v0.5.1 #31414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
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
…tworksWithActivity state for mocks/fixtures
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
…yAccounts. The method handles it internally now
…at-4469-networks-with-activity
…at-4469-networks-with-activity
✨ Files requiring CODEOWNER review ✨🧩 @MetaMask/extension-devs
📜 @MetaMask/policy-reviewers
🔗 @MetaMask/supply-chain
🖥️ @MetaMask/wallet-ux
|
4 tasks
… to network activity
…at-4469-networks-with-activity
…ain network service controller
…at-4469-networks-with-activity
…at-4469-networks-with-activity
…at-4469-networks-with-activity
…at-4469-networks-with-activity
vinnyhoward
added a commit
to MetaMask/core
that referenced
this pull request
Apr 16, 2025
## Explanation Currently, our client manually adds networks and checks user activity one network at a time. This is inefficient and doesn't scale well. This PR introduces a more efficient approach by: 1. Adding a new API integration that fetches active networks for multiple accounts in a single request 2. Managing network activity state through the controller 3. Adding type-safe methods to handle both EVM and non-EVM accounts 4. Extracting network fetching logic into a dedicated service layer Key additions: - `getNetworksWithTransactionActivityByAccounts`: Fetches active networks for accounts - `MultichainNetworkService`: New service layer handling network activity fetching - Enhanced state management for network configurations and activity - Improved error handling and fallback mechanisms The new implementation: - Reduces API calls through batch fetching - Improves separation of concerns with dedicated service layer - Enhances type safety and error handling - Provides better state management with fallbacks PRs for Client Integration [Extension](MetaMask/metamask-extension#31414) [Mobile](MetaMask/metamask-mobile#14348) ## References Related to [#4469 ](MetaMask/MetaMask-planning#4469) ## Changelog <!-- If you're making any consumer-facing changes, list those changes here as if you were updating a changelog, using the template below as a guide. (CATEGORY is one of BREAKING, ADDED, CHANGED, DEPRECATED, REMOVED, or FIXED. For security-related issues, follow the Security Advisory process.) Please take care to name the exact pieces of the API you've added or changed (e.g. types, interfaces, functions, or methods). If there are any breaking changes, make sure to offer a solution for consumers to follow once they upgrade to the changes. Finally, if you're only making changes to development scripts or tests, you may replace the template below with "None". --> ### `@metamask/multichain-network-controller` - **ADDED**: New method `getNetworksWithTransactionActivityByAccounts` to fetch active networks for accounts - **ADDED**: New `MultichainNetworkServiceController` for handling network activity fetching - **ADDED**: New types for network activity state and responses - **CHANGED**: Enhanced error handling for network requests - **CHANGED**: Improved type safety for messenger actions - **CHANGED**: Updated state management for network activity ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've highlighted breaking changes using the "BREAKING" category above as appropriate - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes --------- Co-authored-by: Charly Chevalier <[email protected]>
…at-4469-networks-with-activity
…at-4469-networks-with-activity
…at-4469-networks-with-activity
…at-4469-networks-with-activity
Builds ready [7e2baa5]
UI Startup Metrics (1212 ± 57 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [890ab5a]
UI Startup Metrics (1183 ± 52 ms)
Sum of mean exceeds: 0ms | Sum of p95 exceeds: 4ms Sum of all benchmark exceeds: 4ms Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
leotm
approved these changes
Apr 22, 2025
darkwing
approved these changes
Apr 22, 2025
salimtb
pushed a commit
to MetaMask/core
that referenced
this pull request
Apr 23, 2025
## Explanation Currently, our client manually adds networks and checks user activity one network at a time. This is inefficient and doesn't scale well. This PR introduces a more efficient approach by: 1. Adding a new API integration that fetches active networks for multiple accounts in a single request 2. Managing network activity state through the controller 3. Adding type-safe methods to handle both EVM and non-EVM accounts 4. Extracting network fetching logic into a dedicated service layer Key additions: - `getNetworksWithTransactionActivityByAccounts`: Fetches active networks for accounts - `MultichainNetworkService`: New service layer handling network activity fetching - Enhanced state management for network configurations and activity - Improved error handling and fallback mechanisms The new implementation: - Reduces API calls through batch fetching - Improves separation of concerns with dedicated service layer - Enhances type safety and error handling - Provides better state management with fallbacks PRs for Client Integration [Extension](MetaMask/metamask-extension#31414) [Mobile](MetaMask/metamask-mobile#14348) ## References Related to [#4469 ](MetaMask/MetaMask-planning#4469) ## Changelog <!-- If you're making any consumer-facing changes, list those changes here as if you were updating a changelog, using the template below as a guide. (CATEGORY is one of BREAKING, ADDED, CHANGED, DEPRECATED, REMOVED, or FIXED. For security-related issues, follow the Security Advisory process.) Please take care to name the exact pieces of the API you've added or changed (e.g. types, interfaces, functions, or methods). If there are any breaking changes, make sure to offer a solution for consumers to follow once they upgrade to the changes. Finally, if you're only making changes to development scripts or tests, you may replace the template below with "None". --> ### `@metamask/multichain-network-controller` - **ADDED**: New method `getNetworksWithTransactionActivityByAccounts` to fetch active networks for accounts - **ADDED**: New `MultichainNetworkServiceController` for handling network activity fetching - **ADDED**: New types for network activity state and responses - **CHANGED**: Enhanced error handling for network requests - **CHANGED**: Improved type safety for messenger actions - **CHANGED**: Updated state management for network activity ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've highlighted breaking changes using the "BREAKING" category above as appropriate - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes --------- Co-authored-by: Charly Chevalier <[email protected]>
Builds ready [f68a82e]
UI Startup Metrics (1225 ± 62 ms)
Benchmark value 1377 exceeds gate value 1365 for chrome browserify home p95 uiStartup Benchmark value 50 exceeds gate value 45 for chrome browserify home p95 firstReactRender Benchmark value 2455 exceeds gate value 2454 for chrome webpack home p95 uiStartup Benchmark value 1240 exceeds gate value 1239 for firefox browserify home mean domContentLoaded Sum of mean exceeds: 3ms | Sum of p95 exceeds: 18ms Sum of all benchmark exceeds: 21ms Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
github-merge-queue bot
pushed a commit
that referenced
this pull request
Apr 23, 2025
## **Description** upgrade multichain networks controllers to 0.5.1 core: MetaMask/core#5551 This PR updates the multichain network controller to implement the new `getNetworksWithActivityByAccounts` method from our core library and adds the necessary state management. The changes include: 1. Added `networksWithActivityByAccounts` to the MultichainNetworkControllerState 2. Updated test stubs and mocks to include the new state property 3. Fixed type definitions and linting errors related to the networks by activity state changes 4. Added method binding in MetaMask controller for the new functionality [](https://codespaces.new/MetaMask/metamask-extension/pull/31414?quickstart=1) ## **Related issues** Related to [#4469 ](MetaMask/MetaMask-planning#4469) ## **Manual testing steps** 1. Launch app, observe everything works as usual 2. If you want to see the state changes, goto `ui/components/multichain/account-list-menu/account-list-menu.tsx` 3. import ```typescript import { getNetworksWithActivity } from '../../../selectors/multichain/networks'; ``` 4. Declare ```typescript const networksWithActivity = useSelector(getNetworksWithActivity); console.log(networksWithActivity); ``` 5. Observe the networks with transaction activity shows ## **Screenshots/Recordings** <img width="1840" alt="Screenshot 2025-04-01 at 12 05 34 PM" src="https://github.com/user-attachments/assets/9f019f6c-90ed-4134-be92-aef65b51e096" /> ### **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 Extension Coding Standards](https://github.com/MetaMask/metamask-extension/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-extension/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.
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.
Description
upgrade multichain networks controllers to 0.5.1
core: MetaMask/core#5551
This PR updates the multichain network controller to implement the new
getNetworksWithActivityByAccounts
method from our core library and adds the necessary state management. The changes include:networksWithActivityByAccounts
to the MultichainNetworkControllerStateRelated issues
Related to #4469
Manual testing steps
ui/components/multichain/account-list-menu/account-list-menu.tsx
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist