|
|
@ -12,6 +12,7 @@ import { useSwapsEthToken } from '../../../hooks/useSwapsEthToken' |
|
|
|
import { MetaMetricsContext } from '../../../contexts/metametrics.new' |
|
|
|
import { MetaMetricsContext } from '../../../contexts/metametrics.new' |
|
|
|
import FeeCard from '../fee-card' |
|
|
|
import FeeCard from '../fee-card' |
|
|
|
import { |
|
|
|
import { |
|
|
|
|
|
|
|
FALLBACK_GAS_MULTIPLIER, |
|
|
|
getQuotes, |
|
|
|
getQuotes, |
|
|
|
getSelectedQuote, |
|
|
|
getSelectedQuote, |
|
|
|
getApproveTxParams, |
|
|
|
getApproveTxParams, |
|
|
@ -57,7 +58,6 @@ import { |
|
|
|
} from '../../../helpers/utils/token-util' |
|
|
|
} from '../../../helpers/utils/token-util' |
|
|
|
import { |
|
|
|
import { |
|
|
|
decimalToHex, |
|
|
|
decimalToHex, |
|
|
|
hexMax, |
|
|
|
|
|
|
|
hexToDecimal, |
|
|
|
hexToDecimal, |
|
|
|
getValueFromWeiHex, |
|
|
|
getValueFromWeiHex, |
|
|
|
} from '../../../helpers/utils/conversions.util' |
|
|
|
} from '../../../helpers/utils/conversions.util' |
|
|
@ -123,18 +123,16 @@ export default function ViewQuote() { |
|
|
|
usedQuote?.gasEstimateWithRefund || |
|
|
|
usedQuote?.gasEstimateWithRefund || |
|
|
|
`0x${decimalToHex(usedQuote?.averageGas || 0)}` |
|
|
|
`0x${decimalToHex(usedQuote?.averageGas || 0)}` |
|
|
|
|
|
|
|
|
|
|
|
const gasLimitForMax = |
|
|
|
const gasLimitForMax = usedQuote?.gasEstimate || `0x0` |
|
|
|
usedQuote?.gasEstimate || `0x${decimalToHex(usedQuote?.averageGas || 0)}` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const usedGasLimitWithMultiplier = new BigNumber(gasLimitForMax, 16) |
|
|
|
const usedGasLimitWithMultiplier = new BigNumber(gasLimitForMax, 16) |
|
|
|
.times(1.4, 10) |
|
|
|
.times(usedQuote?.gasMultiplier || FALLBACK_GAS_MULTIPLIER, 10) |
|
|
|
.round(0) |
|
|
|
.round(0) |
|
|
|
.toString(16) |
|
|
|
.toString(16) |
|
|
|
|
|
|
|
|
|
|
|
const nonCustomMaxGasLimit = hexMax( |
|
|
|
const nonCustomMaxGasLimit = usedQuote?.gasEstimate |
|
|
|
`0x${decimalToHex(usedQuote?.maxGas || 0)}`, |
|
|
|
? usedGasLimitWithMultiplier |
|
|
|
usedGasLimitWithMultiplier, |
|
|
|
: `0x${decimalToHex(usedQuote?.maxGas || 0)}` |
|
|
|
) |
|
|
|
|
|
|
|
const maxGasLimit = customMaxGas || nonCustomMaxGasLimit |
|
|
|
const maxGasLimit = customMaxGas || nonCustomMaxGasLimit |
|
|
|
|
|
|
|
|
|
|
|
const gasTotalInWeiHex = calcGasTotal(maxGasLimit, gasPrice) |
|
|
|
const gasTotalInWeiHex = calcGasTotal(maxGasLimit, gasPrice) |
|
|
|