Skip to main content

Module fee

Module fee 

Source
Expand description

EIP-1559 fee estimation with configurable presets.

Estimates maxFeePerGas and maxPriorityFeePerGas from eth_feeHistory, where the chosen [Eip1559FeeEstimatePreset] selects the reward percentile used for the priority fee and the multiplier applied to the base fee.

Structsยง

ResolvedEip1559Fees
The resolved EIP-1559 fees together with the base fee they were derived from.

Constantsยง

FEE_HISTORY_BLOCKS ๐Ÿ”’
The number of past blocks sampled from eth_feeHistory for fee estimation.
MIN_GAS_USED_RATIO ๐Ÿ”’
Gas used ratio below which a block is treated as near-empty and its reward is dropped from sampling, so one-off tips in otherwise idle blocks do not dominate the cross-block median on low-traffic chains. Local heuristic: there is no protocol-defined utilization threshold for priority-fee estimation.
MIN_PRIORITY_FEE ๐Ÿ”’
The minimum priority fee to provide, in wei.

Functionsยง

estimate_eip1559_fees
Estimates EIP-1559 fees for provider using the given preset.
estimate_priority_fee ๐Ÿ”’
Estimates the priority fee as the median of the non-zero per-block rewards, never returning less than MIN_PRIORITY_FEE.
resolve_broadcast_eip1559_fees
Applies, in order, the optional browser_suggested_tip, with_gas_price and priority_gas_price overrides to estimated EIP-1559 fees.