web3 / web3.js

Collection of comprehensive TypeScript libraries for Interaction with the Ethereum JSON RPC API and utility functions.
https://web3js.org/
Other
19.15k stars 4.9k forks source link

getFeeHistory type problem #7135

Open Jack-Works opened 2 months ago

Jack-Works commented 2 months ago

Version: web3-types@1.7.0, web3-eth@4.8.0

https://docs.web3js.org/guides/web3_upgrade_guide/x/web3_eth_migration_guide#web3ethgetfeehistory

document

Actual type:

{
    readonly oldestBlock: bigint;
    readonly baseFeePerGas: bigint; // !! Not a string[] in the document or 1.x !!
    readonly reward: bigint[][];
    readonly gasUsedRatio: bigint[];
}
document

Which one is true?

SantiagoDevRel commented 2 months ago

@luu-alex

luu-alex commented 2 months ago

Hey Thanks for reporting this, we wont be able to update this for the V4 has this would be a breaking change but this is something we can change back for the next major release. in the meantime you can use web3.utils to change bigint -> hex

Jack-Works commented 2 months ago

Hey Thanks for reporting this, we wont be able to update this for the V4 has this would be a breaking change but this is something we can change back for the next major release. in the meantime you can use web3.utils to change bigint -> hex

I just want to know which one is correct, document or type definition, not asking for a breaking change.

luu-alex commented 2 months ago

With 4.x, baseFeePerGas will return bigint. The type definition is correct. Thanks for catching this, if you would like to create a PR to fix the docs feel free. Otherwise @SantiagoDevRel can you take care of this problem

sampleblood commented 1 month ago

readonly baseFeePerGas: import("web3-types").NumberTypes[ReturnFormat["number"]]; should be Array?: readonly baseFeePerGas: import("web3-types").NumberTypes[ReturnFormat["number"]][];