Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

[4.x] Use web3 as only dependency #5508

@mpetrunic

Description

@mpetrunic

Is there an existing issue for this?

  • I have searched the existing issues

Feature Request

Expecting users to know what resides in which web3 package is optimistic, to say the least. It's hard for me (even though I do have extensive experience in developing apps), can't imagine how new web3 developers will find their way.

That said, you don't need to sacrifice tree shaking to achieve that.

Use Cases

Importing types and functionality from a bunch of different web3 packages is hard without knowing which package contains what.

It's also making it hard to link web3 and test changes against the dev version of web3.

Implementation Ideas

You can see solutions in existing sdks like:

Just do named re-export of all the required types, classes, and functions (you can even group them to make it easier for users). When a user uses named import, it will tree shake all not imported code paths.

Example usage would then be:

import {Web3, Contract} from "web3";

const web3 = new Web3(...)
const contract = new Contract(abi, address)
contract.link(web3) or whatever

Feature Examples/References

Are you willing to implement this feature?

  • Yes

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions