Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Change default return type for integer values to BigInt #5137

Merged
merged 29 commits into from
Jun 21, 2022

Conversation

nazarhussain
Copy link
Contributor

Description

Fixes #5128

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:

  • 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.

@nazarhussain nazarhussain linked an issue Jun 15, 2022 that may be closed by this pull request
2 tasks
@nazarhussain nazarhussain self-assigned this Jun 15, 2022
@nazarhussain nazarhussain added the 4.x 4.0 related label Jun 15, 2022
@nazarhussain nazarhussain marked this pull request as ready for review June 15, 2022 14:12
Base automatically changed from nh/5125-4.x-refactor to 4.x June 16, 2022 15:25
Copy link
Contributor

@avkos avkos left a comment

Choose a reason for hiding this comment

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

Some of the tests are not passing. it will be great to fix it

jdevcs
jdevcs previously requested changes Jun 20, 2022
@@ -60,9 +60,9 @@ export type DataFormat = {
readonly bytes: FMT_BYTES;
};

export const DEFAULT_RETURN_FORMAT = { number: FMT_NUMBER.HEX, bytes: FMT_BYTES.HEX } as const;
export const DEFAULT_RETURN_FORMAT = { number: FMT_NUMBER.BIGINT, bytes: FMT_BYTES.HEX } as const;
export const ETH_DATA_FORMAT = { number: FMT_NUMBER.HEX, bytes: FMT_BYTES.HEX } as const;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
export const ETH_DATA_FORMAT = { number: FMT_NUMBER.HEX, bytes: FMT_BYTES.HEX } as const;
export const ETH_INPUT_DATA_FORMAT = { number: FMT_NUMBER.HEX, bytes: FMT_BYTES.HEX } as const;

I think should rename its all occurrences for better readability.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jdevcs As per my knowledge, Eth implementation follows the same format for input/output. In that aspect I named this value as ETH_DATA_FORMAT. Please suggest if you think ETH_INPUT_DATA_FORMAT is better usage?

const networkType = await getId(this, DEFAULT_RETURN_FORMAT); // get the network from provider
const networkType = await getId(this, {
...DEFAULT_RETURN_FORMAT,
number: FMT_NUMBER.HEX,
Copy link
Contributor

Choose a reason for hiding this comment

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

If we always want to have number:FMT_NUMBER.HEX here why we are using default format?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To not redefine bytes format. You can't define just one format while declaring one data format.

@nazarhussain nazarhussain requested a review from jdevcs June 21, 2022 14:53
@nazarhussain nazarhussain dismissed jdevcs’s stale review June 21, 2022 20:41

@JDevC Need to merge this PR as another PR is based on it. If you think we still need to make further changes, we can do it with a separate issue.

@nazarhussain
Copy link
Contributor Author

@jdevcs Need to merge this PR as another PR is based on it. If you think we still need to make further changes, we can do it with a separate issue.

@nazarhussain nazarhussain merged commit 0beb794 into 4.x Jun 21, 2022
@nazarhussain nazarhussain deleted the nh/5128-default-return-type branch June 21, 2022 20:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
4.x 4.0 related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change default return type for integer values to BigInt
4 participants