fix: add tax amounts to swap quote received (#7299)

This commit is contained in:
eddie 2023-09-11 10:15:02 -07:00 committed by GitHub
parent 736e395cd7
commit f71c781530
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

@ -86,7 +86,9 @@ function getQuoteMethod(trade: InterfaceTrade) {
export const formatSwapQuoteReceivedEventProperties = (
trade: InterfaceTrade,
allowedSlippage: Percent,
swapQuoteLatencyMs: number | undefined
swapQuoteLatencyMs: number | undefined,
inputTax: Percent,
outputTax: Percent
) => {
return {
...formatCommonPropertiesForTrade(trade, allowedSlippage),
@ -95,5 +97,7 @@ export const formatSwapQuoteReceivedEventProperties = (
token_in_amount_max: trade.maximumAmountIn(allowedSlippage).toExact(),
token_out_amount_min: trade.minimumAmountOut(allowedSlippage).toExact(),
quote_latency_milliseconds: swapQuoteLatencyMs,
token_out_detected_tax: formatPercentNumber(outputTax),
token_in_detected_tax: formatPercentNumber(inputTax),
}
}

@ -552,10 +552,10 @@ export function Swap({
if (!trade || prevTrade === trade) return // no new swap quote to log
sendAnalyticsEvent(SwapEventName.SWAP_QUOTE_RECEIVED, {
...formatSwapQuoteReceivedEventProperties(trade, allowedSlippage, swapQuoteLatency),
...formatSwapQuoteReceivedEventProperties(trade, allowedSlippage, swapQuoteLatency, inputTax, outputTax),
...trace,
})
}, [prevTrade, trade, trace, allowedSlippage, swapQuoteLatency])
}, [prevTrade, trade, trace, allowedSlippage, swapQuoteLatency, inputTax, outputTax])
const showDetailsDropdown = Boolean(
!showWrap && userHasSpecifiedInputOutput && (trade || routeIsLoading || routeIsSyncing)