Documentation IndexFetch the complete documentation index at: /docs/llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /docs/llms.txt
Use this file to discover all available pages before exploring further.
import { mainnet } from 'viem/chains'; import { toHex, parseEther } from 'viem'; import { dynamicClient } from './dynamicClient'; const estimateGas = async () => { const publicClient = await dynamicClient.viem.createPublicClient({ chain: mainnet, }); const estimate = await publicClient.estimateGas({ from: dynamicClient.wallets.primary.address as `0x${string}`, to: '0x123' as `0x${string}`, value: toHex(parseEther('0.001')), }) console.log(estimate); }
import { linea } from 'viem/chains'; import { toHex, parseEther } from 'viem'; import { dynamicClient } from './dynamicClient'; const estimateGas = async () => { const publicClient = await dynamicClient.viem.createPublicClient({ chain: linea, }); const estimate = await publicClient.estimateGas({ from: dynamicClient.wallets.primary.address as `0x${string}`, to: '0x123' as `0x${string}`, value: toHex(parseEther('0.001')), }) console.log(estimate); }
Was this page helpful?