Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[token-detection-controller] Refactor
detectTokens
method (#3938)
## 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 <[email protected]> Co-authored-by: Elliot Winkler <[email protected]>
- Loading branch information