Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: withdraw notification can mistake for keplr deposit #983

Merged
merged 1 commit into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/hooks/useNotificationTypes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Loading