diff --git a/src/components/common/BlockedAddress/index.tsx b/src/components/common/BlockedAddress/index.tsx index 4e2dc6d8ee..3d271d4228 100644 --- a/src/components/common/BlockedAddress/index.tsx +++ b/src/components/common/BlockedAddress/index.tsx @@ -5,7 +5,7 @@ import { useRouter } from 'next/router' import Disclaimer from '@/components/common/Disclaimer' import { AppRoutes } from '@/config/routes' -export const BlockedAddress = ({ address }: { address?: string }): ReactElement => { +export const BlockedAddress = ({ address, featureTitle }: { address: string; featureTitle: string }): ReactElement => { const theme = useTheme() const isMobile = useMediaQuery(theme.breakpoints.down('sm')) const displayAddress = address && isMobile ? shortenAddress(address) : address @@ -19,7 +19,7 @@ export const BlockedAddress = ({ address }: { address?: string }): ReactElement ) diff --git a/src/features/stake/components/StakePage/index.tsx b/src/features/stake/components/StakePage/index.tsx index 060cc84b6a..b42b388f44 100644 --- a/src/features/stake/components/StakePage/index.tsx +++ b/src/features/stake/components/StakePage/index.tsx @@ -4,12 +4,38 @@ import WidgetDisclaimer from '@/components/common/WidgetDisclaimer' import useStakeConsent from '@/features/stake/useStakeConsent' import StakingWidget from '../StakingWidget' import { useRouter } from 'next/router' +import { useGetIsSanctionedQuery } from '@/store/ofac' +import { skipToken } from '@reduxjs/toolkit/query/react' +import useWallet from '@/hooks/wallets/useWallet' +import useSafeInfo from '@/hooks/useSafeInfo' +import { getKeyWithTrueValue } from '@/utils/helpers' +import BlockedAddress from '@/components/common/BlockedAddress' const StakePage = () => { const { isConsentAccepted, onAccept } = useStakeConsent() const router = useRouter() const { asset } = router.query + const { safeAddress } = useSafeInfo() + const wallet = useWallet() + + const { data: isSafeAddressBlocked } = useGetIsSanctionedQuery(safeAddress || skipToken) + const { data: isWalletAddressBlocked } = useGetIsSanctionedQuery(wallet?.address || skipToken) + const blockedAddresses = { + [safeAddress]: !!isSafeAddressBlocked, + [wallet?.address || '']: !!isWalletAddressBlocked, + } + + const blockedAddress = getKeyWithTrueValue(blockedAddresses) + + if (blockedAddress) { + return ( + + + + ) + } + return ( <> {isConsentAccepted === undefined ? null : isConsentAccepted ? ( diff --git a/src/features/swap/index.tsx b/src/features/swap/index.tsx index b2ed794996..9ac20f238d 100644 --- a/src/features/swap/index.tsx +++ b/src/features/swap/index.tsx @@ -294,7 +294,7 @@ const SwapWidget = ({ sell }: Params) => { useCustomAppCommunicator(iframeRef, appData, chain) if (blockedAddress) { - return + return } if (!isConsentAccepted) { diff --git a/src/store/ofac.ts b/src/store/ofac.ts index 125969ff5b..0982ce5c9d 100644 --- a/src/store/ofac.ts +++ b/src/store/ofac.ts @@ -62,6 +62,7 @@ export const ofacApi = createApi({ return { error: { status: 'CUSTOM_ERROR', data: (error as Error).message } } } }, + keepUnusedDataFor: 24 * 60 * 60, // 24 hours }), }), })