XRPLF / xrpl.js

A JavaScript/TypeScript API for interacting with the XRP Ledger in Node.js and the browser
https://xrpl.org/
1.19k stars 507 forks source link

Make xrpl.js more modular #2307

Open tequdev opened 1 year ago

tequdev commented 1 year ago

Currently xrpl.js (xrpl) is a big code, including Client and Wallet.

Even if you use only xrpl utils on the front end, it still contains Client and Wallet code.

The same goes if you want to use only the ledger or transaction models.

For example, how about splitting the code as follows?

@xrpl/wallet @xrpl/client @xrpl/models @xrpl/utils

ckniffen commented 1 year ago

I completely agree. We will try to come up with a proposal for a more modular design and present it to the community.

ckniffen commented 10 months ago

In analyzing your request the largest problem seems to be bundle size of xrpl.js. We discovered that we can address this with relatively few breaking changes. That work has culminated in xrpl 3.0 having a 50-65%+ file size reduction in the official bundle.

This was done through cleaning up dependencies and polyfills. If your own code relies on these previously required polyfills you will not see such a drastic reduction but in our tests this is about a reduction of 300kb gzipped.

The focus of 4.0 will be then be to further reduce bundle size by further focusing on tree-shaking and modularization.