Skip to content
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

Add optional param hex to getTransaction and getBlock. #5845

Merged

Conversation

Muhammad-Altabba
Copy link
Contributor

@Muhammad-Altabba Muhammad-Altabba commented Feb 16, 2023

Description

Fixes #5761 and #5703 by adding an optional parameter hex for both getTransaction and getBlock.
However, another optional bigIntOnOverflow has been added at hexToNumber and toNumber only. Which introduces a functionality similar to 4.x for those 2 functions only.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist for 1.x:

  • I have selected the correct base branch.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • Any dependent changes have been merged and published in downstream modules.
  • I ran npm run dtslint with success and extended the tests and types if necessary.
  • I ran npm run test:cov and my test cases cover all the lines and branches of the added code.
  • I ran npm run build with success.
  • I have tested the built dist/web3.min.js in a browser.
  • I have tested my code on the live network.
  • I have checked the Deploy Preview and it looks correct.
  • I have updated the CHANGELOG.md file in the root folder.

Checklist for 4.x:

  • I have selected the correct 4.x base branch.
  • Within the description, the feature or issue is discussed in detail or an issue is linked.
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added any required tests for the changes I made
  • I have made corresponding changes to the documentation
  • Any dependent changes have been merged and published in downstream modules.
  • I ran yarn successfully
  • I ran yarn lint successfully
  • I ran yarn build:web successfully
  • I ran yarn test:unit successfully
  • I ran yarn test:integration successfully
  • I ran compile:contracts successfully
  • I have tested my code.
  • I have updated the corresponding CHANGELOG.md file in the packages I have edited.

@coveralls
Copy link

coveralls commented Feb 16, 2023

Pull Request Test Coverage Report for Build 4252570288

  • 20 of 26 (76.92%) changed or added relevant lines in 2 files are covered.
  • 469 unchanged lines in 10 files lost coverage.
  • Overall coverage decreased (-2.4%) to 72.612%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/web3-core-helpers/src/formatters.js 18 19 94.74%
packages/web3-utils/src/utils.js 2 7 28.57%
Files with Coverage Reduction New Missed Lines %
packages/web3-core-requestmanager/src/jsonrpc.js 2 82.76%
packages/web3-core-method/lib/index.js 4 93.82%
packages/web3-utils/lib/utils.js 13 91.12%
packages/web3-core-helpers/lib/formatters.js 18 81.2%
packages/web3-core-helpers/src/formatters.js 24 80.58%
packages/web3-core-helpers/src/errors.js 31 4.41%
packages/web3-utils/src/soliditySha3.js 55 5.13%
packages/web3-utils/src/index.js 58 36.89%
packages/web3-utils/src/utils.js 95 12.87%
packages/web3-eth-accounts/src/index.js 169 23.26%
Totals Coverage Status
Change from base Build 4135806385: -2.4%
Covered Lines: 3440
Relevant Lines: 4458

💛 - Coveralls

Copy link
Contributor

@jdevcs jdevcs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

build files indistshould be removed, as these are only included in release PR.

@Muhammad-Altabba Muhammad-Altabba marked this pull request as draft February 20, 2023 11:28
@Muhammad-Altabba Muhammad-Altabba marked this pull request as ready for review February 20, 2023 23:40
@Muhammad-Altabba Muhammad-Altabba changed the title Update hexToNumber to return big numbers as strings Add optional param hex for getTransaction and getBlock. Feb 21, 2023
@Muhammad-Altabba Muhammad-Altabba changed the title Add optional param hex for getTransaction and getBlock. Add optional param hex to getTransaction and getBlock. Feb 21, 2023
@luu-alex
Copy link
Contributor

Thanks for this change Muhammad, it looks good. One thing can you update the documentation too, https://web3js.readthedocs.io/en/v1.8.2/web3-utils.html#hextonumber

@jdevcs jdevcs added the 1.x 1.0 related issues label Feb 21, 2023
packages/web3-utils/src/utils.js Outdated Show resolved Hide resolved
@Muhammad-Altabba Muhammad-Altabba merged commit e4b25bf into 1.x Feb 23, 2023
@Muhammad-Altabba Muhammad-Altabba deleted the fix/5761/enable-hexToNumber-to-handle-large-numbers branch February 23, 2023 15:46
@jdevcs jdevcs mentioned this pull request Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.x 1.0 related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error: Number can only safely store up to 53 bits
6 participants