You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: fetch networks with transaction activity by accounts (#5551)
## 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]>
Copy file name to clipboardExpand all lines: packages/multichain-network-controller/CHANGELOG.md
+10
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
8
8
## [Unreleased]
9
9
10
+
### Added
11
+
12
+
- New method `getNetworksWithTransactionActivityByAccounts` to fetch active networks for multiple accounts in a single request ([#5551](https://github.com/MetaMask/core/pull/5551))
13
+
- New `MultichainNetworkService` for handling network activity fetching ([#5551](https://github.com/MetaMask/core/pull/5551))
14
+
- New types for network activity state and responses ([#5551](https://github.com/MetaMask/core/pull/5551))
15
+
16
+
### Changed
17
+
18
+
- Updated state management for network activity ([#5551](https://github.com/MetaMask/core/pull/5551))
Copy file name to clipboardExpand all lines: packages/multichain-network-controller/src/MultichainNetworkController/MultichainNetworkController.test.ts
0 commit comments