From 5d70df11fde89ebe9c3fb85efe97f5dfbd886054 Mon Sep 17 00:00:00 2001 From: Bill He Date: Wed, 4 Sep 2024 11:47:55 -0700 Subject: [PATCH] fix: withdraw notification can mistake for keplr deposit --- src/hooks/useNotificationTypes.tsx | 6 ++++-- .../notifications/TransferStatusNotification/index.tsx | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/hooks/useNotificationTypes.tsx b/src/hooks/useNotificationTypes.tsx index 7cdc5d120..63d2e4398 100644 --- a/src/hooks/useNotificationTypes.tsx +++ b/src/hooks/useNotificationTypes.tsx @@ -215,7 +215,8 @@ export const notificationTypes: NotificationTypeConfig[] = [ useEffect(() => { // eslint-disable-next-line no-restricted-syntax for (const transfer of transferNotifications) { - const { id, fromChainId, status, txHash, toAmount, type, isExchange } = transfer; + const { id, fromChainId, toChainId, status, txHash, toAmount, type, isExchange } = + transfer; const transferType = type ?? (fromChainId === selectedDydxChainId @@ -224,7 +225,8 @@ export const notificationTypes: NotificationTypeConfig[] = [ const isCosmosDeposit = SUPPORTED_COSMOS_CHAINS.includes(fromChainId ?? '') && - fromChainId !== selectedDydxChainId; + fromChainId !== selectedDydxChainId && + toChainId === selectedDydxChainId; const isFinished = (Boolean(status) && status?.squidTransactionStatus !== 'ongoing') || isExchange; diff --git a/src/views/notifications/TransferStatusNotification/index.tsx b/src/views/notifications/TransferStatusNotification/index.tsx index dfd8ef666..7497bee7e 100644 --- a/src/views/notifications/TransferStatusNotification/index.tsx +++ b/src/views/notifications/TransferStatusNotification/index.tsx @@ -55,7 +55,8 @@ export const TransferStatusNotification = ({ const { addOrUpdateTransferNotification } = useLocalNotifications(); const selectedDydxChainId = useAppSelector(getSelectedDydxChainId); - const { status, toAmount, isExchange, fromChainId, isSubaccountDepositCompleted } = transfer; + const { status, toAmount, isExchange, fromChainId, toChainId, isSubaccountDepositCompleted } = + transfer; // @ts-ignore status.errors is not in the type definition but can be returned const error = status?.errors?.length ? status?.errors[0] : status?.error; @@ -80,7 +81,9 @@ export const TransferStatusNotification = ({ useInterval({ callback: updateSecondsLeft }); const isCosmosDeposit = - SUPPORTED_COSMOS_CHAINS.includes(fromChainId ?? '') && fromChainId !== selectedDydxChainId; + SUPPORTED_COSMOS_CHAINS.includes(fromChainId ?? '') && + fromChainId !== selectedDydxChainId && + toChainId === selectedDydxChainId; const isComplete = isCosmosDeposit ? isSubaccountDepositCompleted : status?.squidTransactionStatus === 'success' || isExchange;