diff --git a/src/hooks/usePendingSafeNotifications.ts b/src/features/counterfactual/hooks/usePendingSafeNotifications.ts similarity index 89% rename from src/hooks/usePendingSafeNotifications.ts rename to src/features/counterfactual/hooks/usePendingSafeNotifications.ts index cd80168439..7f0acbca7a 100644 --- a/src/hooks/usePendingSafeNotifications.ts +++ b/src/features/counterfactual/hooks/usePendingSafeNotifications.ts @@ -4,8 +4,8 @@ import { useEffect } from 'react' import { formatError } from '@/utils/formatters' import { showNotification } from '@/store/notificationsSlice' import { useAppDispatch } from '@/store' -import { useCurrentChain } from './useChains' -import useSafeAddress from './useSafeAddress' +import { useCurrentChain } from '@/hooks/useChains' +import useSafeAddress from '@/hooks/useSafeAddress' import { isWalletRejection } from '@/utils/wallets' const SafeCreationNotifications = { @@ -22,17 +22,11 @@ enum Variant { ERROR = 'error', } -const successEvents = [SafeCreationEvent.SUCCESS] - const usePendingSafeNotifications = (): void => { const dispatch = useAppDispatch() const chain = useCurrentChain() const safeAddress = useSafeAddress() - /** - * Show notifications of a transaction's lifecycle - */ - useEffect(() => { if (!chain) return @@ -43,7 +37,7 @@ const usePendingSafeNotifications = (): void => { const isError = 'error' in detail if (isError && isWalletRejection(detail.error)) return - const isSuccess = successEvents.includes(event) + const isSuccess = event === SafeCreationEvent.SUCCESS const message = isError ? `${baseMessage} ${formatError(detail.error)}` : baseMessage const txHash = 'txHash' in detail ? detail.txHash : undefined const groupKey = 'groupKey' in detail && detail.groupKey ? detail.groupKey : txHash || '' diff --git a/src/hooks/usePendingSafeStatuses.ts b/src/features/counterfactual/hooks/usePendingSafeStatuses.ts similarity index 95% rename from src/hooks/usePendingSafeStatuses.ts rename to src/features/counterfactual/hooks/usePendingSafeStatuses.ts index 0512a320aa..0bd2fd2953 100644 --- a/src/hooks/usePendingSafeStatuses.ts +++ b/src/features/counterfactual/hooks/usePendingSafeStatuses.ts @@ -9,8 +9,8 @@ import { checkSafeActionViaRelay, checkSafeActivation } from '@/features/counter import { isSmartContract, useWeb3ReadOnly } from '@/hooks/wallets/web3' import { useAppDispatch, useAppSelector } from '@/store' import { useEffect, useRef } from 'react' -import useChainId from './useChainId' -import useSafeInfo from './useSafeInfo' +import useChainId from '@/hooks/useChainId' +import useSafeInfo from '@/hooks/useSafeInfo' const pendingStatuses: Partial> = { [SafeCreationEvent.PROCESSING]: PendingSafeStatus.PROCESSING, @@ -44,19 +44,16 @@ const usePendingSafeMonitor = (): void => { const isProcessing = status === PendingSafeStatus.PROCESSING && txHash !== undefined const isRelaying = status === PendingSafeStatus.RELAYING && taskId !== undefined const isMonitored = monitoredSafes.current[safeAddress] - console.log({ isMonitored }) if ((!isProcessing && !isRelaying) || isMonitored) return monitoredSafes.current[safeAddress] = true if (isProcessing) { - console.log(isProcessing) checkSafeActivation(provider, txHash, safeAddress) } if (isRelaying) { - console.log(isRelaying) checkSafeActionViaRelay(taskId, safeAddress) } } @@ -110,7 +107,6 @@ const usePendingSafeStatus = (): void => { return } - // Or set a new status dispatch( updateUndeployedSafeStatus({ chainId: safe.chainId, diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index 0c2d1f97e8..60ee60c90a 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -1,5 +1,5 @@ -import usePendingSafeNotifications from '@/hooks/usePendingSafeNotifications' -import usePendingSafeStatus from '@/hooks/usePendingSafeStatuses' +import usePendingSafeNotifications from '@/features/counterfactual/hooks/usePendingSafeNotifications' +import usePendingSafeStatus from '@/features/counterfactual/hooks/usePendingSafeStatuses' import { SentryErrorBoundary } from '@/services/sentry' // needs to be imported first import useRehydrateSocialWallet from '@/hooks/wallets/mpc/useRehydrateSocialWallet' import PasswordRecoveryModal from '@/services/mpc/PasswordRecoveryModal'