core icon indicating copy to clipboard operation
core copied to clipboard

[base-controller] Create `MessengerClient` superclass for `BaseController` and stateless non-controllers

Open MajorLift opened this issue 1 year ago • 0 comments

Explanation

Some of our classes that were previously labeled as controllers have empty state, making them non-controllers.

As part of Wallet Framework team's Q2 2024 OKRs (O3KR1), we're currently in the process of upgrading these non-controllers to use the messenger pattern without inheriting from BaseController.

To minimize redundant code, the reused portion of BaseController should be extracted into a new MessagingEndpoint (tentative) class that serves as a parent class to BaseController and all stateless non-controllers, and includes the logic a class needs in order to accept and use a messaging system.

~We should ensure that both MessengerConsumer and BaseController are compatible as base classes for the polling-controller mixins.~

References

  • See https://github.com/MetaMask/core/issues/4432
  • Followed by https://github.com/MetaMask/core/issues/4503

MajorLift avatar Jun 21 '24 15:06 MajorLift