estimate_gas_fees

Documentation for eth_defi.gas.estimate_gas_fees function.

estimate_gas_fees(web3, method=None, gas_price_buffer_multiplier=1.12)

Get a good gas price for a transaction.

Applies a safety buffer to maxFeePerGas to absorb base fee fluctuations between estimation and transaction submission. See GAS_PRICE_BUFFER_MULTIPLIER for details.

Parameters
  • web3 (web3.main.Web3) – Web3 instance connected to a node.

  • method – Force a specific gas pricing method. If None, auto-detect based on whether the chain supports EIP-1559.

  • gas_price_buffer_multiplier (float) – Multiplier applied to maxFeePerGas to absorb base fee fluctuations. Defaults to GAS_PRICE_BUFFER_MULTIPLIER (1.12 = 12% buffer). Set to 1.0 to disable the buffer.

Return type

eth_defi.gas.GasPriceSuggestion