Skip to content

Modules: loadModules and register functions instead of classes#4156

Open
MicahMaphet wants to merge 3 commits intobitpay:masterfrom
MicahMaphet:load-modules
Open

Modules: loadModules and register functions instead of classes#4156
MicahMaphet wants to merge 3 commits intobitpay:masterfrom
MicahMaphet:load-modules

Conversation

@MicahMaphet
Copy link
Copy Markdown
Contributor

@MicahMaphet MicahMaphet commented May 5, 2026

Description

The Modules class logic was unnecessarily coupled. Made modules logic more isolated by replacing the Modules singleton with the loadModules function and removing convoluted inheritance. Modules no longer export classes, but instead export register functions.

The goal is entirely readability. The module classes had no need for internal state, all they do is call a few functions once.

Changelog

  • Single loadModules function instead of Modules singleton
  • Instead of the modules being classes, they export register functions
  • Import P2P, Libs, CSP, and Verification from modules instead of passing from Modules
  • Blew away RippleEventAdapter
  • Blew away effectively unused interface IService and unused class BaseModule
  • Updated tests accordingly
  • test/unit/modules.test.ts verifyModules was redone to account for loosing Modules internal state

Checklist

  • I have read CONTRIBUTING.md and verified that this PR follows the guidelines and requirements outlined in it.

@MicahMaphet MicahMaphet changed the title Standalone loadModules function Modules: loadModules and register functions instead of classes May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant