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

Convert AddressBookController from BaseControllerV1 to BaseControllerV2 #4070

Closed
desi opened this issue Mar 18, 2024 · 0 comments · Fixed by #4392
Closed

Convert AddressBookController from BaseControllerV1 to BaseControllerV2 #4070

desi opened this issue Mar 18, 2024 · 0 comments · Fixed by #4392
Assignees

Comments

@desi
Copy link
Contributor

desi commented Mar 18, 2024

Considering that converting TokenDetectionController to BaseController v2 took longer than expected due to unforeseen changes, we want to be more conscientious about converting AddressBookController.

Figure out all of the changes we would want to make in upgrading this controller, outline those changes here and create new tickets if appropriate.

@desi desi changed the title AddressBookController Convert AddressBookController from BaseControllerV1 to BaseControllerV2 Mar 18, 2024
@kanthesha kanthesha self-assigned this May 27, 2024
kanthesha added a commit that referenced this issue Jun 11, 2024
## Explanation

<!--
Thanks for your contribution! Take a moment to answer these questions so
that reviewers have the information they need to properly understand
your changes:

* What is the current state of things and why does it need to change?
* What is the solution your changes offer and how does it work?
* Are there any changes whose purpose might not obvious to those
unfamiliar with the domain?
* If your primary goal was to update one package but you found you had
to update another one along the way, why did you do so?
* If you had to upgrade a dependency, why did you do so?
-->
In this, the AddressBookController has been upgraded to
BaseControllerV2. The upgrade includes AddressBookController inheriting
BaseController v2 instead of BaseController v1. This affects the
constructor and the also the way state is updated inside the controller.

## References

<!--
Are there any issues that this pull request is tied to? Are there other
links that reviewers should consult to understand these changes better?

For example:

* Fixes #12345
* Related to #67890
-->
Fixes #4070 

## Changelog

<!--
If you're making any consumer-facing changes, list those changes here as
if you were updating a changelog, using the template below as a guide.

(CATEGORY is one of BREAKING, ADDED, CHANGED, DEPRECATED, REMOVED, or
FIXED. For security-related issues, follow the Security Advisory
process.)

Please take care to name the exact pieces of the API you've added or
changed (e.g. types, interfaces, functions, or methods).

If there are any breaking changes, make sure to offer a solution for
consumers to follow once they upgrade to the changes.

Finally, if you're only making changes to development scripts or tests,
you may replace the template below with "None".
-->

`@metamask/address-book-controller`
### Added

- New types for `AddressBookController` messenger actions 
  - `AddressBookControllerGetStateAction`
  -  `AddressBookControllerActions`
- New types for `AddressBookController` messenger events
  - `AddressBookControllerStateChangeEvent`
  - `AddressBookControllerEvents`
- New `AddressBookControllerMessenger` type
- New `getDefaultAddressBookControllerState` function to get the default
state of the controller

### Changed

- **BREAKING:** Changed superclass of `AddressBookController` from
BaseController v1 to BaseController v2
- **BREAKING:** Renamed `AddressBookState` to
`AddressBookControllerState`
- **BREAKING:** Changed `constructor` arguments. Removed `config` and
added `messenger` for communication.

### Removed

- **BREAKING:** Removed `AddressBookConfig` type

## 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.

2 participants