web3.js icon indicating copy to clipboard operation
web3.js copied to clipboard

getFeeHistory type problem

Open Jack-Works opened this issue 1 year ago • 5 comments

Version: [email protected], [email protected]

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?

Jack-Works avatar Jul 03 '24 10:07 Jack-Works

@luu-alex

SantiagoDevRel avatar Jul 04 '24 19:07 SantiagoDevRel

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

luu-alex avatar Jul 07 '24 14:07 luu-alex

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.

Jack-Works avatar Jul 07 '24 15:07 Jack-Works

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

luu-alex avatar Jul 08 '24 13:07 luu-alex

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

sampleblood avatar Aug 05 '24 03:08 sampleblood