Skip to content
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

fix: remove scoped state #5310

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

fix: remove scoped state #5310

wants to merge 13 commits into from

Conversation

salimtb
Copy link
Contributor

@salimtb salimtb commented Feb 11, 2025

Explanation

The assets-controllers package has been updated to remove scoped state on TokensController, TokenListController, and AccountTrackerController. Previously, these controllers contained fields in their state that were scoped to the current chain, while others were keyed by chain ID. The former approach is now deprecated and has been removed in favor of querying state by chain ID.

Changes Implemented:

  • Deprecated and removed state fields that were scoped to the current chain.
  • Ensured all clients use per-chain variants of these state fields.
  • Removed logic in controllers that updated the deprecated fields.

Removed State Fields and Their Replacements:

  • TokensController:
    • Removed: tokens, ignoredTokens, detectedTokens
    • Use instead: allTokens, allIgnoredTokens, allDetectedTokens
  • AccountTrackerController:
    • Removed: accounts
    • Use instead: accountsByChain
  • TokenListController:
    • Removed: tokenList
    • Use instead: tokensChainsCache

References

Changelog

@metamask/assets-controllers

  • REMOVED: Deprecated state fields scoped to the current chain.
  • CHANGED: Updated TokensController, TokenListController, and AccountTrackerController to use per-chain state variants.

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 highlighted breaking changes using the "BREAKING" category above as appropriate
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

@salimtb salimtb changed the title Salim/remove scoped state fix: remove scoped state Feb 11, 2025
@salimtb salimtb marked this pull request as ready for review February 11, 2025 18:16
@salimtb salimtb requested a review from a team as a code owner February 11, 2025 18:16
@cryptodev-2s
Copy link
Contributor

@salimtb can you update the CHANGELOG files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Assets Controllers] Remove state scoped to the current chain
2 participants