Skip to content

chore: upgrade multichain-networks-controllers-v0.7.0 #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

Merged
merged 22 commits into from
May 30, 2025

Conversation

vinnyhoward
Copy link
Contributor

@vinnyhoward vinnyhoward commented Apr 1, 2025

Description

This PR updates the multichain network controller and its relevant state

Related issues

Related to #4469

Manual testing steps

  1. No testing needed

Screenshots/Recordings

NA

Before

NA

After

NA

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
@vinnyhoward vinnyhoward changed the title chore: upgrade multichain-networks-controllers-v0.5.1 WIP chore: upgrade multichain-networks-controllers-v0.7.0 May 20, 2025
@vinnyhoward vinnyhoward added Run Smoke E2E Requires smoke E2E testing and removed Run Smoke E2E Requires smoke E2E testing labels May 29, 2025
Copy link
Contributor

github-actions bot commented May 29, 2025

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: 16896d7
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/36b221ac-603d-48ea-861c-6c5cb124b99d

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

Copy link
Contributor

@Cal-L Cal-L left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM from platform side

@vinnyhoward vinnyhoward added Run Smoke E2E Requires smoke E2E testing and removed Run Smoke E2E Requires smoke E2E testing labels May 29, 2025
Copy link
Contributor

github-actions bot commented May 29, 2025

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: 3d58de3
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/d7340160-3e08-4ad5-8761-ded07eeea17b

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

Copy link
Contributor

@EtherWizard33 EtherWizard33 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vinnyhoward vinnyhoward added Run Smoke E2E Requires smoke E2E testing and removed Run Smoke E2E Requires smoke E2E testing labels May 29, 2025
@vinnyhoward vinnyhoward added Run Smoke E2E Requires smoke E2E testing and removed Run Smoke E2E Requires smoke E2E testing labels May 29, 2025
Copy link
Contributor

github-actions bot commented May 29, 2025

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: e194f9f
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/8b10eb3e-8365-4d26-89cf-6d8dafda3daa

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Copy link

@vinnyhoward vinnyhoward added Run Smoke E2E Requires smoke E2E testing and removed Run Smoke E2E Requires smoke E2E testing labels May 29, 2025
@vinnyhoward vinnyhoward added this pull request to the merge queue May 30, 2025
Merged via the queue into main with commit de39da7 May 30, 2025
56 of 59 checks passed
@vinnyhoward vinnyhoward deleted the feat-4469-networks-with-activity branch May 30, 2025 01:01
@github-actions github-actions bot locked and limited conversation to collaborators May 30, 2025
@metamaskbot metamaskbot added the release-7.48.0 Issue or pull request that will be included in release 7.48.0 label May 30, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
No QA Needed Apply this label when your PR does not need any QA effort. release-7.48.0 Issue or pull request that will be included in release 7.48.0 Run Smoke E2E Requires smoke E2E testing team-wallet-ux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants