From 14a90fe739262110563d74812601edd2f2744d55 Mon Sep 17 00:00:00 2001 From: 0xcdb Date: Tue, 20 Jun 2023 15:16:22 +1000 Subject: [PATCH] Update gasUtils.ts --- src/utils/gasUtils.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/utils/gasUtils.ts b/src/utils/gasUtils.ts index 2d345dfe..990ab42d 100644 --- a/src/utils/gasUtils.ts +++ b/src/utils/gasUtils.ts @@ -45,8 +45,10 @@ export const getTransactionPrice = ( export const MIN_GAS_ESTIMATE = wei(21000, BASE_DECIMALS) export const getGasEstimateWithBuffer = (gasLimit: Wei) => { - if (!gasLimit) return undefined - return gasLimit?.add(gasLimit?.mul(wei(GAS_LIMIT_BUFFER_MULTIPLIER, 0)).div(100)).toBN() ?? null + if (!gasLimit || gasLimit.eq(wei(0))) return undefined + return ( + gasLimit?.add(gasLimit?.mul(wei(GAS_LIMIT_BUFFER_MULTIPLIER, 0)).div(100)).toBN() ?? undefined + ) } export const getGasPriceFromProvider = async (provider: JsonRpcProvider) => {