Commit 8d9ddf36 authored by Zach Pomerantz's avatar Zach Pomerantz Committed by GitHub

fix: display specific gas estimation error (#5863)

parent 6cfd5fa4
......@@ -56,9 +56,8 @@ export function useUniversalRouterSwapCallback(
try {
gasEstimate = await provider.estimateGas(tx)
} catch (gasError) {
await provider.call(tx) // this should throw the actual error
// If the actual error is not thrown, just try again:
gasEstimate = await provider.estimateGas(tx)
console.warn(gasError)
throw new InvalidSwapError('Gas estimation failed. Wait a few minutes and try again.')
}
const gasLimit = calculateGasMargin(gasEstimate)
const response = await provider
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment