Overview
FeeOracle provides real-time gas price estimation for Ethereum transactions. It fetches current network fee data, estimates EIP-1559 fees with configurable priority levels, and supports watching for fee updates.API
Factory
getFeeData
Fetch current network fee data.Promise<FeeDataType>
estimateEip1559Fees
Estimate fees for an EIP-1559 transaction with configurable priority.
Priority multipliers:
low: 0.8x priority feemedium: 1.0x priority feehigh: 1.5x priority fee
Promise<{ maxFeePerGas: bigint; maxPriorityFeePerGas: bigint }>
watchFees
Subscribe to fee updates with polling.
Returns:
() => void - Unsubscribe function
Types
FeeDataType
FeeEstimateOptions
FeeOracleOptions
Examples
Transaction with Dynamic Fees
Fee Display UI
Legacy Chain Support
FeeOracle handles chains without EIP-1559 support gracefully:Custom Fee History Analysis
How It Works
FeeOracle uses three JSON-RPC methods:- eth_gasPrice - Gets the legacy gas price
- eth_getBlockByNumber - Fetches the latest block for base fee and blob fee
- eth_feeHistory - Analyzes recent blocks for priority fee estimation
maxFeePerGas is calculated as baseFee * 2 + priorityFee, providing a buffer for base fee increases across blocks.
See Also
- Transaction - Transaction construction
- FeeMarket - EIP-1559 fee market calculations
- GasConstants - Gas cost constants

