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

Upgrade TokenDetectionController to BaseControllerV2 #3625

Closed
MajorLift opened this issue Dec 6, 2023 · 0 comments · Fixed by #3609
Closed

Upgrade TokenDetectionController to BaseControllerV2 #3625

MajorLift opened this issue Dec 6, 2023 · 0 comments · Fixed by #3609
Assignees

Comments

@MajorLift
Copy link
Contributor

MajorLift commented Dec 6, 2023

Explanation

As a preparation step for consolidating TokenDetectionController with DetectTokensController, TokenDetectionController needs to be upgraded to extend PollingController and BaseControllerV2.

References

@MajorLift MajorLift self-assigned this Dec 6, 2023
MajorLift added a commit that referenced this issue Dec 22, 2023
…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 <elliot.winkler@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant