clawchain/wagmi/site/react/api/hooks/useEstimateMaxPriorityFeePerGas.md

2.5 KiB

title, description
title description
useEstimateMaxPriorityFeePerGas Hook for fetching an estimate for the max priority fee per gas (in wei) for a transaction to be likely included in the next block.

useEstimateMaxPriorityFeePerGas

Hook for fetching an estimate for the fees per gas (in wei) for a transaction to be likely included in the next block.

Import

import { useEstimateMaxPriorityFeePerGas } from 'wagmi'

Usage

::: code-group

import { useEstimateMaxPriorityFeePerGas } from 'wagmi'

function App() {
  const result = useEstimateMaxPriorityFeePerGas()
}

<<< @/snippets/react/config.ts[config.ts] :::

Parameters

import { type UseEstimateMaxPriorityFeePerGas } from 'wagmi'

chainId

config['chains'][number]['id'] | undefined

ID of chain to use when fetching data.

::: code-group

import { useEstimateMaxPriorityFeePerGas } from 'wagmi'
import { mainnet } from 'wagmi/chains' // [!code focus]

function App() {
  const result = useEstimateMaxPriorityFeePerGas({
    chainId: mainnet.id, // [!code focus]
  })
}

<<< @/snippets/react/config.ts[config.ts] :::

config

Config | undefined

Config to use instead of retrieving from the nearest WagmiProvider.

::: code-group

import { useEstimateMaxPriorityFeePerGas } from 'wagmi'
import { config } from './config' // [!code focus]

function App() {
  const result = useEstimateMaxPriorityFeePerGas({
    config, // [!code focus]
  })
}

<<< @/snippets/react/config.ts[config.ts] :::

scopeKey

string | undefined

Scopes the cache to a given context. Hooks that have identical context will share the same cache.

::: code-group

import { useEstimateMaxPriorityFeePerGas } from 'wagmi'

function App() {
  const result = useEstimateMaxPriorityFeePerGas({
    scopeKey: 'foo', // [!code focus]
  })
}

<<< @/snippets/react/config.ts[config.ts] :::

Return Type

import { type UseEstimateMaxPriorityFeePerGasReturnType } from 'wagmi'

Action