ecashaddrjs has limped and served well despite numerous legacy dependencies and an older structure. Aside from some maintenance headaches, this was acceptable and "good enough."
However, we would like to
- Add more address lib features
- Optionally support more address types
- Reduce the use of third-party dependencies
In starting to reduce the use of third-party dependencies, it was discovered that basic hash methods available in ecash-lib after initWasm were needed to match existing ecashaddrjs functionality without third-party dependencies. It would not make sense to have ecashaddrjs work only if initWasm() were called in ecash-lib -- so we move the address functions to ecash-lib. Then, though, we still would like to not require the entire ecash-lib dependency for apps like chronik-client which barely use ecashaddrjs functionality.
Solution
- Remove all dependencies from ecashaddrjs; this requires getting rid of toLegacy, which we add into ecash-lib
- Breaking change version bump for ecashaddrjs to get rid of other technical debt (tree-shakeable exports so apps only pull in the functions they need, not the whole thing, and better typing, no more chronikReady param which confused typescript about return types)
- New Address class in ecash-lib with full-featured address management
- New legacyaddr.ts functions in ecash-lib for handling legacy addresses with zero deps (since we have hashing available in ecash-lib, and now also b58-ts with no deps)
- Implement ecashaddrjs with breaking change in all monorepo apps