Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade
TokenDetectionController
to extend BaseControllerV2
, `Sta…
…ticIntervalPollingController` (#3609) ## Explanation This upgrades `TokenDetectionController` to extend `BaseControllerV2` and `StaticIntervalPollingController` as a preparation step for merging `TokenDetectionController` with `DetectTokensController`. ## References - See #1813 - See #1509 - Closes #3625 ## Changelog ### Added - `TokenListController` now exports a `TokenListControllerMessenger` type ([#3609](#3609)). - `TokenDetectionController` exports types `TokenDetectionControllerMessenger`, `TokenDetectionControllerActions`, `TokenDetectionControllerGetStateAction`, `TokenDetectionControllerEvents`, `TokenDetectionControllerStateChangeEvent` ([#3609](#3609)). - Add `enable` and `disable` methods to `TokenDetectionController`, which control whether the controller is able to make polling requests or all of its network calls are blocked. ([#3609](#3609)). - Note that if the controller is initiated without the `disabled` constructor option set to `false`, the `enable` method will need to be called before the controller can make polling requests in response to subscribed events. ### Changed - **BREAKING:** `TokenDetectionController` is upgraded to extend `BaseControllerV2` and `StaticIntervalPollingController` ([#3609](#3609)). - The constructor now expects an options object as its only argument, with required properties `messenger`, `networkClientId`, required callbacks `onPreferencesStateChange`, `getBalancesInSingleCall`, `addDetectedTokens`, `getTokenState`, `getPreferencesState`, and optional properties `disabled`, `interval`, `selectedAddress`. ## 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: Elliot Winkler <[email protected]>
- Loading branch information