-
-
Notifications
You must be signed in to change notification settings - Fork 242
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
Conversation
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
<!-- 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.
<!-- 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.
<!-- 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.
<!-- 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.
<!-- 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.
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
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.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