getGasPrice
Returns the current price of gas (in wei).
Usage
ts
import { publicClient } from './client'
const gasPrice = await publicClient.getGasPrice()
import { publicClient } from './client'
const gasPrice = await publicClient.getGasPrice()
ts
import { createPublicClient, http } from 'viem'
import { mainnet } from 'viem/chains'
export const publicClient = createPublicClient({
chain: mainnet,
transport: http()
})
import { createPublicClient, http } from 'viem'
import { mainnet } from 'viem/chains'
export const publicClient = createPublicClient({
chain: mainnet,
transport: http()
})
Returns
bigint
The gas price (in wei).