ultralight icon indicating copy to clipboard operation
ultralight copied to clipboard

Static Constructors (Tree-Shaking)

Open ScottyPoi opened this issue 9 months ago • 2 comments

All static constructors in EthereumJS packages were removed as part of tree-shaking optimizations.

Ultralight's portalnetwork package contains several static constructors. PortalNetwork.create is a big one, but also uTP packet constructors Packet.from... and possibly more.

To follow the optimization pattern executed in the EthJS packages, we would replace these static constructors with an exported function. For example, in the PortalNetwork class, public static create = async (...) => {...} would be replaced with export async function createPortalNetwork(...) {...} with the same internal logic, and moved to a new file client/constructor.ts

ScottyPoi avatar Feb 24 '25 18:02 ScottyPoi

@ScottyPoi please check the PR Will create a separate PR for the uTP etc.

cjustinobi avatar Mar 26 '25 10:03 cjustinobi

Have merged #757 which partially completes this work. Thanks @cjustinobi!

acolytec3 avatar Mar 27 '25 20:03 acolytec3