mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-10-22 19:26:13 +02:00
Use better value for average savings analytics (#9733)
This commit is contained in:
parent
a4f817e171
commit
557f9550d7
@ -23,7 +23,7 @@ import {
|
|||||||
import { AWAITING_SWAP_ROUTE, BUILD_QUOTE_ROUTE, LOADING_QUOTES_ROUTE, SWAPS_ERROR_ROUTE, SWAPS_MAINTENANCE_ROUTE } from '../../helpers/constants/routes'
|
import { AWAITING_SWAP_ROUTE, BUILD_QUOTE_ROUTE, LOADING_QUOTES_ROUTE, SWAPS_ERROR_ROUTE, SWAPS_MAINTENANCE_ROUTE } from '../../helpers/constants/routes'
|
||||||
import { fetchSwapsFeatureLiveness } from '../../pages/swaps/swaps.util'
|
import { fetchSwapsFeatureLiveness } from '../../pages/swaps/swaps.util'
|
||||||
import { calcGasTotal } from '../../pages/send/send.utils'
|
import { calcGasTotal } from '../../pages/send/send.utils'
|
||||||
import { decimalToHex, getValueFromWeiHex, hexMax, decGWEIToHexWEI, hexToDecimal, decEthToConvertedCurrency, hexWEIToDecGWEI } from '../../helpers/utils/conversions.util'
|
import { decimalToHex, getValueFromWeiHex, hexMax, decGWEIToHexWEI, hexToDecimal, hexWEIToDecGWEI } from '../../helpers/utils/conversions.util'
|
||||||
import { calcTokenAmount } from '../../helpers/utils/token-util'
|
import { calcTokenAmount } from '../../helpers/utils/token-util'
|
||||||
import {
|
import {
|
||||||
getFastPriceEstimateInHexWEI,
|
getFastPriceEstimateInHexWEI,
|
||||||
@ -462,13 +462,7 @@ export const signAndSendTransactions = (history, metaMetricsEvent) => {
|
|||||||
conversionRate,
|
conversionRate,
|
||||||
numberOfDecimals: 6,
|
numberOfDecimals: 6,
|
||||||
})
|
})
|
||||||
const averageSavings = usedQuote.isBestQuote
|
|
||||||
? decEthToConvertedCurrency(
|
|
||||||
usedQuote.savings?.total,
|
|
||||||
'usd',
|
|
||||||
conversionRate,
|
|
||||||
)
|
|
||||||
: null
|
|
||||||
const swapMetaData = {
|
const swapMetaData = {
|
||||||
token_from: sourceTokenInfo.symbol,
|
token_from: sourceTokenInfo.symbol,
|
||||||
token_from_amount: String(swapTokenValue),
|
token_from_amount: String(swapTokenValue),
|
||||||
@ -484,7 +478,7 @@ export const signAndSendTransactions = (history, metaMetricsEvent) => {
|
|||||||
estimated_gas: estimatedGasLimit.toString(10),
|
estimated_gas: estimatedGasLimit.toString(10),
|
||||||
suggested_gas_price: hexWEIToDecGWEI(usedGasPrice),
|
suggested_gas_price: hexWEIToDecGWEI(usedGasPrice),
|
||||||
used_gas_price: hexWEIToDecGWEI(fastGasEstimate),
|
used_gas_price: hexWEIToDecGWEI(fastGasEstimate),
|
||||||
average_savings: averageSavings,
|
average_savings: usedQuote.savings?.performance,
|
||||||
}
|
}
|
||||||
|
|
||||||
const metaMetricsConfig = {
|
const metaMetricsConfig = {
|
||||||
|
Loading…
Reference in New Issue
Block a user