mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Add data point to 'Swaps Completed' segment event: estimated vs used gas (#9571)
* Add data point to 'Swaps Completed' segment event: estimated vs used gas * Linted * Correct property name for estimated gas on swapMetaData in _trackSwapsMetrics() * Set estimated_gas property on swapMetaData to a hex string * Correct base when dividing by estimated_gas Co-authored-by: Dan Finlay <dan@danfinlay.com>
This commit is contained in:
parent
fe11075418
commit
00c8609f95
@ -858,6 +858,13 @@ export default class TransactionController extends EventEmitter {
|
|||||||
.round(2)
|
.round(2)
|
||||||
}%`
|
}%`
|
||||||
|
|
||||||
|
const estimatedVsUsedGasRatio = `${
|
||||||
|
(new BigNumber(txMeta.txReceipt.gasUsed, 16))
|
||||||
|
.div(txMeta.swapMetaData.estimated_gas, 16)
|
||||||
|
.times(100)
|
||||||
|
.round(2)
|
||||||
|
}%`
|
||||||
|
|
||||||
this._trackSegmentEvent({
|
this._trackSegmentEvent({
|
||||||
event: 'Swap Completed',
|
event: 'Swap Completed',
|
||||||
category: 'swaps',
|
category: 'swaps',
|
||||||
@ -871,6 +878,7 @@ export default class TransactionController extends EventEmitter {
|
|||||||
...txMeta.swapMetaData,
|
...txMeta.swapMetaData,
|
||||||
token_to_amount_received: tokensReceived,
|
token_to_amount_received: tokensReceived,
|
||||||
quote_vs_executionRatio: quoteVsExecutionRatio,
|
quote_vs_executionRatio: quoteVsExecutionRatio,
|
||||||
|
estimated_vs_used_gasRatio: estimatedVsUsedGasRatio,
|
||||||
},
|
},
|
||||||
excludeMetaMetricsId: true,
|
excludeMetaMetricsId: true,
|
||||||
})
|
})
|
||||||
|
@ -474,6 +474,7 @@ export const signAndSendTransactions = (history, metaMetricsEvent) => {
|
|||||||
other_quote_selected: usedQuote.aggregator !== getTopQuote(state)?.aggregator,
|
other_quote_selected: usedQuote.aggregator !== getTopQuote(state)?.aggregator,
|
||||||
other_quote_selected_source: usedQuote.aggregator === getTopQuote(state)?.aggregator ? '' : usedQuote.aggregator,
|
other_quote_selected_source: usedQuote.aggregator === getTopQuote(state)?.aggregator ? '' : usedQuote.aggregator,
|
||||||
gas_fees: formatCurrency(gasEstimateTotalInEth, 'usd')?.slice(1),
|
gas_fees: formatCurrency(gasEstimateTotalInEth, 'usd')?.slice(1),
|
||||||
|
estimated_gas: estimatedGasLimit.toString(16),
|
||||||
}
|
}
|
||||||
|
|
||||||
const metaMetricsConfig = {
|
const metaMetricsConfig = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user