Skip to content

chore: upgrade multichain-networks-controllers-v0.5.1 WIP #14348

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

vinnyhoward
Copy link
Contributor

@vinnyhoward vinnyhoward commented Apr 1, 2025

Description

Important: This integration is dependent on this PR and a multichain network controller update

This PR updates the multichain network controller to implement the new getNetworksWithActivityByAccounts method from our core library and adds the necessary state management.

Related issues

Related to #4469

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Screenshot 2025-04-01 at 12 33 34 PM

Before

After

Pre-merge author checklist

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.

…m the multichain networks controller and added the relevant state updates for mocks/fixtures
Copy link
Contributor

github-actions bot commented Apr 1, 2025

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.

@vinnyhoward vinnyhoward marked this pull request as ready for review April 1, 2025 18:38
@vinnyhoward vinnyhoward requested review from a team as code owners April 1, 2025 18:38
brianacnguyen
brianacnguyen previously approved these changes Apr 4, 2025
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]>
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]>
@vinnyhoward vinnyhoward changed the title feat(4469): networks with activity integration chore: upgrade multichain-networks-controllers-v0.5.1 Apr 24, 2025
@vinnyhoward vinnyhoward changed the title chore: upgrade multichain-networks-controllers-v0.5.1 chore: upgrade multichain-networks-controllers-v0.5.1 WIP Apr 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants