Skip to content

Commit 22077ca

Browse files
foodakaAGMASO
andauthored
Feat/compliance gate (#2855)
Co-authored-by: Alejandro <95312462+AGMASO@users.noreply.github.com>
1 parent 17dfaae commit 22077ca

8 files changed

Lines changed: 28 additions & 50 deletions

File tree

‎pages/api/preflight-compliance.ts‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ export default async function handler(
6161
},
6262
});
6363

64-
console.log('RESPONSE---', response);
65-
6664
if (!response.ok) {
6765
if (response.status === 401) {
6866
console.error('Compliance API: Invalid secret');
@@ -75,7 +73,6 @@ export default async function handler(
7573
}
7674

7775
const data: ComplianceApiResponse = await response.json();
78-
console.log('DATA---', data);
7976

8077
return res.status(200).json({
8178
result: data.result,

‎src/components/AddressBlocked.tsx‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ type ComplianceGateProps = {
1212
};
1313

1414
export const AddressBlocked = ({ children }: ComplianceGateProps) => {
15-
const { status, recheck, errorMessage } = useCompliance();
15+
const { status, recheck } = useCompliance();
1616
const { currentAccount, readOnlyMode } = useWeb3Context();
1717
const { disconnect } = useDisconnect();
1818
const shouldCheck = !readOnlyMode && !ENABLE_TESTNET;
@@ -34,7 +34,6 @@ export const AddressBlocked = ({ children }: ComplianceGateProps) => {
3434
address={currentAccount}
3535
onDisconnectWallet={() => disconnect()}
3636
isError={showErrorOverlay}
37-
errorMessage={errorMessage}
3837
onRetry={showErrorOverlay ? recheck : undefined}
3938
/>
4039
</MainLayout>

‎src/components/AddressBlockedModal.tsx‎

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ExclamationCircleIcon, LogoutIcon } from '@heroicons/react/outline';
1+
import { ExclamationCircleIcon, LogoutIcon, RefreshIcon } from '@heroicons/react/outline';
22
import { Trans } from '@lingui/macro';
33
import { Box, Button, SvgIcon, Typography } from '@mui/material';
44

@@ -8,29 +8,18 @@ export interface AddressBlockedProps {
88
address: string;
99
onDisconnectWallet: () => void;
1010
isError?: boolean;
11-
errorMessage?: string;
1211
onRetry?: () => void;
1312
}
1413

1514
export const AddressBlockedModal = ({
1615
address,
1716
onDisconnectWallet,
1817
isError = false,
19-
errorMessage,
2018
onRetry,
2119
}: AddressBlockedProps) => {
2220
// eslint-disable-next-line @typescript-eslint/no-empty-function, @typescript-eslint/no-unused-vars
2321
const setOpen = (_value: boolean) => {}; // ignore, we want the modal to not be dismissable
2422

25-
const description = isError ? (
26-
errorMessage || <Trans>Something went wrong. Please try again later.</Trans>
27-
) : (
28-
<Trans>
29-
Sorry, we are unable to connect your wallet. <br />
30-
Please try again with another wallet or contact support.
31-
</Trans>
32-
);
33-
3423
return (
3524
<BasicModal open={true} withCloseButton={false} setOpen={setOpen}>
3625
<Box
@@ -45,26 +34,27 @@ export const AddressBlockedModal = ({
4534
<ExclamationCircleIcon />
4635
</SvgIcon>
4736
<Typography variant="h2">
48-
<Trans>Connection Failed</Trans>
37+
<Trans>Connection Error</Trans>
4938
</Typography>
5039
<Typography variant="helperText" sx={{ my: 4 }}>
5140
{address}
5241
</Typography>
53-
<Typography variant="description" sx={{ textAlign: 'center', mb: 4 }}>
54-
{description}
55-
</Typography>
5642
<Box sx={{ display: 'flex', gap: 2 }}>
57-
{isError && onRetry && (
58-
<Button variant="outlined" onClick={onRetry}>
59-
<Trans>Retry</Trans>
43+
{isError && onRetry ? (
44+
<Button variant="contained" onClick={onRetry}>
45+
<SvgIcon fontSize="small" sx={{ mx: 1 }}>
46+
<RefreshIcon />
47+
</SvgIcon>
48+
<Trans>Refresh</Trans>
49+
</Button>
50+
) : (
51+
<Button variant="contained" onClick={onDisconnectWallet}>
52+
<SvgIcon fontSize="small" sx={{ mx: 1 }}>
53+
<LogoutIcon />
54+
</SvgIcon>
55+
<Trans>Disconnect Wallet</Trans>
6056
</Button>
6157
)}
62-
<Button variant="contained" onClick={onDisconnectWallet}>
63-
<SvgIcon fontSize="small" sx={{ mx: 1 }}>
64-
<LogoutIcon />
65-
</SvgIcon>
66-
<Trans>Disconnect Wallet</Trans>
67-
</Button>
6858
</Box>
6959
</Box>
7060
</BasicModal>

‎src/locales/el/messages.js‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/locales/en/messages.js‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/locales/en/messages.po‎

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -507,10 +507,6 @@ msgstr "Markets"
507507
msgid "Proposals"
508508
msgstr "Proposals"
509509

510-
#: src/components/AddressBlockedModal.tsx
511-
msgid "Retry"
512-
msgstr "Retry"
513-
514510
#: pages/500.page.tsx
515511
msgid "Copy error message"
516512
msgstr "Copy error message"
@@ -1736,10 +1732,6 @@ msgstr "Fee"
17361732
msgid "Participating in staking {symbol} gives annualized rewards. Your wallet balance is the sum of your aTokens and underlying assets. The breakdown to stake is below"
17371733
msgstr "Participating in staking {symbol} gives annualized rewards. Your wallet balance is the sum of your aTokens and underlying assets. The breakdown to stake is below"
17381734

1739-
#: src/components/AddressBlockedModal.tsx
1740-
msgid "Sorry, we are unable to connect your wallet. <0/>Please try again with another wallet or contact support."
1741-
msgstr "Sorry, we are unable to connect your wallet. <0/>Please try again with another wallet or contact support."
1742-
17431735
#: src/components/transactions/Swap/details/CollateralSwapDetails.tsx
17441736
#: src/modules/migration/MigrationListMobileItem.tsx
17451737
#: src/modules/reserve-overview/ReserveEModePanel.tsx
@@ -3089,6 +3081,10 @@ msgstr "and about SPK program"
30893081
msgid "DAI balance will be converted via DSR contracts and then supplied as sDAI. Switching incurs no additional costs and no slippage."
30903082
msgstr "DAI balance will be converted via DSR contracts and then supplied as sDAI. Switching incurs no additional costs and no slippage."
30913083

3084+
#: src/components/AddressBlockedModal.tsx
3085+
msgid "Refresh"
3086+
msgstr "Refresh"
3087+
30923088
#: src/components/infoTooltips/MigrationDisabledTooltip.tsx
30933089
msgid "Asset cannot be migrated due to insufficient liquidity or borrow cap limitation in {marketName} v3 market."
30943090
msgstr "Asset cannot be migrated due to insufficient liquidity or borrow cap limitation in {marketName} v3 market."
@@ -3119,10 +3115,6 @@ msgstr "Learn more in our <0>FAQ guide</0>"
31193115
msgid "The selected rate is lower than the market price. You might incur a loss if you proceed."
31203116
msgstr "The selected rate is lower than the market price. You might incur a loss if you proceed."
31213117

3122-
#: src/components/AddressBlockedModal.tsx
3123-
msgid "Something went wrong. Please try again later."
3124-
msgstr "Something went wrong. Please try again later."
3125-
31263118
#: src/modules/sGho/SGhoDepositPanel.tsx
31273119
msgid "Deposit GHO and earn {0}% APY"
31283120
msgstr "Deposit GHO and earn {0}% APY"
@@ -3416,10 +3408,6 @@ msgstr "The caller of this function must be a pool"
34163408
msgid "Migrate to V3"
34173409
msgstr "Migrate to V3"
34183410

3419-
#: src/components/AddressBlockedModal.tsx
3420-
msgid "Connection Failed"
3421-
msgstr "Connection Failed"
3422-
34233411
#: src/modules/reserve-overview/ReserveConfiguration.tsx
34243412
msgid "Interest rate strategy"
34253413
msgstr "Interest rate strategy"
@@ -3729,6 +3717,10 @@ msgstr "Claim all protocol rewards"
37293717
msgid "No assets selected to migrate."
37303718
msgstr "No assets selected to migrate."
37313719

3720+
#: src/components/AddressBlockedModal.tsx
3721+
msgid "Connection Error"
3722+
msgstr "Connection Error"
3723+
37323724
#: src/components/transactions/Swap/errors/shared/GasEstimationError.tsx
37333725
msgid "Tip: Try improving your order parameters"
37343726
msgstr "Tip: Try improving your order parameters"

‎src/locales/es/messages.js‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/locales/fr/messages.js‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)