-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
fix: fromWei() parsing of large numbers > 10^20 #6882
fix: fromWei() parsing of large numbers > 10^20 #6882
Conversation
Prevent automatic conversion to scientific notation for numbers >= 10^21 by using BigInt, ensuring accurate string representations and avoiding parsing errors in fromWei function.
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## 4.x #6882 +/- ##
=======================================
Coverage 91.98% 91.98%
=======================================
Files 215 215
Lines 8174 8176 +2
Branches 2207 2208 +1
=======================================
+ Hits 7519 7521 +2
Misses 655 655
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
Thanks for your contribution. I found that this solution does not cover all cases because of JavaScript problem
@avkos Suddenly there is nothing the library, me or you can do about it. The precision is lost alredy before the number enters any function of the web3 library. If the user choses to use javascript numbers (instead of bigints or strings) then he will deal with precision issues because the javascript numbers system itself is not precise. Here is an example. You can see that the precision is already lost while initializing the number, not in the web3 library function.
logs:
Here is also a warning from my IDE that denotes exactly that issue. These issues you have mentioned were already there before my changes. My commits have not changed any behaviour related to that. If the user chooses to use the javascript 'number' type the value arrives in the function imprecise and there is no way the function can fix that. |
Hey there, thanks for submitting this PR :) we talked about this with the team and I think that theres limitations using number which is why this is headache dealing with large/decimal numbers. My suggestion is that if a number is at the max that javascript will allow it (which i believe in this case its 100000000000000000000), an error should produce telling the user that their number is too large, and should use string/bigInts. |
@luu-alex This is indeed a viable approach to handle this situation. But this would probably break a lot of application that already use this library. There is really big amount of application already using this library. Backwards compatibility is a real concern here. I can of course implement that, but are you sure that the error solution is good for the library? |
@luu-alex Anyways, I propose you to merge this request, because this PR is not about precision, it is about a real bug in parsing. We can open a new ticket with a PR to discuss and potentially implement something for the precision problem. These two problems are linked but still different. And the initial Ticket was not aimed to solve the precision problem. |
@sgerodes I think you bring up some good points, we can move forward with this PR. I'll create another issue on precision for discussion |
https:/web3/web3.js/blob/4.x/packages/web3-utils/CHANGELOG.md include this fix in the changelog with issue # |
@luu-alex done. I have assumed this fix would be released in version 4.6.1 |
@sgerodes we'll change that number when we plan to do next release, i changed it for you. :) thanks for this! |
![snyk-top-banner](https:/andygongea/OWASP-Benchmark/assets/818805/c518c423-16fe-447e-b67f-ad5a49b5d123) <h3>Snyk has created this PR to upgrade web3 from 1.7.4 to 4.11.0.</h3> :information_source: Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project. <hr/> ⚠️ **Warning:** This PR contains major version upgrade(s), and may be a breaking change. - The recommended version is **302 versions** ahead of your current version. - The recommended version was released on **21 days ago**. #### Issues fixed by the recommended upgrade: | | Issue | Score | Exploit Maturity | :-------------------------:|:-------------------------|:-------------------------|:------------------------- ![high severity](https://res.cloudinary.com/snyk/image/upload/w_20,h_20/v1561977819/icon/h.png 'high severity') | Improper Verification of Cryptographic Signature<br/>[SNYK-JS-BROWSERIFYSIGN-6037026](https://snyk.io/vuln/SNYK-JS-BROWSERIFYSIGN-6037026) | **63** | No Known Exploit ![high severity](https://res.cloudinary.com/snyk/image/upload/w_20,h_20/v1561977819/icon/h.png 'high severity') | Denial of Service (DoS)<br/>[SNYK-JS-DECODEURICOMPONENT-3149970](https://snyk.io/vuln/SNYK-JS-DECODEURICOMPONENT-3149970) | **63** | Proof of Concept ![high severity](https://res.cloudinary.com/snyk/image/upload/w_20,h_20/v1561977819/icon/h.png 'high severity') | Regular Expression Denial of Service (ReDoS)<br/>[SNYK-JS-ES5EXT-6095076](https://snyk.io/vuln/SNYK-JS-ES5EXT-6095076) | **63** | Proof of Concept ![medium severity](https://res.cloudinary.com/snyk/image/upload/w_20,h_20/v1561977819/icon/m.png 'medium severity') | Regular Expression Denial of Service (ReDoS)<br/>[SNYK-JS-HTTPCACHESEMANTICS-3248783](https://snyk.io/vuln/SNYK-JS-HTTPCACHESEMANTICS-3248783) | **63** | Proof of Concept ![medium severity](https://res.cloudinary.com/snyk/image/upload/w_20,h_20/v1561977819/icon/m.png 'medium severity') | Regular Expression Denial of Service (ReDoS)<br/>[SNYK-JS-COOKIEJAR-3149984](https://snyk.io/vuln/SNYK-JS-COOKIEJAR-3149984) | **63** | Proof of Concept <details> <summary><b>Release notes</b></summary> <br/> <details> <summary>Package name: <b>web3</b></summary> <ul> <li> <b>4.11.0</b> - <a href="https:/web3/web3.js/releases/tag/v4.11.0">2024-07-11</a></br><h2>[4.11.0]</h2> <h3>Fixed</h3> <h4>web3-eth-abi</h4> <ul> <li>fix encodedata in EIP-712 (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2345189302" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7095" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7095/hovercard" href="https:/web3/web3.js/pull/7095">#7095</a>)</li> </ul> <h4>web3-utils</h4> <ul> <li><code>_sendPendingRequests</code> will catch unhandled errors from <code>_sendToSocket</code> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2239483872" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/6968" data-hovercard-type="issue" data-hovercard-url="/web3/web3.js/issues/6968/hovercard" href="https:/web3/web3.js/issues/6968">#6968</a>)</li> </ul> <h4>web3-eth</h4> <ul> <li>Fixed geth issue when running a new instance, transactions will index when there are no blocks created (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2349350779" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7098" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7098/hovercard" href="https:/web3/web3.js/pull/7098">#7098</a>)</li> </ul> <h3>Changed</h3> <h4>web3-eth-accounts</h4> <ul> <li>baseTransaction method updated (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2345189302" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7095" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7095/hovercard" href="https:/web3/web3.js/pull/7095">#7095</a>)</li> </ul> <h4>web3-providers-ws</h4> <ul> <li>Update dependancies (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2359042478" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7109" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7109/hovercard" href="https:/web3/web3.js/pull/7109">#7109</a>)</li> </ul> <h4>web3-rpc-providers</h4> <ul> <li>Change request return type <code>Promise<ResultType></code> to <code>Promise<JsonRpcResponseWithResult<ResultType>></code> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2352030152" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7102" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7102/hovercard" href="https:/web3/web3.js/pull/7102">#7102</a>)</li> </ul> <h3>Added</h3> <h4>web3-eth-contract</h4> <ul> <li><code>populateTransaction</code> was added to contract methods (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2371516761" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7124" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7124/hovercard" href="https:/web3/web3.js/pull/7124">#7124</a>)</li> <li>Contract has <code>setTransactionMiddleware</code> and <code>getTransactionMiddleware</code> for automatically passing to <code>sentTransaction</code> for <code>deploy</code> and <code>send</code> functions (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2388988914" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7138" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7138/hovercard" href="https:/web3/web3.js/pull/7138">#7138</a>)</li> </ul> <h4>web3-rpc-providers</h4> <ul> <li>When error is returned with code 429, throw rate limit error (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2352030152" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7102" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7102/hovercard" href="https:/web3/web3.js/pull/7102">#7102</a>)</li> </ul> <h4>web3</h4> <ul> <li><code>web3.eth.Contract</code> will get transaction middleware and use it, if <code>web3.eth</code> has transaction middleware. (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2388988914" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7138" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7138/hovercard" href="https:/web3/web3.js/pull/7138">#7138</a>)</li> </ul> </li> <li> <b>4.10.1-dev.89711ab.0</b> - 2024-07-10 </li> <li> <b>4.10.1-dev.1436228.0</b> - 2024-07-09 </li> <li> <b>4.10.0</b> - <a href="https:/web3/web3.js/releases/tag/v4.10.0">2024-06-17</a></br><h2>[4.10.0]</h2> <h3>Added</h3> <h4>web3</h4> <ul> <li>Now when existing packages are added in web3, will be avalible for plugins via context. (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2338555038" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7088" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7088/hovercard" href="https:/web3/web3.js/pull/7088">#7088</a>)</li> </ul> <h4>web3-core</h4> <ul> <li>Now when existing packages are added in web3, will be avalible for plugins via context. (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2338555038" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7088" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7088/hovercard" href="https:/web3/web3.js/pull/7088">#7088</a>)</li> </ul> <h4>web3-eth</h4> <ul> <li><code>sendTransaction</code> in <code>rpc_method_wrappers</code> accepts optional param of <code>TransactionMiddleware</code> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2338555038" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7088" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7088/hovercard" href="https:/web3/web3.js/pull/7088">#7088</a>)</li> <li>WebEth has <code>setTransactionMiddleware</code> and <code>getTransactionMiddleware</code> for automatically passing to <code>sentTransaction</code> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2338555038" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7088" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7088/hovercard" href="https:/web3/web3.js/pull/7088">#7088</a>)</li> </ul> <h4>web3-eth-ens</h4> <ul> <li><code>getText</code> now supports first param Address</li> <li><code>getName</code> has optional second param checkInterfaceSupport</li> </ul> <h3>web3-types</h3> <ul> <li>Added <code>result</code> as optional <code>never</code> and <code>error</code> as optional <code>never in type </code>JsonRpcNotification` (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2340855419" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7091" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7091/hovercard" href="https:/web3/web3.js/pull/7091">#7091</a>)</li> <li>Added <code>JsonRpcNotfication</code> as a union type in <code>JsonRpcResponse</code> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2340855419" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7091" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7091/hovercard" href="https:/web3/web3.js/pull/7091">#7091</a>)</li> </ul> <h3>web3-rpc-providers</h3> <ul> <li>Alpha release</li> </ul> <h3>Fixed</h3> <h4>web3-eth-ens</h4> <ul> <li><code>getName</code> reverse resolution</li> </ul> <h2>What's Changed</h2> <ul> <li>release/v4.9.0 by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/luu-alex/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/luu-alex">@ luu-alex</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2311160434" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7057" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7057/hovercard" href="https:/web3/web3.js/pull/7057">#7057</a></li> <li>fix(docs): intro by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/danforbes/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/danforbes">@ danforbes</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2311000089" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7056" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7056/hovercard" href="https:/web3/web3.js/pull/7056">#7056</a></li> <li>coverage increase by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/jdevcs/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/jdevcs">@ jdevcs</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2308257803" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7051" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7051/hovercard" href="https:/web3/web3.js/pull/7051">#7051</a></li> <li>6992 getText update and getName fix by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/jdevcs/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/jdevcs">@ jdevcs</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2303112780" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7047" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7047/hovercard" href="https:/web3/web3.js/pull/7047">#7047</a></li> <li>web3 external provider - Quicknode by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/jdevcs/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/jdevcs">@ jdevcs</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2271918707" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7019" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7019/hovercard" href="https:/web3/web3.js/pull/7019">#7019</a></li> <li>fix(docs): quickstart by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/danforbes/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/danforbes">@ danforbes</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2315405942" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7062" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7062/hovercard" href="https:/web3/web3.js/pull/7062">#7062</a></li> <li>Fix SNYK for 4.x by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/avkos/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/avkos">@ avkos</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2319883284" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7064" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7064/hovercard" href="https:/web3/web3.js/pull/7064">#7064</a></li> <li>Use .snyk file for all projects by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/avkos/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/avkos">@ avkos</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2323973072" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7071" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7071/hovercard" href="https:/web3/web3.js/pull/7071">#7071</a></li> <li>fix(docs): sidebar by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/danforbes/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/danforbes">@ danforbes</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2315836907" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7063" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7063/hovercard" href="https:/web3/web3.js/pull/7063">#7063</a></li> <li>fix(docs): mastering providers by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/danforbes/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/danforbes">@ danforbes</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2321877989" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7070" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7070/hovercard" href="https:/web3/web3.js/pull/7070">#7070</a></li> <li>Remove .snyk files by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/avkos/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/avkos">@ avkos</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2325924879" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7073" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7073/hovercard" href="https:/web3/web3.js/pull/7073">#7073</a></li> <li>100% Coverage web3-utills by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/Muhammad-Altabba/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/Muhammad-Altabba">@ Muhammad-Altabba</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2297704065" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7042" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7042/hovercard" href="https:/web3/web3.js/pull/7042">#7042</a></li> <li>chore(docs): formatting by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/danforbes/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/danforbes">@ danforbes</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2325895072" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7072" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7072/hovercard" href="https:/web3/web3.js/pull/7072">#7072</a></li> <li>update gas estimation test by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/luu-alex/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/luu-alex">@ luu-alex</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2326269077" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7074" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7074/hovercard" href="https:/web3/web3.js/pull/7074">#7074</a></li> <li>fix(docs): contract-tutorial-hardhat-node by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/danforbes/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/danforbes">@ danforbes</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2326538836" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7076" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7076/hovercard" href="https:/web3/web3.js/pull/7076">#7076</a></li> <li>fix(docs): header-nav by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/danforbes/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/danforbes">@ danforbes</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2332200412" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7082" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7082/hovercard" href="https:/web3/web3.js/pull/7082">#7082</a></li> <li>fix(docs): introduction by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/danforbes/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/danforbes">@ danforbes</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2333964262" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7083" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7083/hovercard" href="https:/web3/web3.js/pull/7083">#7083</a></li> <li>fix(docs): contracts-tutorial by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/danforbes/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/danforbes">@ danforbes</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2336696485" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7084" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7084/hovercard" href="https:/web3/web3.js/pull/7084">#7084</a></li> <li>chore(docs): provider-tutorials by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/danforbes/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/danforbes">@ danforbes</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2336711941" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7085" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7085/hovercard" href="https:/web3/web3.js/pull/7085">#7085</a></li> <li>fix(docs): mastering-accounts by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/danforbes/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/danforbes">@ danforbes</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2339365470" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7089" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7089/hovercard" href="https:/web3/web3.js/pull/7089">#7089</a></li> <li>transaction middleware by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/jdevcs/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/jdevcs">@ jdevcs</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2338555038" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7088" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7088/hovercard" href="https:/web3/web3.js/pull/7088">#7088</a></li> <li>add test coverage to web3-core by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/luu-alex/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/luu-alex">@ luu-alex</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2340855419" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7091" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7091/hovercard" href="https:/web3/web3.js/pull/7091">#7091</a></li> </ul> <p><strong>Full Changelog</strong>: <a class="commit-link" href="https:/web3/web3.js/compare/v4.9.0...v4.10.0"><tt>v4.9.0...v4.10.0</tt></a></p> </li> <li> <b>4.9.1-dev.fd2982d.0</b> - 2024-05-23 </li> <li> <b>4.9.1-dev.f687df6.0</b> - 2024-05-29 </li> <li> <b>4.9.1-dev.b63af9f.0</b> - 2024-05-30 </li> <li> <b>4.9.1-dev.962b99f.0</b> - 2024-05-24 </li> <li> <b>4.9.1-dev.9086b98.0</b> - 2024-05-30 </li> <li> <b>4.9.1-dev.7537f03.0</b> - 2024-05-23 </li> <li> <b>4.9.1-dev.692987a.0</b> - 2024-05-24 </li> <li> <b>4.9.1-dev.683be62.0</b> - 2024-05-28 </li> <li> <b>4.9.1-dev.22c07ad.0</b> - 2024-05-27 </li> <li> <b>4.9.1-dev.7084665.0</b> - 2024-05-29 </li> <li> <b>4.9.0</b> - <a href="https:/web3/web3.js/releases/tag/v4.9.0">2024-05-23</a></br><h2>What's Changed</h2> <ul> <li>Release/4.8.0 by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/luu-alex/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/luu-alex">@ luu-alex</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2247024958" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/6982" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/6982/hovercard" href="https:/web3/web3.js/pull/6982">#6982</a></li> <li>web3 middleware by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/jdevcs/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/jdevcs">@ jdevcs</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2223385627" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/6951" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/6951/hovercard" href="https:/web3/web3.js/pull/6951">#6951</a></li> <li>Add default return format to the context by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/avkos/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/avkos">@ avkos</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2213189335" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/6947" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/6947/hovercard" href="https:/web3/web3.js/pull/6947">#6947</a></li> <li>Events guide 6741 by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/SantiagoDevRel/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/SantiagoDevRel">@ SantiagoDevRel</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2247756676" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/6983" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/6983/hovercard" href="https:/web3/web3.js/pull/6983">#6983</a></li> <li>Fix towei scientific notation by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/luu-alex/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/luu-alex">@ luu-alex</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2192231311" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/6908" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/6908/hovercard" href="https:/web3/web3.js/pull/6908">#6908</a></li> <li>fix(validator): generate abi name if not provided by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/MaxMustermann2/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/MaxMustermann2">@ MaxMustermann2</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2246767533" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/6981" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/6981/hovercard" href="https:/web3/web3.js/pull/6981">#6981</a></li> <li>Plugin guide 6840 draft by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/SantiagoDevRel/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/SantiagoDevRel">@ SantiagoDevRel</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2209429076" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/6941" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/6941/hovercard" href="https:/web3/web3.js/pull/6941">#6941</a></li> <li>Compare package size (wihtout image) by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/SantiagoDevRel/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/SantiagoDevRel">@ SantiagoDevRel</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2258378367" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/6994" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/6994/hovercard" href="https:/web3/web3.js/pull/6994">#6994</a></li> <li>fixed broken links by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/SantiagoDevRel/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/SantiagoDevRel">@ SantiagoDevRel</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2263508164" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7005" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7005/hovercard" href="https:/web3/web3.js/pull/7005">#7005</a></li> <li>Added plugin videos to guide by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/SantiagoDevRel/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/SantiagoDevRel">@ SantiagoDevRel</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2263450010" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7004" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7004/hovercard" href="https:/web3/web3.js/pull/7004">#7004</a></li> <li>Utils guide by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/SantiagoDevRel/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/SantiagoDevRel">@ SantiagoDevRel</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2266114025" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7008" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7008/hovercard" href="https:/web3/web3.js/pull/7008">#7008</a></li> <li>Add the missing types to the ”accounts“ by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/jdevcs/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/jdevcs">@ jdevcs</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2269084910" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7011" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7011/hovercard" href="https:/web3/web3.js/pull/7011">#7011</a></li> <li>Add extra changes to make possibility add eip4844 type as a plugin by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/avkos/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/avkos">@ avkos</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2261774453" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7000" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7000/hovercard" href="https:/web3/web3.js/pull/7000">#7000</a></li> <li>add drips funding by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/GregTheGreek/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/GregTheGreek">@ GregTheGreek</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2273782779" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7023" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7023/hovercard" href="https:/web3/web3.js/pull/7023">#7023</a></li> <li>Tests & ESLint Improvements by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/avkos/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/avkos">@ avkos</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2269533376" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7012" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7012/hovercard" href="https:/web3/web3.js/pull/7012">#7012</a></li> <li>Added troubleshooting example by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/SantiagoDevRel/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/SantiagoDevRel">@ SantiagoDevRel</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2267462792" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7009" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7009/hovercard" href="https:/web3/web3.js/pull/7009">#7009</a></li> <li>Implement a way to know which response corresponds to which request in the middleware by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/avkos/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/avkos">@ avkos</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2278502713" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7028" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7028/hovercard" href="https:/web3/web3.js/pull/7028">#7028</a></li> <li>Add type checking to unit tests by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/avkos/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/avkos">@ avkos</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2275734785" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7027" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7027/hovercard" href="https:/web3/web3.js/pull/7027">#7027</a></li> <li>fix(glossary): links by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/danforbes/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/danforbes">@ danforbes</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2283922307" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7034" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7034/hovercard" href="https:/web3/web3.js/pull/7034">#7034</a></li> <li>Add interactive code editor for tutorials by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/avkos/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/avkos">@ avkos</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2286732644" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7036" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7036/hovercard" href="https:/web3/web3.js/pull/7036">#7036</a></li> <li>fix: web3-validator browser target removed by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/PeKne/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/PeKne">@ PeKne</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2271218849" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7016" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7016/hovercard" href="https:/web3/web3.js/pull/7016">#7016</a></li> <li>catching promise - legacy provider error by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/luu-alex/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/luu-alex">@ luu-alex</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2272401384" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7022" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7022/hovercard" href="https:/web3/web3.js/pull/7022">#7022</a></li> <li>web3modal documentation by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/luu-alex/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/luu-alex">@ luu-alex</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2294187374" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7041" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7041/hovercard" href="https:/web3/web3.js/pull/7041">#7041</a></li> <li>add gas conditional if simple transaction by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/luu-alex/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/luu-alex">@ luu-alex</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2298726504" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7043" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7043/hovercard" href="https:/web3/web3.js/pull/7043">#7043</a></li> <li>fix(<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2301478195" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7044" data-hovercard-type="issue" data-hovercard-url="/web3/web3.js/issues/7044/hovercard" href="https:/web3/web3.js/issues/7044">#7044</a>): toWei trim strings with more than 20 decimal places by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/gordon-to/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/gordon-to">@ gordon-to</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2302194681" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7045" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7045/hovercard" href="https:/web3/web3.js/pull/7045">#7045</a></li> <li>allow fromwei and toWei to accept numbers as units by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/luu-alex/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/luu-alex">@ luu-alex</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2308435831" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7052" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7052/hovercard" href="https:/web3/web3.js/pull/7052">#7052</a></li> <li>use bigint power by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/luu-alex/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/luu-alex">@ luu-alex</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2310758020" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7054" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7054/hovercard" href="https:/web3/web3.js/pull/7054">#7054</a></li> <li>Fix format schema with list of objects by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/avkos/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/avkos">@ avkos</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2293968262" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7040" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7040/hovercard" href="https:/web3/web3.js/pull/7040">#7040</a></li> <li>6801 Fill gas price when baseFeePerGas==='0x0' by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/avkos/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/avkos">@ avkos</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2307184527" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7050" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7050/hovercard" href="https:/web3/web3.js/pull/7050">#7050</a></li> </ul> <h2>New Contributors</h2> <ul> <li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/MaxMustermann2/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/MaxMustermann2">@ MaxMustermann2</a> made their first contribution in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2246767533" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/6981" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/6981/hovercard" href="https:/web3/web3.js/pull/6981">#6981</a></li> <li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/danforbes/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/danforbes">@ danforbes</a> made their first contribution in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2283922307" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7034" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7034/hovercard" href="https:/web3/web3.js/pull/7034">#7034</a></li> <li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/PeKne/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/PeKne">@ PeKne</a> made their first contribution in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2271218849" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7016" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7016/hovercard" href="https:/web3/web3.js/pull/7016">#7016</a></li> <li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/gordon-to/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/gordon-to">@ gordon-to</a> made their first contribution in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2302194681" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/7045" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/7045/hovercard" href="https:/web3/web3.js/pull/7045">#7045</a></li> </ul> <p><strong>Full Changelog</strong>: <a class="commit-link" href="https:/web3/web3.js/compare/v4.8.0...v4.9.0"><tt>v4.8.0...v4.9.0</tt></a></p> </li> <li> <b>4.8.1-dev.f4e55bd.0</b> - 2024-05-22 </li> <li> <b>4.8.1-dev.f44dc5b.0</b> - 2024-05-09 </li> <li> <b>4.8.1-dev.f216540.0</b> - 2024-05-06 </li> <li> <b>4.8.1-dev.ed2781f.0</b> - 2024-04-25 </li> <li> <b>4.8.1-dev.ebbbf1e.0</b> - 2024-04-30 </li> <li> <b>4.8.1-dev.e29deea.0</b> - 2024-04-18 </li> <li> <b>4.8.1-dev.e0fc158.0</b> - 2024-05-22 </li> <li> <b>4.8.1-dev.de3e8f8.0</b> - 2024-04-26 </li> <li> <b>4.8.1-dev.dd172c7.0</b> - 2024-04-18 </li> <li> <b>4.8.1-dev.d4e937d.0</b> - 2024-04-19 </li> <li> <b>4.8.1-dev.c62ef79.0</b> - 2024-05-06 </li> <li> <b>4.8.1-dev.b413ebd.0</b> - 2024-05-02 </li> <li> <b>4.8.1-dev.ac2e180.0</b> - 2024-05-22 </li> <li> <b>4.8.1-dev.93296c2.0</b> - 2024-04-18 </li> <li> <b>4.8.1-dev.88b7e2e.0</b> - 2024-05-02 </li> <li> <b>4.8.1-dev.866469d.0</b> - 2024-05-14 </li> <li> <b>4.8.1-dev.7be0060.0</b> - 2024-04-23 </li> <li> <b>4.8.1-dev.7a470c9.0</b> - 2024-05-01 </li> <li> <b>4.8.1-dev.5fd9dbb.0</b> - 2024-04-23 </li> <li> <b>4.8.1-dev.5d2f2aa.0</b> - 2024-05-06 </li> <li> <b>4.8.1-dev.553f270.0</b> - 2024-05-21 </li> <li> <b>4.8.1-dev.53e2466.0</b> - 2024-04-22 </li> <li> <b>4.8.1-dev.419c8d3.0</b> - 2024-04-25 </li> <li> <b>4.8.1-dev.3904a46.0</b> - 2024-05-22 </li> <li> <b>4.8.1-dev.32b6b29.0</b> - 2024-05-21 </li> <li> <b>4.8.1-dev.2f73aa5.0</b> - 2024-05-16 </li> <li> <b>4.8.1-dev.1ab7a6b.0</b> - 2024-04-18 </li> <li> <b>4.8.1-dev.12c2515.0</b> - 2024-05-13 </li> <li> <b>4.8.1-dev.408125.0</b> - 2024-05-13 </li> <li> <b>4.8.0</b> - <a href="https:/web3/web3.js/releases/tag/v4.8.0">2024-04-18</a></br><h2>[4.8.0]</h2> <h3>Changed</h3> <h4>web3-eth-abi</h4> <ul> <li>Dependencies updated</li> </ul> <h4>web3-eth-accounts</h4> <ul> <li>Dependencies updated</li> </ul> <h3>Fixed</h3> <h4>web3-eth-contract</h4> <ul> <li>Fix an issue with smart contract function overloading (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2204160872" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/6922" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/6922/hovercard" href="https:/web3/web3.js/pull/6922">#6922</a>)</li> </ul> <h4>web3-utils</h4> <ul> <li>fixed toHex incorrectly hexing Uint8Arrays and Buffer (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2227303874" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/6957" data-hovercard-type="issue" data-hovercard-url="/web3/web3.js/issues/6957/hovercard" href="https:/web3/web3.js/issues/6957">#6957</a>)</li> <li>fixed isUint8Array not returning true for Buffer (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2227303874" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/6957" data-hovercard-type="issue" data-hovercard-url="/web3/web3.js/issues/6957/hovercard" href="https:/web3/web3.js/issues/6957">#6957</a>)</li> </ul> <h3>Added</h3> <h4>web3-eth-contract</h4> <ul> <li>Added a console warning in case of an ambiguous call to a solidity method with parameter overloading (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2209695331" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/6942" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/6942/hovercard" href="https:/web3/web3.js/pull/6942">#6942</a>)</li> <li>Added contract.deploy(...).decodeData(...) and contract.decodeMethodData(...) that decode data based on the ABI (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2222628324" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/6950" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/6950/hovercard" href="https:/web3/web3.js/pull/6950">#6950</a>)</li> </ul> <h4>web3-eth</h4> <ul> <li>method <code>getBlock</code> now includes properties of eip 4844, 4895, 4788 when returning block (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2206489284" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/6933" data-hovercard-type="issue" data-hovercard-url="/web3/web3.js/issues/6933/hovercard" href="https:/web3/web3.js/issues/6933">#6933</a>)</li> <li>update type <code>withdrawalsSchema</code>, <code>blockSchema</code> and <code>blockHeaderSchema</code> schemas to include properties of eip 4844, 4895, 4788 (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2206489284" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/6933" data-hovercard-type="issue" data-hovercard-url="/web3/web3.js/issues/6933/hovercard" href="https:/web3/web3.js/issues/6933">#6933</a>)</li> </ul> <h4>web3-types</h4> <ul> <li>Added <code>signature</code> to type <code>AbiFunctionFragment</code> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2204160872" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/6922" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/6922/hovercard" href="https:/web3/web3.js/pull/6922">#6922</a>)</li> <li>update type <code>Withdrawals</code>, <code>block</code> and <code>BlockHeaderOutput</code> to include properties of eip 4844, 4895, 4788 (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2206489284" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/6933" data-hovercard-type="issue" data-hovercard-url="/web3/web3.js/issues/6933/hovercard" href="https:/web3/web3.js/issues/6933">#6933</a>)</li> </ul> <h2>New Contributors</h2> <ul> <li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/ymonye/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/ymonye">@ ymonye</a> made their first contribution in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2207926057" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/6937" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/6937/hovercard" href="https:/web3/web3.js/pull/6937">#6937</a></li> </ul> </li> <li> <b>4.7.1-dev.ce59737.0</b> - 2024-04-07 </li> <li> <b>4.7.1-dev.bfb4f6f.0</b> - 2024-04-08 </li> <li> <b>4.7.1-dev.a173a8f.0</b> - 2024-03-26 </li> <li> <b>4.7.1-dev.67d8a74.0</b> - 2024-04-04 </li> <li> <b>4.7.1-dev.5a579fa.0</b> - 2024-04-05 </li> <li> <b>4.7.1-dev.578ebb6.0</b> - 2024-04-15 </li> <li> <b>4.7.1-dev.5341c3a.0</b> - 2024-03-29 </li> <li> <b>4.7.1-dev.526c6f5.0</b> - 2024-03-27 </li> <li> <b>4.7.1-dev.1c03666.0</b> - 2024-04-15 </li> <li> <b>4.7.0</b> - <a href="https:/web3/web3.js/releases/tag/v4.7.0">2024-03-26</a></br><h2>[4.7.0]</h2> <h3>added</h3> <h4>web3-eth-contract</h4> <ul> <li>Types <code>ContractDeploySend</code>, <code>ContractMethodSend</code>, <code>Web3PromiEvent</code> was exported (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2180548722" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/6883" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/6883/hovercard" href="https:/web3/web3.js/pull/6883">#6883</a>)</li> </ul> <h4>web3-eth-ens</h4> <ul> <li>Added function getText and getName in ENS and resolver classes (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2201013024" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/6914" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/6914/hovercard" href="https:/web3/web3.js/pull/6914">#6914</a>)</li> </ul> <h3>fixed</h3> <h4>web3-validator</h4> <ul> <li>Multi-dimensional arrays(with a fix length) are now handled properly when parsing ABIs (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2124422956" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/6798" data-hovercard-type="issue" data-hovercard-url="/web3/web3.js/issues/6798/hovercard" href="https:/web3/web3.js/issues/6798">#6798</a>)</li> </ul> <h4>web3-utils</h4> <ul> <li>fixed erroneous parsing of big numbers in the <code>toNumber(...)</code> function (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2179454574" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/6880" data-hovercard-type="issue" data-hovercard-url="/web3/web3.js/issues/6880/hovercard" href="https:/web3/web3.js/issues/6880">#6880</a>)</li> </ul> <h2>Contributors</h2> <p>Thank you to the community who have contributed to this release 😄:<br> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/sgerodes/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/sgerodes">@ sgerodes</a> <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2180445959" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/6882" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/6882/hovercard" href="https:/web3/web3.js/pull/6882">#6882</a><br> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/EtlesL/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/EtlesL">@ EtlesL</a> <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2155539244" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/6836" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/6836/hovercard" href="https:/web3/web3.js/pull/6836">#6836</a><br> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/Jouzep/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/Jouzep">@ Jouzep</a> <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2165436485" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/6853" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/6853/hovercard" href="https:/web3/web3.js/pull/6853">#6853</a><br> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/sarthak1dev/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/sarthak1dev">@ sarthak1dev</a> <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2173303300" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/6867" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/6867/hovercard" href="https:/web3/web3.js/pull/6867">#6867</a><br> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/edison1105/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/edison1105">@ edison1105</a> <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2180756685" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/6885" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/6885/hovercard" href="https:/web3/web3.js/pull/6885">#6885</a><br> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/gucovip/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/gucovip">@ gucovip</a> <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2180783208" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/6886" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/6886/hovercard" href="https:/web3/web3.js/pull/6886">#6886</a><br> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/testwill/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/testwill">@ testwill</a> <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2180928823" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/6889" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/6889/hovercard" href="https:/web3/web3.js/pull/6889">#6889</a><br> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/pengqiseven/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https:/pengqiseven">@ pengqiseven</a> <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2177225650" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/6878" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/6878/hovercard" href="https:/web3/web3.js/pull/6878">#6878</a></p> </li> <li> <b>4.6.1-dev.f943944.0</b> - 2024-03-20 </li> <li> <b>4.6.1-dev.e383ae3.0</b> - 2024-03-08 </li> <li> <b>4.6.1-dev.d254316.0</b> - 2024-03-11 </li> <li> <b>4.6.1-dev.c4e039a.0</b> - 2024-03-25 </li> <li> <b>4.6.1-dev.a83e9d5.0</b> - 2024-03-25 </li> <li> <b>4.6.1-dev.a1f9dc4.0</b> - 2024-03-12 </li> <li> <b>4.6.1-dev.9657b86.0</b> - 2024-03-12 </li> <li> <b>4.6.1-dev.6d0a0ae.0</b> - 2024-03-12 </li> <li> <b>4.6.1-dev.6187f30.0</b> - 2024-03-12 </li> <li> <b>4.6.1-dev.43e70c1.0</b> - 2024-03-12 </li> <li> <b>4.6.1-dev.383af39.0</b> - 2024-03-12 </li> <li> <b>4.6.1-dev.2373e94.0</b> - 2024-03-15 </li> <li> <b>4.6.1-dev.1f81ff0.0</b> - 2024-03-20 </li> <li> <b>4.6.1-dev.16a2c27.0</b> - 2024-03-14 </li> <li> <b>4.6.0</b> - <a href="https:/web3/web3.js/releases/tag/v4.6.0">2024-03-08</a></br><h2>[4.6.0]</h2> <h3>Added</h3> <h4>web3</h4> <ul> <li>Added EIP-6963 utility function <code>requestEIP6963Providers</code> for multi provider discovery</li> </ul> <h4>web3-eth</h4> <ul> <li>Added <code>eth.getMaxPriorityFeePerGas</code> method (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2095852522" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/6748" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/6748/hovercard" href="https:/web3/web3.js/pull/6748">#6748</a>)</li> </ul> <h4>web3-eth-ens</h4> <ul> <li>Added function <code>setAddress</code> in ENS and Resolver classes (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1640585775" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/5956" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/5956/hovercard" href="https:/web3/web3.js/pull/5956">#5956</a>)</li> </ul> <h4>web3-rpc-methods</h4> <ul> <li>Added <code>getMaxPriorityFeePerGas</code> method (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2095852522" data-permission-text="Title is private" data-url="https:/web3/web3.js/issues/6748" data-hovercard-type="pull_request" data-hovercard-url="/web3/web3.js/pull/6748/hovercard" href="https:/web3/web3.js/pull/6748">#6748</a>)</li> </ul> <h4>web3-types</h4> <ul> <li>Type <code>FeeData</code> to be filled by <code>await web3.eth.calculateFeeData()</code> to be used with EIP-1559 transactions (<a class="issue-link js-issue-link" data-error-text="Failed to lo…
Prevent automatic conversion to scientific notation for numbers >= 10^21 by using BigInt, ensuring accurate string representations and avoiding parsing errors in fromWei function.
Fixes #6880
Description
Current errornous behaviour examples:
The following code performs silently a wrong parsing because of this Issue
19999 ETH was parsed as 1.9 ETH with little code, that felt very intutive. Just using parseFloat. Which probably many of the devs use after they receive a string from "fromWei".
Explanation of the behaviour
When converting large numerical values from wei to ether using fromWei, we encounter an issue where numbers greater than or equal to 10^21 are automatically represented in scientific notation by JavaScript. This conversion introduces an additional decimal point into the string representation (1.9.99999999999999e+22 for 19999999999999990000000), leading to significant parsing errors and value distortion upon further processing (e.g., when using parseFloat, 19999 ETH incorrectly becomes 1.9 ETH).
JavaScript's default behavior of converting large numbers to scientific notation when stringified is the underlying cause. This automatic conversion impacts the string manipulation logic within the fromWei function, resulting in malformed outputs for large wei values.
Solution
I have implemented a conditional check to utilize BigInt for numbers that are at risk of being automatically converted to scientific notation (>= 10^21).
Type of change
Checklist:
npm run lint
with success and extended the tests and types if necessary.npm run test:unit
with success.npm run test:coverage
and my test cases cover all the lines and branches of the added code.npm run build
and testeddist/web3.min.js
in a browser.CHANGELOG.md
file in the root folder.