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 7ab3382e1e..59243e5c93 100644 --- a/src/features/stake/components/StakePage/index.tsx +++ b/src/features/stake/components/StakePage/index.tsx @@ -3,9 +3,34 @@ import Disclaimer from '@/components/common/Disclaimer' import WidgetDisclaimer from '@/components/common/WidgetDisclaimer' import useStakeConsent from '@/features/stake/useStakeConsent' import StakingWidget from '../StakingWidget' +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 { safeAddress, safeLoading } = 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 ( <> 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) {