From b02352e8bf767c3d251897c6ece62189730c78a8 Mon Sep 17 00:00:00 2001 From: eddie <66155195+just-toby@users.noreply.github.com> Date: Thu, 19 Oct 2023 13:38:16 -0700 Subject: [PATCH] fix: dont try to log unserializable objects (#7497) * fix: dont log unserializable objects to amplitude * fix: add more fields * fix: nits * fix: add chainid --- src/hooks/useContract.ts | 11 ++++++++--- src/hooks/useSwapTaxes.ts | 5 ++++- src/lib/hooks/useCurrency.ts | 8 +++++++- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/hooks/useContract.ts b/src/hooks/useContract.ts index 77de1a6e9d..4ab9e414f4 100644 --- a/src/hooks/useContract.ts +++ b/src/hooks/useContract.ts @@ -150,7 +150,7 @@ export function useMainnetInterfaceMulticall() { } export function useV3NFTPositionManagerContract(withSignerIfPossible?: boolean): NonfungiblePositionManager | null { - const { account } = useWeb3React() + const { account, chainId } = useWeb3React() const contract = useContract( NONFUNGIBLE_POSITION_MANAGER_ADDRESSES, NFTPositionManagerABI, @@ -160,10 +160,15 @@ export function useV3NFTPositionManagerContract(withSignerIfPossible?: boolean): if (contract && account) { sendAnalyticsEvent(InterfaceEventName.WALLET_PROVIDER_USED, { source: 'useV3NFTPositionManagerContract', - contract, + contract: { + name: 'V3NonfungiblePositionManager', + address: contract.address, + withSignerIfPossible, + chainId, + }, }) } - }, [account, contract]) + }, [account, chainId, contract, withSignerIfPossible]) return contract } diff --git a/src/hooks/useSwapTaxes.ts b/src/hooks/useSwapTaxes.ts index d82f5d759e..384fddaeb9 100644 --- a/src/hooks/useSwapTaxes.ts +++ b/src/hooks/useSwapTaxes.ts @@ -20,7 +20,10 @@ function useFeeOnTransferDetectorContract(): FeeOnTransferDetector | null { if (contract && account) { sendAnalyticsEvent(InterfaceEventName.WALLET_PROVIDER_USED, { source: 'useFeeOnTransferDetectorContract', - contract, + contract: { + name: 'FeeOnTransferDetector', + address: FEE_ON_TRANSFER_DETECTOR_ADDRESS, + }, }) } }, [account, contract]) diff --git a/src/lib/hooks/useCurrency.ts b/src/lib/hooks/useCurrency.ts index acdb9480d7..24a607fd44 100644 --- a/src/lib/hooks/useCurrency.ts +++ b/src/lib/hooks/useCurrency.ts @@ -89,7 +89,13 @@ export function useTokenFromMapOrNetwork(tokens: TokenMap, tokenAddress?: string if (tokenFromNetwork) { sendAnalyticsEvent(InterfaceEventName.WALLET_PROVIDER_USED, { source: 'useTokenFromActiveNetwork', - token: tokenFromNetwork, + token: { + name: tokenFromNetwork?.name, + symbol: tokenFromNetwork?.symbol, + address: tokenFromNetwork?.address, + isNative: tokenFromNetwork?.isNative, + chainId: tokenFromNetwork?.chainId, + }, }) } }, [tokenFromNetwork])