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 15 commits into
base: main
Choose a base branch
from
Open

fix: remove scoped state #5310

wants to merge 15 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

@salimtb salimtb requested a review from a team as a code owner February 14, 2025 09:27
@salimtb
Copy link
Contributor Author

salimtb commented Feb 14, 2025

@salimtb can you update the CHANGELOG files

@cryptodev-2s done 82488e2

@cryptodev-2s
Copy link
Contributor

@salimtb can you update the CHANGELOG files

@cryptodev-2s done 82488e2

@salimtb Thanks sorry for the delay can you fix the conflicts so I can approve ?

@salimtb salimtb requested review from a team as code owners February 17, 2025 14:46
@salimtb salimtb closed this Feb 17, 2025
@salimtb salimtb force-pushed the salim/remove-scoped-state branch from 6e95e44 to 422ab57 Compare February 17, 2025 14:49
@salimtb salimtb reopened this Feb 17, 2025
@salimtb salimtb force-pushed the salim/remove-scoped-state branch from 385bc55 to fa4dc5f Compare February 17, 2025 14:52
@salimtb salimtb removed request for a team February 17, 2025 14:52
@salimtb salimtb force-pushed the salim/remove-scoped-state branch from fa4dc5f to 59a7c11 Compare February 17, 2025 14:56
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