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: fix token import flow #4924

Merged
merged 2 commits into from
Nov 13, 2024
Merged

fix: fix token import flow #4924

merged 2 commits into from
Nov 13, 2024

Conversation

salimtb
Copy link
Contributor

@salimtb salimtb commented Nov 13, 2024

Explanation

As autodetection is now multi-chain, the addTokens function must be adjusted by taking the allTokens and filter on chainId into account to avoid importing the wrong tokens.

The addTokens function currently operates by taking the existing list of imported tokens ( without considering the network ) and adding the tokens specified in the tokensToImport parameter. This approach can result in incorrect tokens being imported, as it doesn’t filter by chain. To address this, we use allTokens to ensure accurate filtering by chain.

References

Changelog

@metamask/assets-controllers

  • CHANGED: addTokens should rely now on allTokens

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 marked this pull request as ready for review November 13, 2024 15:53
@salimtb salimtb requested a review from a team as a code owner November 13, 2024 15:53
@salimtb salimtb merged commit 37d2c1e into main Nov 13, 2024
120 checks passed
@salimtb salimtb deleted the salim/fix-tokens-import branch November 13, 2024 16:28
@bergeron bergeron mentioned this pull request Nov 13, 2024
bergeron added a commit that referenced this pull request Nov 13, 2024
Patch release of assets controllers to include
#4924
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.

3 participants