Conversation
logic handled according to number or bigint added unit test
| */ | ||
| public async calculateFeeData( | ||
| baseFeePerGasFactor = BigInt(2), | ||
| baseFeePerGasFactor: bigint | number = BigInt(2), |
There was a problem hiding this comment.
Thanks @TemirlanBasitov I'll suggest to also add few examples and short description in above documentation comments so with this PR merge it will update docs website. https://docs.web3js.org/libdocs/Web3Eth#calculatefeedata
There was a problem hiding this comment.
@jdevcs where i can add comment and short description here?
There was a problem hiding this comment.
I adjusted description of method with examples in the web3_eth.ts
Here also short explanation:
calculateFeeData method now supports both bigint and number types for the baseFeePerGasFactor parameter. If a number is provided, it will be converted to a bigint with three decimal precision. This allows for more flexible calculations when dealing with decimal values.
Ex:
await calculateFeeData(BigInt(2));
// baseFeePerGasFactor remains as 2n
await calculateFeeData(1.5);
// baseFeePerGasFactor is converted to BigInt(1.500) for precise calculations
These changes make the method more versatile while ensuring backward compatibility with previous bigint usage.
jdevcs
left a comment
There was a problem hiding this comment.
@TemirlanBasitov PR looks good, you just need to fix Conflicting file CHANGELOG.md, thanks,
|
@krzysu @Muhammad-Altabba @luu-alex plz review |
|
|
||
| public async calculateFeeData( | ||
| baseFeePerGasFactor = BigInt(2), | ||
| baseFeePerGasFactor: bigint | number = BigInt(2), |
There was a problem hiding this comment.
@luu-alex web3-eth package's changelog is not update for this PR but root. so In release for this PR, web3-eth will be patch bump if there are no other changes in eth.
Description
Please include a summary of the changes and be sure to follow our Contribution Guidelines.
Type of change
Checklist:
npm run lintwith success and extended the tests and types if necessary.npm run test:unitwith success.npm run test:coverageand my test cases cover all the lines and branches of the added code.npm run buildand testeddist/web3.min.jsin a browser.CHANGELOG.mdfile in the root folder.