fix: dont try to log unserializable objects (#7497)

* fix: dont log unserializable objects to amplitude

* fix: add more fields

* fix: nits

* fix: add chainid
This commit is contained in:
eddie 2023-10-19 13:38:16 -07:00 committed by GitHub
parent 819e2f5712
commit b02352e8bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 5 deletions

@ -150,7 +150,7 @@ export function useMainnetInterfaceMulticall() {
} }
export function useV3NFTPositionManagerContract(withSignerIfPossible?: boolean): NonfungiblePositionManager | null { export function useV3NFTPositionManagerContract(withSignerIfPossible?: boolean): NonfungiblePositionManager | null {
const { account } = useWeb3React() const { account, chainId } = useWeb3React()
const contract = useContract<NonfungiblePositionManager>( const contract = useContract<NonfungiblePositionManager>(
NONFUNGIBLE_POSITION_MANAGER_ADDRESSES, NONFUNGIBLE_POSITION_MANAGER_ADDRESSES,
NFTPositionManagerABI, NFTPositionManagerABI,
@ -160,10 +160,15 @@ export function useV3NFTPositionManagerContract(withSignerIfPossible?: boolean):
if (contract && account) { if (contract && account) {
sendAnalyticsEvent(InterfaceEventName.WALLET_PROVIDER_USED, { sendAnalyticsEvent(InterfaceEventName.WALLET_PROVIDER_USED, {
source: 'useV3NFTPositionManagerContract', source: 'useV3NFTPositionManagerContract',
contract, contract: {
name: 'V3NonfungiblePositionManager',
address: contract.address,
withSignerIfPossible,
chainId,
},
}) })
} }
}, [account, contract]) }, [account, chainId, contract, withSignerIfPossible])
return contract return contract
} }

@ -20,7 +20,10 @@ function useFeeOnTransferDetectorContract(): FeeOnTransferDetector | null {
if (contract && account) { if (contract && account) {
sendAnalyticsEvent(InterfaceEventName.WALLET_PROVIDER_USED, { sendAnalyticsEvent(InterfaceEventName.WALLET_PROVIDER_USED, {
source: 'useFeeOnTransferDetectorContract', source: 'useFeeOnTransferDetectorContract',
contract, contract: {
name: 'FeeOnTransferDetector',
address: FEE_ON_TRANSFER_DETECTOR_ADDRESS,
},
}) })
} }
}, [account, contract]) }, [account, contract])

@ -89,7 +89,13 @@ export function useTokenFromMapOrNetwork(tokens: TokenMap, tokenAddress?: string
if (tokenFromNetwork) { if (tokenFromNetwork) {
sendAnalyticsEvent(InterfaceEventName.WALLET_PROVIDER_USED, { sendAnalyticsEvent(InterfaceEventName.WALLET_PROVIDER_USED, {
source: 'useTokenFromActiveNetwork', source: 'useTokenFromActiveNetwork',
token: tokenFromNetwork, token: {
name: tokenFromNetwork?.name,
symbol: tokenFromNetwork?.symbol,
address: tokenFromNetwork?.address,
isNative: tokenFromNetwork?.isNative,
chainId: tokenFromNetwork?.chainId,
},
}) })
} }
}, [tokenFromNetwork]) }, [tokenFromNetwork])