0

I need to calculate estimate gas fee for the swap function using wagmi

import { useEstimateGas } from 'wagmi'
import { parseEther } from 'viem'
import { config } from './config'

function App() {
  const result = useEstimateGas({
    account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 
    to: '0xd2135CfB216b74109775236E36d4b433F1DF507B',
    value: parseEther('0.01'),
  })
}

I tried with this hook , but using this unable to fetch the estimate gas fee for the swap function.

1 Answer 1

-1

In Wagmi2.0, can estimateGas before writeContract. Note following URL. https://wagmi.sh/core/api/actions/estimateGas

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.