Skip to content

fix: remove chain id current chain from token rate controller #5645

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 17 commits into from
Apr 23, 2025

Conversation

salimtb
Copy link
Contributor

@salimtb salimtb commented Apr 15, 2025

Explanation

Refactor tokenRatesController and Remove Legacy current Network Dependencies
the changes contains:

Removal of Network Dependencies:
All current network dependencies have been removed, and the private property #chainId is no longer used.

Parallel API Requests:
Requests sent to the price API are now executed in parallel. This enhancement improves performance by reducing the overall time required to fetch data.

Optimized State Update:
Instead of triggering multiple state updates (and consequently re-renders) for each individual API response, the implementation now waits for all requests to complete and then updates the state once. This reduces unnecessary re-renders and optimizes the application's performance.

Integration with UI:

References

fixes: #5576

Changelog

@metamask/assets-controllers

  • UPDATE: Refactor TokenRatesController to support processing multiple chains simultaneously. The controller now accepts an array of chain IDs instead of a single value, streamlining the polling process by iterating over all chains in one loop.
  • BREAKING: Eliminate legacy network dependency handling in TokenRatesController. Clients must now pass an array (rather than a single object) for chain IDs and tickers. This change may require updates on the client side to align with the new array-based input.

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed, highlighting breaking changes as necessary
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

@salimtb salimtb changed the title Feat/remove chain id current chain fix: remove chain id current chain Apr 15, 2025
@salimtb salimtb marked this pull request as ready for review April 15, 2025 14:15
@salimtb salimtb requested review from a team as code owners April 15, 2025 14:15
@salimtb
Copy link
Contributor Author

salimtb commented Apr 20, 2025

@metamaskbot publish-preview

Copy link
Contributor

Preview builds have been published. See these instructions for more information about preview builds.

Expand for full list of packages and versions.
{
  "@metamask-previews/accounts-controller": "27.0.0-preview-d11c4815",
  "@metamask-previews/address-book-controller": "6.0.3-preview-d11c4815",
  "@metamask-previews/announcement-controller": "7.0.3-preview-d11c4815",
  "@metamask-previews/app-metadata-controller": "1.0.0-preview-d11c4815",
  "@metamask-previews/approval-controller": "7.1.3-preview-d11c4815",
  "@metamask-previews/assets-controllers": "58.0.0-preview-d11c4815",
  "@metamask-previews/base-controller": "8.0.0-preview-d11c4815",
  "@metamask-previews/bridge-controller": "16.0.0-preview-d11c4815",
  "@metamask-previews/bridge-status-controller": "13.1.0-preview-d11c4815",
  "@metamask-previews/build-utils": "3.0.3-preview-d11c4815",
  "@metamask-previews/chain-agnostic-permission": "0.4.0-preview-d11c4815",
  "@metamask-previews/composable-controller": "11.0.0-preview-d11c4815",
  "@metamask-previews/controller-utils": "11.7.0-preview-d11c4815",
  "@metamask-previews/delegation-controller": "0.1.0-preview-d11c4815",
  "@metamask-previews/earn-controller": "0.12.0-preview-d11c4815",
  "@metamask-previews/eip1193-permission-middleware": "0.1.0-preview-d11c4815",
  "@metamask-previews/ens-controller": "16.0.0-preview-d11c4815",
  "@metamask-previews/eth-json-rpc-provider": "4.1.8-preview-d11c4815",
  "@metamask-previews/gas-fee-controller": "23.0.0-preview-d11c4815",
  "@metamask-previews/json-rpc-engine": "10.0.3-preview-d11c4815",
  "@metamask-previews/json-rpc-middleware-stream": "8.0.7-preview-d11c4815",
  "@metamask-previews/keyring-controller": "21.0.3-preview-d11c4815",
  "@metamask-previews/logging-controller": "6.0.4-preview-d11c4815",
  "@metamask-previews/message-manager": "12.0.1-preview-d11c4815",
  "@metamask-previews/multichain": "4.0.0-preview-d11c4815",
  "@metamask-previews/multichain-api-middleware": "0.2.0-preview-d11c4815",
  "@metamask-previews/multichain-network-controller": "0.5.1-preview-d11c4815",
  "@metamask-previews/multichain-transactions-controller": "0.9.0-preview-d11c4815",
  "@metamask-previews/name-controller": "8.0.3-preview-d11c4815",
  "@metamask-previews/network-controller": "23.2.0-preview-d11c4815",
  "@metamask-previews/notification-services-controller": "6.0.0-preview-d11c4815",
  "@metamask-previews/permission-controller": "11.0.6-preview-d11c4815",
  "@metamask-previews/permission-log-controller": "3.0.3-preview-d11c4815",
  "@metamask-previews/phishing-controller": "12.4.1-preview-d11c4815",
  "@metamask-previews/polling-controller": "13.0.0-preview-d11c4815",
  "@metamask-previews/preferences-controller": "17.0.0-preview-d11c4815",
  "@metamask-previews/profile-sync-controller": "12.0.0-preview-d11c4815",
  "@metamask-previews/queued-request-controller": "10.0.0-preview-d11c4815",
  "@metamask-previews/rate-limit-controller": "6.0.3-preview-d11c4815",
  "@metamask-previews/remote-feature-flag-controller": "1.6.0-preview-d11c4815",
  "@metamask-previews/sample-controllers": "0.1.0-preview-d11c4815",
  "@metamask-previews/selected-network-controller": "22.0.0-preview-d11c4815",
  "@metamask-previews/signature-controller": "27.1.0-preview-d11c4815",
  "@metamask-previews/token-search-discovery-controller": "3.1.0-preview-d11c4815",
  "@metamask-previews/transaction-controller": "54.1.0-preview-d11c4815",
  "@metamask-previews/user-operation-controller": "33.0.0-preview-d11c4815"
}

@salimtb salimtb changed the title fix: remove chain id current chain fix: remove chain id current chain from token rate controller Apr 23, 2025
@salimtb
Copy link
Contributor Author

salimtb commented Apr 23, 2025

@metamaskbot publish-preview

Copy link
Contributor

Preview builds have been published. See these instructions for more information about preview builds.

Expand for full list of packages and versions.
{
  "@metamask-previews/accounts-controller": "27.0.0-preview-9a7893fb",
  "@metamask-previews/address-book-controller": "6.0.3-preview-9a7893fb",
  "@metamask-previews/announcement-controller": "7.0.3-preview-9a7893fb",
  "@metamask-previews/app-metadata-controller": "1.0.0-preview-9a7893fb",
  "@metamask-previews/approval-controller": "7.1.3-preview-9a7893fb",
  "@metamask-previews/assets-controllers": "58.0.0-preview-9a7893fb",
  "@metamask-previews/base-controller": "8.0.0-preview-9a7893fb",
  "@metamask-previews/bridge-controller": "16.0.0-preview-9a7893fb",
  "@metamask-previews/bridge-status-controller": "13.1.0-preview-9a7893fb",
  "@metamask-previews/build-utils": "3.0.3-preview-9a7893fb",
  "@metamask-previews/chain-agnostic-permission": "0.4.0-preview-9a7893fb",
  "@metamask-previews/composable-controller": "11.0.0-preview-9a7893fb",
  "@metamask-previews/controller-utils": "11.7.0-preview-9a7893fb",
  "@metamask-previews/delegation-controller": "0.1.0-preview-9a7893fb",
  "@metamask-previews/earn-controller": "0.12.0-preview-9a7893fb",
  "@metamask-previews/eip1193-permission-middleware": "0.1.0-preview-9a7893fb",
  "@metamask-previews/ens-controller": "16.0.0-preview-9a7893fb",
  "@metamask-previews/eth-json-rpc-provider": "4.1.8-preview-9a7893fb",
  "@metamask-previews/gas-fee-controller": "23.0.0-preview-9a7893fb",
  "@metamask-previews/json-rpc-engine": "10.0.3-preview-9a7893fb",
  "@metamask-previews/json-rpc-middleware-stream": "8.0.7-preview-9a7893fb",
  "@metamask-previews/keyring-controller": "21.0.3-preview-9a7893fb",
  "@metamask-previews/logging-controller": "6.0.4-preview-9a7893fb",
  "@metamask-previews/message-manager": "12.0.1-preview-9a7893fb",
  "@metamask-previews/multichain": "4.0.0-preview-9a7893fb",
  "@metamask-previews/multichain-api-middleware": "0.2.0-preview-9a7893fb",
  "@metamask-previews/multichain-network-controller": "0.5.1-preview-9a7893fb",
  "@metamask-previews/multichain-transactions-controller": "0.9.0-preview-9a7893fb",
  "@metamask-previews/name-controller": "8.0.3-preview-9a7893fb",
  "@metamask-previews/network-controller": "23.2.0-preview-9a7893fb",
  "@metamask-previews/notification-services-controller": "6.0.0-preview-9a7893fb",
  "@metamask-previews/permission-controller": "11.0.6-preview-9a7893fb",
  "@metamask-previews/permission-log-controller": "3.0.3-preview-9a7893fb",
  "@metamask-previews/phishing-controller": "12.5.0-preview-9a7893fb",
  "@metamask-previews/polling-controller": "13.0.0-preview-9a7893fb",
  "@metamask-previews/preferences-controller": "17.0.0-preview-9a7893fb",
  "@metamask-previews/profile-sync-controller": "12.0.0-preview-9a7893fb",
  "@metamask-previews/queued-request-controller": "10.0.0-preview-9a7893fb",
  "@metamask-previews/rate-limit-controller": "6.0.3-preview-9a7893fb",
  "@metamask-previews/remote-feature-flag-controller": "1.6.0-preview-9a7893fb",
  "@metamask-previews/sample-controllers": "0.1.0-preview-9a7893fb",
  "@metamask-previews/selected-network-controller": "22.0.0-preview-9a7893fb",
  "@metamask-previews/signature-controller": "27.1.0-preview-9a7893fb",
  "@metamask-previews/token-search-discovery-controller": "3.1.0-preview-9a7893fb",
  "@metamask-previews/transaction-controller": "54.1.0-preview-9a7893fb",
  "@metamask-previews/user-operation-controller": "33.0.0-preview-9a7893fb"
}

@salimtb
Copy link
Contributor Author

salimtb commented Apr 23, 2025

@metamaskbot publish-preview

Copy link
Contributor

Preview builds have been published. See these instructions for more information about preview builds.

Expand for full list of packages and versions.
{
  "@metamask-previews/accounts-controller": "27.0.0-preview-88150cdc",
  "@metamask-previews/address-book-controller": "6.0.3-preview-88150cdc",
  "@metamask-previews/announcement-controller": "7.0.3-preview-88150cdc",
  "@metamask-previews/app-metadata-controller": "1.0.0-preview-88150cdc",
  "@metamask-previews/approval-controller": "7.1.3-preview-88150cdc",
  "@metamask-previews/assets-controllers": "58.0.0-preview-88150cdc",
  "@metamask-previews/base-controller": "8.0.0-preview-88150cdc",
  "@metamask-previews/bridge-controller": "16.0.0-preview-88150cdc",
  "@metamask-previews/bridge-status-controller": "13.1.0-preview-88150cdc",
  "@metamask-previews/build-utils": "3.0.3-preview-88150cdc",
  "@metamask-previews/chain-agnostic-permission": "0.4.0-preview-88150cdc",
  "@metamask-previews/composable-controller": "11.0.0-preview-88150cdc",
  "@metamask-previews/controller-utils": "11.7.0-preview-88150cdc",
  "@metamask-previews/delegation-controller": "0.1.0-preview-88150cdc",
  "@metamask-previews/earn-controller": "0.12.0-preview-88150cdc",
  "@metamask-previews/eip1193-permission-middleware": "0.1.0-preview-88150cdc",
  "@metamask-previews/ens-controller": "16.0.0-preview-88150cdc",
  "@metamask-previews/eth-json-rpc-provider": "4.1.8-preview-88150cdc",
  "@metamask-previews/gas-fee-controller": "23.0.0-preview-88150cdc",
  "@metamask-previews/json-rpc-engine": "10.0.3-preview-88150cdc",
  "@metamask-previews/json-rpc-middleware-stream": "8.0.7-preview-88150cdc",
  "@metamask-previews/keyring-controller": "21.0.3-preview-88150cdc",
  "@metamask-previews/logging-controller": "6.0.4-preview-88150cdc",
  "@metamask-previews/message-manager": "12.0.1-preview-88150cdc",
  "@metamask-previews/multichain": "4.0.0-preview-88150cdc",
  "@metamask-previews/multichain-api-middleware": "0.2.0-preview-88150cdc",
  "@metamask-previews/multichain-network-controller": "0.5.1-preview-88150cdc",
  "@metamask-previews/multichain-transactions-controller": "0.9.0-preview-88150cdc",
  "@metamask-previews/name-controller": "8.0.3-preview-88150cdc",
  "@metamask-previews/network-controller": "23.2.0-preview-88150cdc",
  "@metamask-previews/notification-services-controller": "6.0.0-preview-88150cdc",
  "@metamask-previews/permission-controller": "11.0.6-preview-88150cdc",
  "@metamask-previews/permission-log-controller": "3.0.3-preview-88150cdc",
  "@metamask-previews/phishing-controller": "12.5.0-preview-88150cdc",
  "@metamask-previews/polling-controller": "13.0.0-preview-88150cdc",
  "@metamask-previews/preferences-controller": "17.0.0-preview-88150cdc",
  "@metamask-previews/profile-sync-controller": "12.0.0-preview-88150cdc",
  "@metamask-previews/queued-request-controller": "10.0.0-preview-88150cdc",
  "@metamask-previews/rate-limit-controller": "6.0.3-preview-88150cdc",
  "@metamask-previews/remote-feature-flag-controller": "1.6.0-preview-88150cdc",
  "@metamask-previews/sample-controllers": "0.1.0-preview-88150cdc",
  "@metamask-previews/selected-network-controller": "22.0.0-preview-88150cdc",
  "@metamask-previews/signature-controller": "27.1.0-preview-88150cdc",
  "@metamask-previews/token-search-discovery-controller": "3.1.0-preview-88150cdc",
  "@metamask-previews/transaction-controller": "54.1.0-preview-88150cdc",
  "@metamask-previews/user-operation-controller": "33.0.0-preview-88150cdc"
}

Copy link
Contributor

@cryptodev-2s cryptodev-2s left a comment

Choose a reason for hiding this comment

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

LGTM!

@salimtb salimtb enabled auto-merge (squash) April 23, 2025 16:33
@salimtb salimtb merged commit 1b97465 into main Apr 23, 2025
202 checks passed
@salimtb salimtb deleted the feat/remove-chainId-current-chain branch April 23, 2025 16:54
github-merge-queue bot pushed a commit to MetaMask/metamask-mobile that referenced this pull request Apr 29, 2025
<!--
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**

# Upgrade Asset Controllers to v59

- **TokenRatesController**:  
Refactored to process multiple chains at once
([#5645](MetaMask/core#5645)).
  - Now accepts an array of `chainId` values instead of a single chain.
- Simplifies the polling process by iterating over all chains within a
single loop.

- **AccountTrackerController**:  
Refactored to process multiple chains at once
([#5680](MetaMask/core#5680)).
  - Now accepts an array of `chainId` values instead of a single chain.
- Streamlines polling by looping through all chains in one unified
process.

<!--
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?
-->

## **Related issues**

Fixes:

## **Manual testing steps**

1. Go to MM wallet
2. Test the assets part ( check if the balances and prices are good on
the send/swap/tokenlist ...etc )

## **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.
github-merge-queue bot pushed a commit to MetaMask/metamask-mobile that referenced this pull request Apr 29, 2025
<!--
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**

# Upgrade Asset Controllers to v59

- **TokenRatesController**:  
Refactored to process multiple chains at once
([#5645](MetaMask/core#5645)).
  - Now accepts an array of `chainId` values instead of a single chain.
- Simplifies the polling process by iterating over all chains within a
single loop.

- **AccountTrackerController**:  
Refactored to process multiple chains at once
([#5680](MetaMask/core#5680)).
  - Now accepts an array of `chainId` values instead of a single chain.
- Streamlines polling by looping through all chains in one unified
process.

<!--
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?
-->

## **Related issues**

Fixes:

## **Manual testing steps**

1. Go to MM wallet
2. Test the assets part ( check if the balances and prices are good on
the send/swap/tokenlist ...etc )

## **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.
github-merge-queue bot pushed a commit to MetaMask/metamask-mobile that referenced this pull request Apr 29, 2025
<!--
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**

# Upgrade Asset Controllers to v59

- **TokenRatesController**:  
Refactored to process multiple chains at once
([#5645](MetaMask/core#5645)).
  - Now accepts an array of `chainId` values instead of a single chain.
- Simplifies the polling process by iterating over all chains within a
single loop.

- **AccountTrackerController**:  
Refactored to process multiple chains at once
([#5680](MetaMask/core#5680)).
  - Now accepts an array of `chainId` values instead of a single chain.
- Streamlines polling by looping through all chains in one unified
process.

<!--
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?
-->

## **Related issues**

Fixes:

## **Manual testing steps**

1. Go to MM wallet
2. Test the assets part ( check if the balances and prices are good on
the send/swap/tokenlist ...etc )

## **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.
EtherWizard33 pushed a commit to MetaMask/metamask-mobile that referenced this pull request May 2, 2025
<!--
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**

# Upgrade Asset Controllers to v59

- **TokenRatesController**:  
Refactored to process multiple chains at once
([#5645](MetaMask/core#5645)).
  - Now accepts an array of `chainId` values instead of a single chain.
- Simplifies the polling process by iterating over all chains within a
single loop.

- **AccountTrackerController**:  
Refactored to process multiple chains at once
([#5680](MetaMask/core#5680)).
  - Now accepts an array of `chainId` values instead of a single chain.
- Streamlines polling by looping through all chains in one unified
process.

<!--
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?
-->

## **Related issues**

Fixes:

## **Manual testing steps**

1. Go to MM wallet
2. Test the assets part ( check if the balances and prices are good on
the send/swap/tokenlist ...etc )

## **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.
theceo1 pushed a commit to theceo1/metamask-mobile that referenced this pull request Jun 24, 2025
<!--
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**

# Upgrade Asset Controllers to v59

- **TokenRatesController**:  
Refactored to process multiple chains at once
([MetaMask#5645](MetaMask/core#5645)).
  - Now accepts an array of `chainId` values instead of a single chain.
- Simplifies the polling process by iterating over all chains within a
single loop.

- **AccountTrackerController**:  
Refactored to process multiple chains at once
([MetaMask#5680](MetaMask/core#5680)).
  - Now accepts an array of `chainId` values instead of a single chain.
- Streamlines polling by looping through all chains in one unified
process.

<!--
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?
-->

## **Related issues**

Fixes:

## **Manual testing steps**

1. Go to MM wallet
2. Test the assets part ( check if the balances and prices are good on
the send/swap/tokenlist ...etc )

## **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.
@salimtb salimtb added team-assets area-performance Issues relating to slowness of app, cpu usage, and/or blank screens. labels Jun 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-performance Issues relating to slowness of app, cpu usage, and/or blank screens. team-assets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ GNS ] Remove usage of currentChainId for tokenRatesController
4 participants