[pull] main from MetaMask:main#283
Merged
Merged
Conversation
…ng (#6285) ## Explanation The PR introduces change to remove the centralized selectors and instead places a centralized calculation logic that clients can use to create their own selectors. - Current: aggregated percent/amount change for balances lives in client selectors with platform-specific nuances. - Change: introduce a pure calculator to centralize portfolio change computation and move the logic out of selectors. Callers (mobile/extension) can now request 1d/7d/30d change consistently. - Details: - EVM: uses TokenRatesController.marketData price and pricePercentChange{1d|7d|30d}, converted via CurrencyRateController. - Non‑EVM: uses MultichainAssetsRatesController.conversionRates with marketData.pricePercentChange.{P1D|P7D|P30D}. - Previous totals reconstructed via current / (1 + percent/100); amount and percent change computed from that. - Honors enabled-network filtering map (same semantics as totals calculation). ## References - Internal: ASSETS-1129 - Package: @metamask/assets-controllers - Related PR: Mobile : MetaMask/metamask-mobile#18315 Extension : MetaMask/metamask-extension#35012 ## 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 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 adopt the new calculator --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Salim TOUBAL <salim.toubal@outlook.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.3)
Can you help keep this open source service alive? 💖 Please sponsor : )