Commit 06c81d93 authored by Charles Bachmeier's avatar Charles Bachmeier Committed by GitHub

feat: add amplitude logging for gas estimate failures (#7095)

* send gas estimate failure

* update event name

* update analytics events package

* add error and tx to analytics event
parent 15c59e81
......@@ -6,7 +6,7 @@ import { SwapRouter, UNIVERSAL_ROUTER_ADDRESS } from '@uniswap/universal-router-
import { FeeOptions, toHex } from '@uniswap/v3-sdk'
import { useWeb3React } from '@web3-react/core'
import { sendAnalyticsEvent, useTrace } from 'analytics'
import { formatSwapSignedAnalyticsEventProperties } from 'lib/utils/analytics'
import { formatCommonPropertiesForTrade, formatSwapSignedAnalyticsEventProperties } from 'lib/utils/analytics'
import { useCallback } from 'react'
import { ClassicTrade, TradeFillType } from 'state/routing/types'
import { trace } from 'tracing/trace'
......@@ -80,6 +80,12 @@ export function useUniversalRouterSwapCallback(
} catch (gasError) {
setTraceStatus('failed_precondition')
setTraceError(gasError)
sendAnalyticsEvent(SwapEventName.SWAP_ESTIMATE_GAS_CALL_FAILED, {
...formatCommonPropertiesForTrade(trade, options.slippageTolerance),
...analyticsContext,
tx,
error: gasError,
})
console.warn(gasError)
throw new GasEstimationError()
}
......
......@@ -6184,10 +6184,10 @@
"@typescript-eslint/types" "5.59.1"
eslint-visitor-keys "^3.3.0"
"@uniswap/analytics-events@^2.14.0":
version "2.14.0"
resolved "https://registry.npmjs.org/@uniswap/analytics-events/-/analytics-events-2.14.0.tgz#f7f6196577cc10aa4e73dc82d54944b36cf6aaf8"
integrity sha512-1CaXZLqoPVanMfmm/DSoLR7aja3JGKjXS0qZLVCMTNQTC7gpUp2boMM69WrOyTIH/AQ32jhhvPD/QoPs9P6lFw==
"@uniswap/analytics-events@^2.15.0":
version "2.15.0"
resolved "https://registry.yarnpkg.com/@uniswap/analytics-events/-/analytics-events-2.15.0.tgz#46de9832a2b0b0d8a08e67c6502c327d74f122f1"
integrity sha512-hRYa4YzX/NNLcSgwpkJ5Ich1swFGNftGkfS7nU41XliVbqhDqNSCnAdeHu8mFOx/W8xzf4cb773bYk001nY4mQ==
"@uniswap/analytics@^1.4.0":
version "1.4.0"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment