Rethink utils #2690
Labels
2.x
2.0 related issues
Enhancement
Includes improvements or optimizations
Stale
Has not received enough activity
Currently the instance of
web3
has a member variableutils
which provides static util methods. So a lot of people who only need a static utils method likerandomHex
do this:Which is totally wrong an awkward. There is no reason to attach the utils to the instance of web3. Right now one can use the package
web3-utils
for an easier approach:This is nicer but also a little annoying to do. I recommend to export the Utils as a variable at the global export object. Then one can do this:
To emphasize: Any method or variable that does not need instance state should always be static and never a member variable of a classes instance.
The text was updated successfully, but these errors were encountered: