fetchFeeData
Action for fetching network fee information.
import { fetchFeeData } from '@wagmi/core'Usage
import { fetchFeeData } from '@wagmi/core'
 
const feeData = await fetchFeeData()Return Value
{
  gasPrice: bigint
  maxFeePerGas: bigint
  maxPriorityFeePerGas: bigint
  formatted: {
    gasPrice: string
    maxFeePerGas: string
    maxPriorityFeePerGas: string
  }
}Configuration
chainId (optional)
Force a specific chain id for the request. The wagmi Client's publicClient must be set up as a chain-aware function for this to work correctly.
import { fetchFeeData } from '@wagmi/core'
 
const feeData = await fetchFeeData({
  chainId: 1,
})formatUnits (optional)
Formats fee data. Defaults to wei.
import { fetchFeeData } from '@wagmi/core'
 
const feeData = await fetchFeeData({
  formatUnits: 'gwei',
})