feat: Log auto slippage setting for gas estimate failed event (#7231)

* log auto slippage setting for gas estimate failed

* add to dep array
This commit is contained in:
Tina 2023-09-11 11:41:31 -04:00 committed by GitHub
parent 84f5d8f94d
commit acdeb402ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -10,6 +10,7 @@ import useBlockNumber from 'lib/hooks/useBlockNumber'
import { formatCommonPropertiesForTrade, formatSwapSignedAnalyticsEventProperties } from 'lib/utils/analytics'
import { useCallback } from 'react'
import { ClassicTrade, TradeFillType } from 'state/routing/types'
import { useUserSlippageTolerance } from 'state/user/hooks'
import { trace } from 'tracing/trace'
import { calculateGasMargin } from 'utils/calculateGasMargin'
import { UserRejectedRequestError, WrongChainError } from 'utils/errors'
@ -52,6 +53,7 @@ export function useUniversalRouterSwapCallback(
const { account, chainId, provider } = useWeb3React()
const analyticsContext = useTrace()
const blockNumber = useBlockNumber()
const isAutoSlippage = useUserSlippageTolerance()[0] === 'auto'
return useCallback(async () => {
return trace('swap.send', async ({ setTraceData, setTraceStatus, setTraceError }) => {
@ -96,6 +98,7 @@ export function useUniversalRouterSwapCallback(
client_block_number: blockNumber,
tx,
error: gasError,
isAutoSlippage,
})
console.warn(gasError)
throw new GasEstimationError()
@ -161,5 +164,7 @@ export function useUniversalRouterSwapCallback(
options.slippageTolerance,
provider,
trade,
isAutoSlippage,
blockNumber,
])
}