Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Commit

Permalink
Fix: pass safeTxGas to gas estimation for 1.1.1 Safes
Browse files Browse the repository at this point in the history
  • Loading branch information
katspaugh committed Jun 20, 2022
1 parent 5db53ae commit 69391ad
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@ export const TxModalWrapper = ({
const isOffChainSignature = checkIfOffChainSignatureIsPossible(doExecute, isSmartContract, safeVersion)
const approvalAndExecution = isApproveAndExecute(Number(threshold), confirmationsLen, preApprovingOwner)

const { result: safeTxGasEstimation, error: safeTxGasError } = useEstimateSafeTxGas({
isRejectTx,
txData,
txRecipient: txTo || safeAddress,
txAmount: txValue,
operation,
})
if (safeTxGas == null) safeTxGas = safeTxGasEstimation

const txParameters = useMemo(
() => ({
safeAddress,
Expand All @@ -133,7 +142,7 @@ export const TxModalWrapper = ({
gasPrice: '0',
gasToken: ZERO_ADDRESS,
refundReceiver: ZERO_ADDRESS,
safeTxGas: safeTxGas || manualSafeTxGas || '0',
safeTxGas: manualSafeTxGas || safeTxGas || '0',
approvalAndExecution,
}),
[
Expand Down Expand Up @@ -161,15 +170,6 @@ export const TxModalWrapper = ({
return checkTransactionExecution({ ...txParameters, gasLimit })
}, [gasLimit, txParameters])

const { result: safeTxGasEstimation, error: safeTxGasError } = useEstimateSafeTxGas({
isRejectTx,
txData,
txRecipient: txTo || safeAddress,
txAmount: txValue,
operation,
})
if (safeTxGas == null) safeTxGas = safeTxGasEstimation

const { gasPriceFormatted, gasPrice, gasMaxPrioFee, gasMaxPrioFeeFormatted } = useEstimateTransactionGas({
manualGasPrice,
manualMaxPrioFee,
Expand Down

0 comments on commit 69391ad

Please sign in to comment.