-
Notifications
You must be signed in to change notification settings - Fork 30.5k
web3: added Utils methods to static Web3 class #27898
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
Conversation
|
@zlumer Thank you for submitting this PR! 🔔 @simon-jentzsch @nitzantomer @zurbo @yxliang01 @phra @naddison36 @icaroharry @linusnorton @jpeletier @anneau @matrushka @andrevmatos @levino - please review this PR in the next few days. Be sure to explicitly select If no reviewer appears after a week, a DefinitelyTyped maintainer will review the PR instead. |
|
I think the current state of PR is not fixing the issue, because of the 'utils' is a static property of Web3 class. It could be resolved like this: declare class Web3 {
...
static utils: Utils;
...
} |
levino
left a comment
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.
This PR would introduce a bug instead of fixing the issue. Maybe the issue should be made more precise for collaborators to understand the problem. #27851
types/web3/web3-tests.ts
Outdated
|
|
||
| const weiStr: string = web3.utils.toWei("100", "gwei"); | ||
| const weiBn: BigNumber = web3.utils.toWei(web3.utils.toBN("1")); | ||
| const rndHex: string = Web3.randomHex(10); |
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.
Web3 does not have a method randomHex. Web3.utils has.
|
@zlumer One or more reviewers has requested changes. Please address their comments. I'll be back once they sign off or you've pushed new commits or comments. Thank you! |
|
@levino good catch, fixed. |
|
See also #27963 |
|
@zlumer @archangel-irk was faster than you. Lets close your PR in favour of #27963 Remark: If we would accept your PR we would have f42b3db forever in the history (including a bug). If anyone would be stupid enough to cherry pick, they would have a problem. It is better to remove such footguns from the history by rebasing and squashing the commits into one and then force push over your branch here. This is just a remark for future PRs. |
|
🔔 @levino - Thanks for your review of this PR! Can you please look at the new code and update your review status if appropriate? |
|
@levino agree, closing. |
Fixes #27851
Use a meaningful title for the pull request. Include the name of the package modified.
Test the change in your own code. (Compile and run.)
Add or edit tests to reflect the change. (Run with
npm test.)Follow the advice from the readme.
Avoid common mistakes.
Run
npm run lint package-name(ortscif notslint.jsonis present).Provide a URL to documentation or source code which provides context for the suggested changes: http://web3js.readthedocs.io/en/1.0/web3.html#utils