From 8518cb68376175497c9e29bac4b304514a341b1c Mon Sep 17 00:00:00 2001 From: jaredvu Date: Tue, 20 Feb 2024 10:48:29 -0800 Subject: [PATCH] Add telemetry log fn --- src/hooks/useWithdrawalInfo.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/hooks/useWithdrawalInfo.ts b/src/hooks/useWithdrawalInfo.ts index 2f25d9e..39fd37b 100644 --- a/src/hooks/useWithdrawalInfo.ts +++ b/src/hooks/useWithdrawalInfo.ts @@ -15,6 +15,7 @@ import { getSelectedLocale } from '@/state/localizationSelectors'; import { formatRelativeTime } from '@/lib/dateTime'; import { BIG_NUMBERS, MustBigNumber } from '@/lib/numbers'; +import { log } from '@/lib/telemetry'; import { useDydxClient } from './useDydxClient'; import { useTokenConfigs } from './useTokenConfigs'; @@ -42,7 +43,7 @@ export const useWithdrawalInfo = ({ const response = await getWithdrawalCapacityByDenom({ denom: usdcDenom }); return JSON.parse(encodeJson(response, ByteArrayEncoding.BIGINT)); } catch (error) { - console.error('error'); + log('useWithdrawalInfo/getWithdrawalCapacityByDenom', error); } }, refetchInterval: 60_000, @@ -52,7 +53,13 @@ export const useWithdrawalInfo = ({ const { data: withdrawalAndTransferGatingStatus } = useQuery({ enabled: withdrawalSafetyEnabled, queryKey: 'withdrawalTransferGateStatus', - queryFn: getWithdrawalAndTransferGatingStatus, + queryFn: async () => { + try { + return await getWithdrawalAndTransferGatingStatus(); + } catch (error) { + log('useWithdrawalInfo/getWithdrawalAndTransferGatingStatus', error); + } + }, refetchInterval: 60_000, staleTime: 60_000, }); @@ -115,7 +122,7 @@ export const useWithdrawalInfo = ({ }) ); } - }, [withdrawalAndTransferGatingStatusValue.isGated, withdrawalSafetyEnabled]); + }, [transferType, withdrawalAndTransferGatingStatusValue.isGated, withdrawalSafetyEnabled]); return { usdcWithdrawalCapacity: capacity,