-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable the user to use only web3 as dependency #5771
Conversation
Deploying with Cloudflare Pages
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks good, I have two questions:
1- What do you think from DevEx perspective would it be better to group
ethAbi/ethIban/ethPersonal under eth
namespace? Same goes for providers
So for example
import {eth} from "web3"
eth.iban.Iban()
2- Maybe export types without namespace so they are autoimported for users and so user doesn't have to do something like: export function something(): types.Web3Api
?
Well, this is a nice suggestion. But it would bring circular dependencies. For example, currently, web3-eth-ens uses web3-eth. And to achieve the proposed situation we need to use web3-eth-ens inside web3-eth in order to export it. (We need to add web3-eth-ens to the dependencies of web3-eth and then write
Actually, that would bring conflicts because we have the same name for functions and objects that exist in different packages (the list of errors are here: #5508 (comment)). And renaming those functions/objects or consolidating them would be nice. But it would introduce some more breaking changes. Or what do you think? Thanks, |
I found a way to do it without exporting the sub-packages from inside the package (no need to write @mpetrunic |
Yeah! I guess only types are left, which ones are conflicting? Maybe it makes sense to rename or not export some? |
Thanks @mpetrunic, Actually, the conflicting types are listed here: #5508 (comment)
Suggestion: rename the
Suggestion: Rename such interfaces to be ObjectInterface and leave the class as is.
Suggestion: Move all types from
Suggestion: Move all those to
Suggestion: Actually, the two classes refer to two different things. And so, I would rename them to something like: I will start appling the mentioned suggestions. However, please, let me know if you have any concern or suggestion. Thanks, |
…hPrivateKey` and `signTransactionWithPrivateKey`
(to avoid ambiguity with the `Web3Error` class)
Few things, The second thing, I noticed is that every package has indexed with exports like
|
Thanks @mpetrunic ,
Regarding the first suggestion that is "maybe creating more namespaces could be helpful". I think it is the better approach. And thinking about it. Let us apply the same thing to our exported objects at the For the second point "not exporting some stuff". I agree that if there is something very local and not good to export we are better to keep it local. However, for the
I created an issue for this suggestion and I hope to discuss it after finishing the current one :) |
@Muhammad-Altabba good work, Over all this PR LGTM. I just added few points + there are file conflicts to check. |
Bundle StatsHey there, this message comes from a github action that helps you and reviewers to understand how these changes affect the size of this project's bundle. As this PR is updated, I'll keep you updated on how the bundle size is impacted. Total
View detailed bundle breakdownAdded
Removed No assets were removed Bigger
Smaller
Unchanged
|
Description
Fixes #5508
Type of change
Checklist for 1.x:
npm run dtslint
with success and extended the tests and types if necessary.npm run test:cov
and my test cases cover all the lines and branches of the added code.npm run build
with success.dist/web3.min.js
in a browser.CHANGELOG.md
file in the root folder.Checklist for 4.x:
yarn
successfullyyarn lint
successfullyyarn build:web
successfullyyarn test:unit
successfullyyarn test:integration
successfullycompile:contracts
successfullyCHANGELOG.md
file in the packages I have edited.