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

Update TokenBalancesController to BaseControllerV2 #1808

Closed
mcmire opened this issue Oct 11, 2023 · 1 comment · Fixed by #3750
Closed

Update TokenBalancesController to BaseControllerV2 #1808

mcmire opened this issue Oct 11, 2023 · 1 comment · Fixed by #3750
Assignees

Comments

@mcmire
Copy link
Contributor

mcmire commented Oct 11, 2023

TokenBalancesController still inherits from BaseController (v1). In order to make all of our controllers consistent, we need to migrate this controller to BaseControllerV2.

Please use #1705 (PhishingController) as a recent reference for this type of migration.

@mcmire mcmire changed the title (assets-controllers) TokenBalancesController Update TokenBalancesController to BaseControllerV2 Oct 11, 2023
@desi
Copy link
Contributor

desi commented Dec 7, 2023

@cryptodev-2s cryptodev-2s self-assigned this Dec 14, 2023
cryptodev-2s added a commit that referenced this issue Jan 11, 2024
## Explanation

The `TokenBalancesController` has been migrated to `BaseControllerV2`.

## References

Closes #1808

## Changelog

### `@metamask/token-balances-controller`

#### Changed
- **BREAKING:** Convert to `BaseControllerV2`
- The constructor parameters have changed; rather than accepting a
"config" parameter for interval and tokens we now pass both values as
controller options, and a "state" parameter, there is now just a single
object for all constructor arguments. This object has a mandatory
`messenger` and an optional `state`, `tokens`, `interval` properties a
disabled property has also been added.
  - State now saves tokens  balances as hex and not as a BNs.
- Additional BN export has been removed as it was intended to be removed
in the next major release.

## 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants