Skip to content
This repository was archived by the owner on Jan 20, 2021. It is now read-only.
This repository was archived by the owner on Jan 20, 2021. It is now read-only.

Optimize bundling for browser based applications #22

@fubhy

Description

@fubhy

I had one Idea for making the resulting JS bundle for melonjs more efficient. One problem that we'll face for the final release is that due to us adding all the .abis and .bin files to our code, the full bundle would get massive if we included all those directly in the Contract files. On the other hand, if we require them to be set on manually every time you instantiate a contract or every time you deploy a contract we make the developer experience kinda shitty. So instead, I was wondering if we should make it so that the Environment can be initialized with a subset of ABIs and ByteCode strings in a keyed map (keyed by contract name) and then whenever a contract is deployed or instantiated, the ABIs and ByteCode are pulled from the environment instead.

That way users who are concerned about the bundle size can pass their own environment but we could also provide a convenience initializer that has all ABIs and ByteCode pre-included
Basically, you instrantiate the environment once at the beginning with all the ABIs and ByteCode that you program is going to need or, alternatively, a factory function and then after that you never have to think about ABIs and Bytecode again.

That way, users can even further optimize the included ABIs for their use-cases by reducing it to single methods for instance - Only for the functions of the protocol that they actually need.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions