Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace FetchBlockFeeHistory

Index

Type aliases

Block<Percentile>: { baseFeePerGas: BN; gasUsedRatio: number; number: BN; priorityFeesByPercentile: Record<Percentile, BN> }
property

number - The number of the block, as a BN.

property

baseFeePerGas - The base fee per gas for the block in WEI, as a BN.

property

gasUsedRatio - A number between 0 and 1 that represents the ratio between the gas paid for the block and its set gas limit.

property

priorityFeesByPercentile - The priority fees paid for the transactions in the block that occurred at particular levels at which those transactions contributed to the overall gas used for the block, indexed by those percentiles. (See docs for {@link fetchBlockFeeHistory} for more on how this works.)

Type parameters

  • Percentile: number

Type declaration

  • baseFeePerGas: BN
  • gasUsedRatio: number
  • number: BN
  • priorityFeesByPercentile: Record<Percentile, BN>
EthFeeHistoryResponse: { baseFeePerGas: string[]; gasUsedRatio: number[]; oldestBlock: string; reward?: string[][] }
property

oldestBlock - The id of the oldest block (in hex format) in the range of blocks requested.

property

baseFeePerGas - Base fee per gas for each block in the range of blocks requested.

property

gasUsedRatio - A number between 0 and 1 that represents the gas used vs. gas limit for each block in the range of blocks requested.

property

reward - The priority fee at the percentiles requested for each block in the range of blocks requested.

Type declaration

  • baseFeePerGas: string[]
  • gasUsedRatio: number[]
  • oldestBlock: string
  • Optional reward?: string[][]

Functions

  • default<Percentile>(args: { endBlock?: BN | "latest"; ethQuery: any; numberOfBlocks: number; percentiles?: readonly Percentile[] }): Promise<Block<Percentile>[]>
  • Type parameters

    • Percentile: number

    Parameters

    • args: { endBlock?: BN | "latest"; ethQuery: any; numberOfBlocks: number; percentiles?: readonly Percentile[] }

      The arguments to this function.

      • Optional endBlock?: BN | "latest"

        The desired end of the requested block range. Can be "latest" if you want to start from the latest successful block or the number of a known past block.

      • ethQuery: any

        An EthQuery instance that wraps a provider for the network in question.

      • numberOfBlocks: number

        How many total blocks to fetch. Note that if this is more than 1024, multiple calls to eth_feeHistory will be made.

      • Optional percentiles?: readonly Percentile[]

        A set of numbers between 1 and 100 which will dictate how priorityFeesByPercentile in each returned block will be formed. When Ethereum runs the eth_feeHistory method, for each block it is considering, it will first sort all transactions by the priority fee. It will then go through each transaction and add the total amount of gas paid for that transaction to a bucket which maxes out at the total gas used for the whole block. As the bucket fills, it will cross percentages which correspond to the percentiles specified here, and the priority fees of the first transactions which cause it to reach those percentages will be recorded. Hence, priorityFeesByPercentile represents the priority fees of transactions at key gas used contribution levels, where earlier levels have smaller contributions and later levels have higher contributions.

    Returns Promise<Block<Percentile>[]>

    The list of blocks and their fee data, sorted from oldest to newest.

Generated using TypeDoc