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

[assets-controllers] TokenDetectionController uses the wrong token list #3905

Closed
Gudahtt opened this issue Feb 7, 2024 · 1 comment · Fixed by #3914
Closed

[assets-controllers] TokenDetectionController uses the wrong token list #3905

Gudahtt opened this issue Feb 7, 2024 · 1 comment · Fixed by #3914
Assignees
Labels
bug Something isn't working team-wallet-api-platform

Comments

@Gudahtt
Copy link
Member

Gudahtt commented Feb 7, 2024

The TokenDetectionController will always use the token list for the current globally selected network, even when detecting tokens on a different network. Effectively it won't work when polling non-selected networks.

We should update the controller to use the token list for the network we're detecting tokens on.

@Gudahtt Gudahtt added the bug Something isn't working label Feb 7, 2024
@adonesky1
Copy link
Contributor

Hey team! Please add your planning poker estimate with Zenhub @BelfordZ @jiexi @shanejonas

@jiexi jiexi self-assigned this Feb 9, 2024
jiexi added a commit that referenced this issue Feb 20, 2024
…assed networkClientId (#3914)

## Explanation

Currently, `detectTokens()` always uses the state for the globally
selected network from the `TokenListController` and `TokensController`
regardless of if/what networkClientId is passed in.

This PR updates `detectTokens()` to use the chainId keyed states of the
`TokenListController` and `TokensController` instead.

## References

Fixes: #3905

## Changelog

### `@metamask/assets-controllers`

- **FIXED**: `TokenDetectionController.detectTokens()` now reads the
chainId keyed state properties from `TokenListController` and
`TokensController` rather than incorrectly using the globally selected
state properties when networkClientId is passed

## 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 highlighted breaking changes using the "BREAKING" category
above as appropriate

---------

Co-authored-by: Alex Donesky <[email protected]>
Co-authored-by: Jongsun Suh <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working team-wallet-api-platform
Projects
None yet
3 participants