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

[token-detection-controller] Remove limit on number of tokens that can be detected #3661

Closed
MajorLift opened this issue Dec 13, 2023 · 1 comment · Fixed by #3938
Closed
Assignees
Labels
bug Something isn't working team-wallet-framework

Comments

@MajorLift
Copy link
Contributor

MajorLift commented Dec 13, 2023

Currently, the detectTokens method in TokenDetectionController has a hardcoded upper limit of 2000 on the number of tokens it can process.

  • This logic should be rewritten so that any number of tokens can be processed in batches of 1000.
  • Unit tests need to be written.
@DhifallahOussema
Copy link

Hello, I'm intrested in this issue and wanted to know if I'm still able to solve it.
I thought about a possible approach where we run a loop that splits the tokensToDetect into slices of 1000 token each.
Please let me know if it's still available so I can add a PR.

MajorLift added a commit that referenced this issue Feb 27, 2024
- Fixes #3661

Co-authored-by: Brian Bergeron <brian.e.bergeron@gmail.com>
MajorLift added a commit that referenced this issue Feb 27, 2024
- Fixes #3661

Co-authored-by: Brian Bergeron <brian.e.bergeron@gmail.com>
@MajorLift MajorLift self-assigned this Mar 1, 2024
MajorLift added a commit that referenced this issue Mar 4, 2024
## Explanation

Adds refactors and cosmetic, typing fixes to #3923.

- Extracts three methods from `TokenDetectionController`'s
`detectTokens` method:
  - `#getCorrectChainIdAndNetworkClientId`
  - `#getTokenListAndSlicesOfTokensToDetect`
  - `#addDetectedTokens`
- Maintains distinction between class fields `#selectedAddress`,
`#networkClientId` and corresponding parameters used in `detectTokens`
and its helper methods, so that `detectTokens` method can be used
independently of polling/passive detection.
- [Refactor
`#getCorrectChainIdAndNetworkClientId`](c75fb3b)
to remove `findNetworkClientIdByChainId` which might return
inconsistent/unexpected results, and replace it with `getState`,
`getNetworkClientById`
- [Add missing method return
types](5c2e887)
- [Type networkClientId as
`NetworkClientId`](05be5d2)
- [Fix excess properties from legacy token list, define `LegacyToken`,
`TokenDetectionMap`](ea4c5b8)
- Removes `#chainId` class field.

## References

- Closes #1614
- Fixes #3661
- Blocked by (Follows from) #3923
- Blocking #3916
- Blocking #3918

## Changelog

## 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: Brian Bergeron <brian.e.bergeron@gmail.com>
Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
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-framework
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants