@dynamic-labs/sdk-react-core 3.0.3 → 4.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -10
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +12 -12
- package/src/lib/components/index.d.ts +0 -1
- package/src/lib/context/ConnectWithOtpContext/ConnectWithOtpProvider.cjs +5 -2
- package/src/lib/context/ConnectWithOtpContext/ConnectWithOtpProvider.js +5 -2
- package/src/lib/context/ConnectWithOtpContext/utils/createSmsHandler.cjs +1 -70
- package/src/lib/context/ConnectWithOtpContext/utils/createSmsHandler.d.ts +2 -1
- package/src/lib/context/ConnectWithOtpContext/utils/createSmsHandler.js +1 -70
- package/src/lib/context/DynamicContext/DynamicContext.cjs +6 -5
- package/src/lib/context/DynamicContext/DynamicContext.js +6 -5
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.cjs +68 -0
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.js +68 -0
- package/src/lib/context/DynamicContext/hooks/useRegisterStorageService/useRegisterStorageService.cjs +2 -0
- package/src/lib/context/DynamicContext/hooks/useRegisterStorageService/useRegisterStorageService.js +3 -1
- package/src/lib/context/PhantomRedirectContext/useResponseHandlers.cjs +1 -1
- package/src/lib/context/PhantomRedirectContext/useResponseHandlers.js +1 -1
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.cjs +1 -1
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.js +1 -1
- package/src/lib/context/ViewContext/types/index.d.ts +1 -1
- package/src/lib/data/api/embeddedWallets/embeddedWallets.cjs +12 -5
- package/src/lib/data/api/embeddedWallets/embeddedWallets.d.ts +4 -3
- package/src/lib/data/api/embeddedWallets/embeddedWallets.js +14 -7
- package/src/lib/data/api/transactions/blockaid.cjs +23 -0
- package/src/lib/data/api/transactions/blockaid.js +19 -0
- package/src/lib/events/auth.d.ts +2 -0
- package/src/lib/locale/en/translation.cjs +34 -0
- package/src/lib/locale/en/translation.d.ts +34 -0
- package/src/lib/locale/en/translation.js +34 -0
- package/src/lib/shared/assets/caution-triangle.cjs +54 -0
- package/src/lib/shared/assets/caution-triangle.js +30 -0
- package/src/lib/shared/assets/exclamation-circle.cjs +54 -0
- package/src/lib/shared/assets/exclamation-circle.js +30 -0
- package/src/lib/shared/assets/exclamation.cjs +52 -0
- package/src/lib/shared/assets/exclamation.js +28 -0
- package/src/lib/shared/assets/index.d.ts +5 -0
- package/src/lib/shared/assets/warning-orange.cjs +54 -0
- package/src/lib/shared/assets/warning-orange.js +30 -0
- package/src/lib/shared/assets/warning-red.cjs +54 -0
- package/src/lib/shared/assets/warning-red.js +30 -0
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/constants/localStorage.cjs +6 -0
- package/src/lib/utils/constants/localStorage.d.ts +3 -0
- package/src/lib/utils/constants/localStorage.js +5 -1
- package/src/lib/utils/functions/getNewVerifiedCredentialsFromDiff/getNewVerifiedCredentialsFromDiff.cjs +11 -0
- package/src/lib/utils/functions/getNewVerifiedCredentialsFromDiff/getNewVerifiedCredentialsFromDiff.d.ts +2 -0
- package/src/lib/utils/functions/getNewVerifiedCredentialsFromDiff/getNewVerifiedCredentialsFromDiff.js +7 -0
- package/src/lib/utils/functions/getNewVerifiedCredentialsFromDiff/index.d.ts +1 -0
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +1 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +1 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.cjs +1 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.js +1 -1
- package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.cjs +1 -1
- package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.js +1 -1
- package/src/lib/utils/hooks/index.d.ts +1 -0
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.cjs +1 -0
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.js +1 -0
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.cjs +9 -2
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.js +9 -2
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/utils.cjs +15 -2
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/utils.d.ts +3 -1
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/utils.js +15 -3
- package/src/lib/utils/hooks/useEmbeddedWalletSessionKeys/useEmbeddedWalletSessionKeys.cjs +82 -26
- package/src/lib/utils/hooks/useEmbeddedWalletSessionKeys/useEmbeddedWalletSessionKeys.d.ts +19 -2
- package/src/lib/utils/hooks/useEmbeddedWalletSessionKeys/useEmbeddedWalletSessionKeys.js +82 -26
- package/src/lib/utils/hooks/useEndUserWarning/index.d.ts +1 -0
- package/src/lib/utils/hooks/useEndUserWarning/useEndUserWarning.cjs +37 -0
- package/src/lib/utils/hooks/useEndUserWarning/useEndUserWarning.d.ts +5 -0
- package/src/lib/utils/hooks/useEndUserWarning/useEndUserWarning.js +33 -0
- package/src/lib/utils/hooks/useExternalAuth/useExternalAuth.cjs +5 -2
- package/src/lib/utils/hooks/useExternalAuth/useExternalAuth.js +5 -2
- package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.cjs +2 -2
- package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.d.ts +2 -1
- package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.js +2 -2
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +7 -3
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.d.ts +2 -1
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +7 -3
- package/src/lib/utils/hooks/useTelegramLogin/useTelegramLogin.cjs +25 -24
- package/src/lib/utils/hooks/useTelegramLogin/useTelegramLogin.d.ts +7 -1
- package/src/lib/utils/hooks/useTelegramLogin/useTelegramLogin.js +25 -24
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +4 -1
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +4 -1
- package/src/lib/views/EmailVerification/EmailVerification.cjs +4 -1
- package/src/lib/views/EmailVerification/EmailVerification.js +4 -1
- package/src/lib/views/GlobalWalletMaliciousView/GlobalWalletMaliciousView.cjs +139 -0
- package/src/lib/views/GlobalWalletMaliciousView/GlobalWalletMaliciousView.d.ts +11 -0
- package/src/lib/views/GlobalWalletMaliciousView/GlobalWalletMaliciousView.js +134 -0
- package/src/lib/views/SmsVerification/useSmsVerification/useSmsVerification.cjs +5 -2
- package/src/lib/views/SmsVerification/useSmsVerification/useSmsVerification.js +5 -2
- package/src/lib/views/viewToComponentMap.cjs +2 -0
- package/src/lib/views/viewToComponentMap.d.ts +1 -0
- package/src/lib/views/viewToComponentMap.js +2 -0
- package/src/lib/widgets/DynamicWidget/views/GlobalWalletView/GlobalWalletView.cjs +31 -8
- package/src/lib/widgets/DynamicWidget/views/GlobalWalletView/GlobalWalletView.js +31 -8
- package/src/lib/components/TelegramAutoLogin/TelegramAutoLogin.cjs +0 -99
- package/src/lib/components/TelegramAutoLogin/TelegramAutoLogin.d.ts +0 -1
- package/src/lib/components/TelegramAutoLogin/TelegramAutoLogin.js +0 -95
- package/src/lib/components/TelegramAutoLogin/index.d.ts +0 -1
- package/src/lib/utils/constants/sessionStorage.cjs +0 -12
- package/src/lib/utils/constants/sessionStorage.js +0 -7
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var reactI18next = require('react-i18next');
|
|
8
|
+
require('@dynamic-labs/sdk-api-core');
|
|
9
|
+
require('../../shared/logger.cjs');
|
|
10
|
+
require('@dynamic-labs/iconic');
|
|
11
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
12
|
+
require('../../context/ViewContext/ViewContext.cjs');
|
|
13
|
+
require('react');
|
|
14
|
+
var exclamation = require('../../shared/assets/exclamation.cjs');
|
|
15
|
+
var exclamationCircle = require('../../shared/assets/exclamation-circle.cjs');
|
|
16
|
+
var cautionTriangle = require('../../shared/assets/caution-triangle.cjs');
|
|
17
|
+
var warningRed = require('../../shared/assets/warning-red.cjs');
|
|
18
|
+
var warningOrange = require('../../shared/assets/warning-orange.cjs');
|
|
19
|
+
require('@dynamic-labs/wallet-book');
|
|
20
|
+
require('@dynamic-labs/utils');
|
|
21
|
+
require('../../utils/constants/colors.cjs');
|
|
22
|
+
require('../../utils/constants/values.cjs');
|
|
23
|
+
require('../../store/state/loadingAndLifecycle.cjs');
|
|
24
|
+
require('../../shared/consts/index.cjs');
|
|
25
|
+
var DynamicWidgetContext = require('../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
26
|
+
require('../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
27
|
+
require('../../components/Alert/Alert.cjs');
|
|
28
|
+
require('../../events/dynamicEvents.cjs');
|
|
29
|
+
require('../../../../_virtual/_tslib.cjs');
|
|
30
|
+
require('../../context/DynamicContext/DynamicContext.cjs');
|
|
31
|
+
var useInternalDynamicContext = require('../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
|
|
32
|
+
require('../../context/CaptchaContext/CaptchaContext.cjs');
|
|
33
|
+
require('../../context/ErrorContext/ErrorContext.cjs');
|
|
34
|
+
require('@dynamic-labs/multi-wallet');
|
|
35
|
+
require('react-international-phone');
|
|
36
|
+
require('../../config/ApiEndpoint.cjs');
|
|
37
|
+
require('../../store/state/user/user.cjs');
|
|
38
|
+
require('../../locale/locale.cjs');
|
|
39
|
+
require('../../store/state/projectSettings/projectSettings.cjs');
|
|
40
|
+
require('../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
41
|
+
require('../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
42
|
+
require('../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
43
|
+
require('../../context/VerificationContext/VerificationContext.cjs');
|
|
44
|
+
require('react-dom');
|
|
45
|
+
require('../../context/WalletContext/WalletContext.cjs');
|
|
46
|
+
require('../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs');
|
|
47
|
+
require('../../context/ThemeContext/ThemeContext.cjs');
|
|
48
|
+
require('../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
49
|
+
require('@dynamic-labs/types');
|
|
50
|
+
require('../../context/LoadingContext/LoadingContext.cjs');
|
|
51
|
+
require('yup');
|
|
52
|
+
require('../../context/MockContext/MockContext.cjs');
|
|
53
|
+
require('../CollectUserDataView/useFields.cjs');
|
|
54
|
+
require('../../context/FieldsStateContext/FieldsStateContext.cjs');
|
|
55
|
+
require('../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
56
|
+
require('@dynamic-labs/rpc-providers');
|
|
57
|
+
require('../../store/state/environmentId.cjs');
|
|
58
|
+
require('../../store/state/walletConnectorOptions.cjs');
|
|
59
|
+
var Typography = require('../../components/Typography/Typography.cjs');
|
|
60
|
+
require('../../context/FooterAnimationContext/index.cjs');
|
|
61
|
+
require('../../components/ShadowDOM/ShadowDOM.cjs');
|
|
62
|
+
require('../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
63
|
+
require('../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
64
|
+
require('../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
65
|
+
require('../../components/OverlayCard/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
66
|
+
require('../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
67
|
+
require('../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
68
|
+
require('../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
69
|
+
require('react-focus-lock');
|
|
70
|
+
require('../../components/IconButton/IconButton.cjs');
|
|
71
|
+
require('../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
72
|
+
var TypographyButton = require('../../components/TypographyButton/TypographyButton.cjs');
|
|
73
|
+
require('formik');
|
|
74
|
+
require('../../store/state/sendBalances.cjs');
|
|
75
|
+
require('../../components/Input/Input.cjs');
|
|
76
|
+
require('../TransactionConfirmationView/helpers/transactionErrorMessage.cjs');
|
|
77
|
+
require('../../context/PasskeyContext/PasskeyContext.cjs');
|
|
78
|
+
require('../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
79
|
+
require('../../../polyfills.cjs');
|
|
80
|
+
require('../../context/ErrorBoundary/ErrorBoundaryBase.cjs');
|
|
81
|
+
require('../../context/ErrorBoundary/ErrorBoundaryContext.cjs');
|
|
82
|
+
require('../../widgets/DynamicBridgeWidget/context/DynamicBridgeWidgetContext/DynamicBridgeWidgetContext.cjs');
|
|
83
|
+
require('../../widgets/DynamicWidget/components/DynamicWidgetCard/DynamicWidgetCard.cjs');
|
|
84
|
+
require('../../components/IsBrowser/IsBrowser.cjs');
|
|
85
|
+
require('../../context/WidgetRegistry/WidgetRegistryContextProvider.cjs');
|
|
86
|
+
require('../../context/FundingContext/FundingContext.cjs');
|
|
87
|
+
require('../../components/Popper/Popper/Popper.cjs');
|
|
88
|
+
require('../../components/Popper/PopperContext/PopperContext.cjs');
|
|
89
|
+
require('../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
90
|
+
require('@hcaptcha/react-hcaptcha');
|
|
91
|
+
require('../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
92
|
+
require('../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
93
|
+
require('../../context/SendBalanceContext/SendBalanceContext.cjs');
|
|
94
|
+
require('../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
|
|
95
|
+
require('../../context/ConnectWithOtpContext/constants.cjs');
|
|
96
|
+
require('../../context/ReinitializeContext/ReinitializeContextProvider.cjs');
|
|
97
|
+
require('../../store/state/tokenBalances.cjs');
|
|
98
|
+
require('../../components/InlineWidget/InlineWidget.cjs');
|
|
99
|
+
require('qrcode');
|
|
100
|
+
|
|
101
|
+
const GlobalWalletMaliciousView = ({ maliciousSiteInfo }) => {
|
|
102
|
+
const { t } = reactI18next.useTranslation();
|
|
103
|
+
const { setDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
|
|
104
|
+
const { setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
105
|
+
const handleBack = () => {
|
|
106
|
+
setDynamicWidgetView('global-wallet');
|
|
107
|
+
setShowAuthFlow(false, {
|
|
108
|
+
ignoreIfIsEmbeddedWidget: false,
|
|
109
|
+
performMultiWalletChecks: false,
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
const handleProceed = () => {
|
|
113
|
+
var _a;
|
|
114
|
+
(_a = maliciousSiteInfo.proceedFlow) === null || _a === void 0 ? void 0 : _a.call(maliciousSiteInfo);
|
|
115
|
+
};
|
|
116
|
+
return (jsxRuntime.jsx("div", { className: 'malicious-site-view', children: jsxRuntime.jsx("div", { className: 'popup-content', children: jsxRuntime.jsxs("div", { className: 'wallet-connection-view', children: [jsxRuntime.jsxs("div", { className: 'warning-icon-container', style: { position: 'relative' }, children: [maliciousSiteInfo.isDefinitelyMalicious ? (jsxRuntime.jsx(warningRed.ReactComponent, { className: 'warning-icon' })) : (jsxRuntime.jsx(warningOrange.ReactComponent, { className: 'warning-icon' })), jsxRuntime.jsx(exclamation.ReactComponent, { className: 'exclamation-icon', style: {
|
|
117
|
+
left: '50%',
|
|
118
|
+
position: 'absolute',
|
|
119
|
+
top: '50%',
|
|
120
|
+
transform: 'translate(-50%, -50%)',
|
|
121
|
+
} })] }), jsxRuntime.jsx(Typography.Typography, { className: 'connection-title', variant: 'title', font: 'bold', color: 'primary', children: maliciousSiteInfo.isDefinitelyMalicious
|
|
122
|
+
? t('global_wallet.malicious_site.certain.title')
|
|
123
|
+
: t('global_wallet.malicious_site.unknown.title') }), jsxRuntime.jsxs("div", { className: `subtitle-container ${maliciousSiteInfo.isDefinitelyMalicious
|
|
124
|
+
? 'definitely-malicious'
|
|
125
|
+
: 'unknown'}`, children: [jsxRuntime.jsxs("div", { className: 'subtitle-header-container', children: [maliciousSiteInfo.isDefinitelyMalicious ? (jsxRuntime.jsx(exclamationCircle.ReactComponent, { className: 'caution-icon' })) : (jsxRuntime.jsx(cautionTriangle.ReactComponent, { className: 'caution-icon' })), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', className: 'subtitle-header', color: 'primary', children: maliciousSiteInfo.isDefinitelyMalicious
|
|
126
|
+
? t('global_wallet.malicious_site.certain.subtitle_header')
|
|
127
|
+
: t('global_wallet.malicious_site.unknown.subtitle_header') })] }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', className: 'subtitle', color: 'secondary', children: maliciousSiteInfo.isDefinitelyMalicious
|
|
128
|
+
? t('global_wallet.malicious_site.certain.subtitle_text')
|
|
129
|
+
: t('global_wallet.malicious_site.unknown.subtitle_text') })] }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', className: 'site-info', color: 'secondary', children: maliciousSiteInfo.url }), jsxRuntime.jsxs("div", { className: 'button-group', children: [jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonClassName: 'cancel-button', buttonVariant: 'primary', type: 'submit', buttonPadding: 'large', onClick: handleBack, copykey: 'global_wallet.malicious_site.go_back', children: maliciousSiteInfo.isDefinitelyMalicious
|
|
130
|
+
? t('global_wallet.malicious_site.certain.go_back')
|
|
131
|
+
: t('global_wallet.malicious_site.unknown.go_back') }), jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonClassName: 'proceed-button', buttonVariant: 'secondary', type: 'submit', buttonPadding: 'large', onClick: handleProceed, copykey: 'global_wallet.malicious_site.proceed', typographyProps: {
|
|
132
|
+
color: 'error-1',
|
|
133
|
+
}, children: maliciousSiteInfo.isDefinitelyMalicious
|
|
134
|
+
? t('global_wallet.malicious_site.certain.proceed')
|
|
135
|
+
: t('global_wallet.malicious_site.unknown.proceed') })] })] }) }) }));
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
exports.GlobalWalletMaliciousView = GlobalWalletMaliciousView;
|
|
139
|
+
exports["default"] = GlobalWalletMaliciousView;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface MaliciousSiteInfo {
|
|
3
|
+
isDefinitelyMalicious: boolean;
|
|
4
|
+
url: string;
|
|
5
|
+
proceedFlow: () => void;
|
|
6
|
+
}
|
|
7
|
+
export interface GlobalWalletMaliciousViewProps {
|
|
8
|
+
maliciousSiteInfo: MaliciousSiteInfo;
|
|
9
|
+
}
|
|
10
|
+
export declare const GlobalWalletMaliciousView: React.FC<GlobalWalletMaliciousViewProps>;
|
|
11
|
+
export default GlobalWalletMaliciousView;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import '@dynamic-labs/sdk-api-core';
|
|
5
|
+
import '../../shared/logger.js';
|
|
6
|
+
import '@dynamic-labs/iconic';
|
|
7
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
8
|
+
import '../../context/ViewContext/ViewContext.js';
|
|
9
|
+
import 'react';
|
|
10
|
+
import { ReactComponent as SvgExclamation } from '../../shared/assets/exclamation.js';
|
|
11
|
+
import { ReactComponent as SvgExclamationCircle } from '../../shared/assets/exclamation-circle.js';
|
|
12
|
+
import { ReactComponent as SvgCautionTriangle } from '../../shared/assets/caution-triangle.js';
|
|
13
|
+
import { ReactComponent as SvgWarningRed } from '../../shared/assets/warning-red.js';
|
|
14
|
+
import { ReactComponent as SvgWarningOrange } from '../../shared/assets/warning-orange.js';
|
|
15
|
+
import '@dynamic-labs/wallet-book';
|
|
16
|
+
import '@dynamic-labs/utils';
|
|
17
|
+
import '../../utils/constants/colors.js';
|
|
18
|
+
import '../../utils/constants/values.js';
|
|
19
|
+
import '../../store/state/loadingAndLifecycle.js';
|
|
20
|
+
import '../../shared/consts/index.js';
|
|
21
|
+
import { useWidgetContext } from '../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
22
|
+
import '../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
23
|
+
import '../../components/Alert/Alert.js';
|
|
24
|
+
import '../../events/dynamicEvents.js';
|
|
25
|
+
import '../../../../_virtual/_tslib.js';
|
|
26
|
+
import '../../context/DynamicContext/DynamicContext.js';
|
|
27
|
+
import { useInternalDynamicContext } from '../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.js';
|
|
28
|
+
import '../../context/CaptchaContext/CaptchaContext.js';
|
|
29
|
+
import '../../context/ErrorContext/ErrorContext.js';
|
|
30
|
+
import '@dynamic-labs/multi-wallet';
|
|
31
|
+
import 'react-international-phone';
|
|
32
|
+
import '../../config/ApiEndpoint.js';
|
|
33
|
+
import '../../store/state/user/user.js';
|
|
34
|
+
import '../../locale/locale.js';
|
|
35
|
+
import '../../store/state/projectSettings/projectSettings.js';
|
|
36
|
+
import '../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
37
|
+
import '../../context/AccountExistsContext/AccountExistsContext.js';
|
|
38
|
+
import '../../context/UserWalletsContext/UserWalletsContext.js';
|
|
39
|
+
import '../../context/VerificationContext/VerificationContext.js';
|
|
40
|
+
import 'react-dom';
|
|
41
|
+
import '../../context/WalletContext/WalletContext.js';
|
|
42
|
+
import '../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
|
|
43
|
+
import '../../context/ThemeContext/ThemeContext.js';
|
|
44
|
+
import '../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
45
|
+
import '@dynamic-labs/types';
|
|
46
|
+
import '../../context/LoadingContext/LoadingContext.js';
|
|
47
|
+
import 'yup';
|
|
48
|
+
import '../../context/MockContext/MockContext.js';
|
|
49
|
+
import '../CollectUserDataView/useFields.js';
|
|
50
|
+
import '../../context/FieldsStateContext/FieldsStateContext.js';
|
|
51
|
+
import '../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
52
|
+
import '@dynamic-labs/rpc-providers';
|
|
53
|
+
import '../../store/state/environmentId.js';
|
|
54
|
+
import '../../store/state/walletConnectorOptions.js';
|
|
55
|
+
import { Typography } from '../../components/Typography/Typography.js';
|
|
56
|
+
import '../../context/FooterAnimationContext/index.js';
|
|
57
|
+
import '../../components/ShadowDOM/ShadowDOM.js';
|
|
58
|
+
import '../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
59
|
+
import '../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
60
|
+
import '../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
61
|
+
import '../../components/OverlayCard/OverlayCardTarget/OverlayCardTarget.js';
|
|
62
|
+
import '../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
63
|
+
import '../../context/WalletGroupContext/WalletGroupContext.js';
|
|
64
|
+
import '../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
65
|
+
import 'react-focus-lock';
|
|
66
|
+
import '../../components/IconButton/IconButton.js';
|
|
67
|
+
import '../../components/MenuList/Dropdown/Dropdown.js';
|
|
68
|
+
import { TypographyButton } from '../../components/TypographyButton/TypographyButton.js';
|
|
69
|
+
import 'formik';
|
|
70
|
+
import '../../store/state/sendBalances.js';
|
|
71
|
+
import '../../components/Input/Input.js';
|
|
72
|
+
import '../TransactionConfirmationView/helpers/transactionErrorMessage.js';
|
|
73
|
+
import '../../context/PasskeyContext/PasskeyContext.js';
|
|
74
|
+
import '../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
75
|
+
import '../../../polyfills.js';
|
|
76
|
+
import '../../context/ErrorBoundary/ErrorBoundaryBase.js';
|
|
77
|
+
import '../../context/ErrorBoundary/ErrorBoundaryContext.js';
|
|
78
|
+
import '../../widgets/DynamicBridgeWidget/context/DynamicBridgeWidgetContext/DynamicBridgeWidgetContext.js';
|
|
79
|
+
import '../../widgets/DynamicWidget/components/DynamicWidgetCard/DynamicWidgetCard.js';
|
|
80
|
+
import '../../components/IsBrowser/IsBrowser.js';
|
|
81
|
+
import '../../context/WidgetRegistry/WidgetRegistryContextProvider.js';
|
|
82
|
+
import '../../context/FundingContext/FundingContext.js';
|
|
83
|
+
import '../../components/Popper/Popper/Popper.js';
|
|
84
|
+
import '../../components/Popper/PopperContext/PopperContext.js';
|
|
85
|
+
import '../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
86
|
+
import '@hcaptcha/react-hcaptcha';
|
|
87
|
+
import '../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
88
|
+
import '../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
89
|
+
import '../../context/SendBalanceContext/SendBalanceContext.js';
|
|
90
|
+
import '../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
91
|
+
import '../../context/ConnectWithOtpContext/constants.js';
|
|
92
|
+
import '../../context/ReinitializeContext/ReinitializeContextProvider.js';
|
|
93
|
+
import '../../store/state/tokenBalances.js';
|
|
94
|
+
import '../../components/InlineWidget/InlineWidget.js';
|
|
95
|
+
import 'qrcode';
|
|
96
|
+
|
|
97
|
+
const GlobalWalletMaliciousView = ({ maliciousSiteInfo }) => {
|
|
98
|
+
const { t } = useTranslation();
|
|
99
|
+
const { setDynamicWidgetView } = useWidgetContext();
|
|
100
|
+
const { setShowAuthFlow } = useInternalDynamicContext();
|
|
101
|
+
const handleBack = () => {
|
|
102
|
+
setDynamicWidgetView('global-wallet');
|
|
103
|
+
setShowAuthFlow(false, {
|
|
104
|
+
ignoreIfIsEmbeddedWidget: false,
|
|
105
|
+
performMultiWalletChecks: false,
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
const handleProceed = () => {
|
|
109
|
+
var _a;
|
|
110
|
+
(_a = maliciousSiteInfo.proceedFlow) === null || _a === void 0 ? void 0 : _a.call(maliciousSiteInfo);
|
|
111
|
+
};
|
|
112
|
+
return (jsx("div", { className: 'malicious-site-view', children: jsx("div", { className: 'popup-content', children: jsxs("div", { className: 'wallet-connection-view', children: [jsxs("div", { className: 'warning-icon-container', style: { position: 'relative' }, children: [maliciousSiteInfo.isDefinitelyMalicious ? (jsx(SvgWarningRed, { className: 'warning-icon' })) : (jsx(SvgWarningOrange, { className: 'warning-icon' })), jsx(SvgExclamation, { className: 'exclamation-icon', style: {
|
|
113
|
+
left: '50%',
|
|
114
|
+
position: 'absolute',
|
|
115
|
+
top: '50%',
|
|
116
|
+
transform: 'translate(-50%, -50%)',
|
|
117
|
+
} })] }), jsx(Typography, { className: 'connection-title', variant: 'title', font: 'bold', color: 'primary', children: maliciousSiteInfo.isDefinitelyMalicious
|
|
118
|
+
? t('global_wallet.malicious_site.certain.title')
|
|
119
|
+
: t('global_wallet.malicious_site.unknown.title') }), jsxs("div", { className: `subtitle-container ${maliciousSiteInfo.isDefinitelyMalicious
|
|
120
|
+
? 'definitely-malicious'
|
|
121
|
+
: 'unknown'}`, children: [jsxs("div", { className: 'subtitle-header-container', children: [maliciousSiteInfo.isDefinitelyMalicious ? (jsx(SvgExclamationCircle, { className: 'caution-icon' })) : (jsx(SvgCautionTriangle, { className: 'caution-icon' })), jsx(Typography, { variant: 'body_normal', className: 'subtitle-header', color: 'primary', children: maliciousSiteInfo.isDefinitelyMalicious
|
|
122
|
+
? t('global_wallet.malicious_site.certain.subtitle_header')
|
|
123
|
+
: t('global_wallet.malicious_site.unknown.subtitle_header') })] }), jsx(Typography, { variant: 'body_normal', className: 'subtitle', color: 'secondary', children: maliciousSiteInfo.isDefinitelyMalicious
|
|
124
|
+
? t('global_wallet.malicious_site.certain.subtitle_text')
|
|
125
|
+
: t('global_wallet.malicious_site.unknown.subtitle_text') })] }), jsx(Typography, { variant: 'body_normal', className: 'site-info', color: 'secondary', children: maliciousSiteInfo.url }), jsxs("div", { className: 'button-group', children: [jsx(TypographyButton, { buttonClassName: 'cancel-button', buttonVariant: 'primary', type: 'submit', buttonPadding: 'large', onClick: handleBack, copykey: 'global_wallet.malicious_site.go_back', children: maliciousSiteInfo.isDefinitelyMalicious
|
|
126
|
+
? t('global_wallet.malicious_site.certain.go_back')
|
|
127
|
+
: t('global_wallet.malicious_site.unknown.go_back') }), jsx(TypographyButton, { buttonClassName: 'proceed-button', buttonVariant: 'secondary', type: 'submit', buttonPadding: 'large', onClick: handleProceed, copykey: 'global_wallet.malicious_site.proceed', typographyProps: {
|
|
128
|
+
color: 'error-1',
|
|
129
|
+
}, children: maliciousSiteInfo.isDefinitelyMalicious
|
|
130
|
+
? t('global_wallet.malicious_site.certain.proceed')
|
|
131
|
+
: t('global_wallet.malicious_site.unknown.proceed') })] })] }) }) }));
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export { GlobalWalletMaliciousView, GlobalWalletMaliciousView as default };
|
|
@@ -99,10 +99,13 @@ var useInternalDynamicContext = require('../../../context/DynamicContext/useDyna
|
|
|
99
99
|
|
|
100
100
|
const useSmsVerification = (type) => {
|
|
101
101
|
const { verificationUUID, displayedDestination: formattedPhone, retryData, } = VerificationContext.useVerification();
|
|
102
|
-
const { environmentId, user, userWithMissingInfo } = useInternalDynamicContext.useInternalDynamicContext();
|
|
102
|
+
const { environmentId, user, userWithMissingInfo, projectSettings } = useInternalDynamicContext.useInternalDynamicContext();
|
|
103
103
|
const [error, setError] = React.useState();
|
|
104
104
|
const { verifyOtp } = useOtpVerificationRequest.useOtpVerificationRequest();
|
|
105
|
-
const { generateSessionKey, shouldRegisterSessionKeysOnSignin } = useEmbeddedWalletSessionKeys.useEmbeddedWalletSessionKeys(
|
|
105
|
+
const { generateSessionKey, shouldRegisterSessionKeysOnSignin } = useEmbeddedWalletSessionKeys.useEmbeddedWalletSessionKeys({
|
|
106
|
+
environmentId,
|
|
107
|
+
projectSettings,
|
|
108
|
+
});
|
|
106
109
|
const { initAuth, completeAuth, cancelAuth } = useUserAuth.useUserAuth({
|
|
107
110
|
authMethod: 'sms',
|
|
108
111
|
});
|
|
@@ -95,10 +95,13 @@ import { useInternalDynamicContext } from '../../../context/DynamicContext/useDy
|
|
|
95
95
|
|
|
96
96
|
const useSmsVerification = (type) => {
|
|
97
97
|
const { verificationUUID, displayedDestination: formattedPhone, retryData, } = useVerification();
|
|
98
|
-
const { environmentId, user, userWithMissingInfo } = useInternalDynamicContext();
|
|
98
|
+
const { environmentId, user, userWithMissingInfo, projectSettings } = useInternalDynamicContext();
|
|
99
99
|
const [error, setError] = useState();
|
|
100
100
|
const { verifyOtp } = useOtpVerificationRequest();
|
|
101
|
-
const { generateSessionKey, shouldRegisterSessionKeysOnSignin } = useEmbeddedWalletSessionKeys(
|
|
101
|
+
const { generateSessionKey, shouldRegisterSessionKeysOnSignin } = useEmbeddedWalletSessionKeys({
|
|
102
|
+
environmentId,
|
|
103
|
+
projectSettings,
|
|
104
|
+
});
|
|
102
105
|
const { initAuth, completeAuth, cancelAuth } = useUserAuth({
|
|
103
106
|
authMethod: 'sms',
|
|
104
107
|
});
|
|
@@ -132,6 +132,7 @@ var MfaSecureDeviceHelpView = require('./MfaSecureDeviceHelpView/MfaSecureDevice
|
|
|
132
132
|
var SandboxMaximumThresholdReached = require('./SandboxMaximumThresholdReached/SandboxMaximumThresholdReached.cjs');
|
|
133
133
|
var GlobalWalletConfirmView = require('./GlobalWalletConfirmView/GlobalWalletConfirmView.cjs');
|
|
134
134
|
var GlobalWalletInfoView = require('./GlobalWalletInfoView/GlobalWalletInfoView.cjs');
|
|
135
|
+
var GlobalWalletMaliciousView = require('./GlobalWalletMaliciousView/GlobalWalletMaliciousView.cjs');
|
|
135
136
|
require('../context/SendBalanceContext/SendBalanceContext.cjs');
|
|
136
137
|
require('../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
|
|
137
138
|
require('../context/ConnectWithOtpContext/constants.cjs');
|
|
@@ -161,6 +162,7 @@ const viewToComponentMap = {
|
|
|
161
162
|
'gate-blocked-wallet': NoAccess.NoAccess,
|
|
162
163
|
'global-wallet-confirm': GlobalWalletConfirmView.GlobalWalletConfirmView,
|
|
163
164
|
'global-wallet-info': GlobalWalletInfoView.GlobalWalletInfoView,
|
|
165
|
+
'global-wallet-malicious': GlobalWalletMaliciousView.GlobalWalletMaliciousView,
|
|
164
166
|
'login-with-email-or-wallet': LoginView.LoginView,
|
|
165
167
|
'login-with-email-or-wallet-full-wallet-list': WalletList.WalletList,
|
|
166
168
|
'login-with-email-verification': EmailVerification.EmailVerification,
|
|
@@ -21,6 +21,7 @@ export declare const viewToComponentMap: {
|
|
|
21
21
|
'gate-blocked-wallet': () => JSX.Element;
|
|
22
22
|
'global-wallet-confirm': import("react").FC<import("./GlobalWalletConfirmView").GlobalWalletConfirmViewProps>;
|
|
23
23
|
'global-wallet-info': () => JSX.Element;
|
|
24
|
+
'global-wallet-malicious': import("react").FC<import("./GlobalWalletMaliciousView/GlobalWalletMaliciousView").GlobalWalletMaliciousViewProps>;
|
|
24
25
|
'login-with-email-or-wallet': () => JSX.Element;
|
|
25
26
|
'login-with-email-or-wallet-full-wallet-list': ({ isWalletConnectList, }: import("./WalletList").WalletListProps) => JSX.Element;
|
|
26
27
|
'login-with-email-verification': import("react").FC<import("./EmailVerification/EmailVerification").EmailVerificationProps>;
|
|
@@ -128,6 +128,7 @@ import { MfaSecureDeviceHelper } from './MfaSecureDeviceHelpView/MfaSecureDevice
|
|
|
128
128
|
import { SandboxMaximumThresholdReached } from './SandboxMaximumThresholdReached/SandboxMaximumThresholdReached.js';
|
|
129
129
|
import { GlobalWalletConfirmView } from './GlobalWalletConfirmView/GlobalWalletConfirmView.js';
|
|
130
130
|
import { GlobalWalletInfoView } from './GlobalWalletInfoView/GlobalWalletInfoView.js';
|
|
131
|
+
import { GlobalWalletMaliciousView } from './GlobalWalletMaliciousView/GlobalWalletMaliciousView.js';
|
|
131
132
|
import '../context/SendBalanceContext/SendBalanceContext.js';
|
|
132
133
|
import '../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
133
134
|
import '../context/ConnectWithOtpContext/constants.js';
|
|
@@ -157,6 +158,7 @@ const viewToComponentMap = {
|
|
|
157
158
|
'gate-blocked-wallet': NoAccess,
|
|
158
159
|
'global-wallet-confirm': GlobalWalletConfirmView,
|
|
159
160
|
'global-wallet-info': GlobalWalletInfoView,
|
|
161
|
+
'global-wallet-malicious': GlobalWalletMaliciousView,
|
|
160
162
|
'login-with-email-or-wallet': LoginView,
|
|
161
163
|
'login-with-email-or-wallet-full-wallet-list': WalletList,
|
|
162
164
|
'login-with-email-verification': EmailVerification,
|
|
@@ -75,6 +75,7 @@ var Input = require('../../../../components/Input/Input.cjs');
|
|
|
75
75
|
require('../../../../views/TransactionConfirmationView/helpers/transactionErrorMessage.cjs');
|
|
76
76
|
require('../../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
77
77
|
require('../ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
78
|
+
var blockaid = require('../../../../data/api/transactions/blockaid.cjs');
|
|
78
79
|
var GlobalWalletScanner = require('./scanner/GlobalWalletScanner.cjs');
|
|
79
80
|
require('../../../../../polyfills.cjs');
|
|
80
81
|
require('../../../../context/DynamicContext/DynamicContext.cjs');
|
|
@@ -107,6 +108,7 @@ const GlobalWalletView = () => {
|
|
|
107
108
|
const { setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
108
109
|
const { primaryWallet } = useDynamicContext.useDynamicContext();
|
|
109
110
|
const [walletConnectUri, setWalletConnectUri] = React.useState('');
|
|
111
|
+
const { environmentId } = useInternalDynamicContext.useInternalDynamicContext();
|
|
110
112
|
const [bannerMessage, setBannerMessage] = React.useState(null);
|
|
111
113
|
const [isScanned, setIsScanned] = React.useState(false);
|
|
112
114
|
const { globalWallet } =
|
|
@@ -123,11 +125,7 @@ const GlobalWalletView = () => {
|
|
|
123
125
|
goToInitialDynamicWidgetView();
|
|
124
126
|
}, timeout);
|
|
125
127
|
}, [goToInitialDynamicWidgetView]);
|
|
126
|
-
const
|
|
127
|
-
const pendingPairing = globalWallet.getPendingPairing();
|
|
128
|
-
if (!pendingPairing)
|
|
129
|
-
throw new Error('No pending pairing');
|
|
130
|
-
const { name, url, icons } = pendingPairing.params.proposer.metadata;
|
|
128
|
+
const handleConfirmView = (pairingInfo) => {
|
|
131
129
|
setView('global-wallet-confirm', {
|
|
132
130
|
onCancel: () => {
|
|
133
131
|
setDynamicWidgetView('global-wallet');
|
|
@@ -138,6 +136,7 @@ const GlobalWalletView = () => {
|
|
|
138
136
|
setWalletConnectUri('');
|
|
139
137
|
},
|
|
140
138
|
onConfirm: () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
139
|
+
var _a, _b;
|
|
141
140
|
try {
|
|
142
141
|
yield globalWallet.confirmPairing(true);
|
|
143
142
|
setDynamicWidgetView('global-wallet');
|
|
@@ -146,22 +145,46 @@ const GlobalWalletView = () => {
|
|
|
146
145
|
performMultiWalletChecks: false,
|
|
147
146
|
});
|
|
148
147
|
showBanner(t('global_wallet.banner.success', {
|
|
149
|
-
name: name !== null &&
|
|
148
|
+
name: (_a = pairingInfo.name) !== null && _a !== void 0 ? _a : t('global_wallet.the_dapp'),
|
|
150
149
|
}), 'success');
|
|
151
150
|
}
|
|
152
151
|
catch (error) {
|
|
153
152
|
showBanner(t('global_wallet.banner.warning', {
|
|
154
|
-
name: name !== null &&
|
|
153
|
+
name: (_b = pairingInfo.name) !== null && _b !== void 0 ? _b : t('global_wallet.the_dapp'),
|
|
155
154
|
}), 'error');
|
|
156
155
|
}
|
|
157
156
|
}),
|
|
158
|
-
pairingInfo
|
|
157
|
+
pairingInfo,
|
|
159
158
|
});
|
|
160
159
|
setShowAuthFlow(true, {
|
|
161
160
|
ignoreIfIsEmbeddedWidget: false,
|
|
162
161
|
performMultiWalletChecks: false,
|
|
163
162
|
});
|
|
164
163
|
};
|
|
164
|
+
const popupConfirmView = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
165
|
+
const pendingPairing = globalWallet.getPendingPairing();
|
|
166
|
+
if (!pendingPairing)
|
|
167
|
+
throw new Error('No pending pairing');
|
|
168
|
+
const { name, url, icons } = pendingPairing.params.proposer.metadata;
|
|
169
|
+
const pairingInfo = { icons, name, url };
|
|
170
|
+
const isDefinitelyMalicious = yield blockaid.isMaliciousUrl({ environmentId, url });
|
|
171
|
+
if (isDefinitelyMalicious || isDefinitelyMalicious === undefined) {
|
|
172
|
+
setView('global-wallet-malicious', {
|
|
173
|
+
maliciousSiteInfo: {
|
|
174
|
+
isDefinitelyMalicious: isDefinitelyMalicious !== null && isDefinitelyMalicious !== void 0 ? isDefinitelyMalicious : false,
|
|
175
|
+
proceedFlow: () => handleConfirmView(pairingInfo),
|
|
176
|
+
url,
|
|
177
|
+
},
|
|
178
|
+
});
|
|
179
|
+
setShowAuthFlow(true, {
|
|
180
|
+
ignoreIfIsEmbeddedWidget: false,
|
|
181
|
+
performMultiWalletChecks: false,
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
handleConfirmView(pairingInfo);
|
|
186
|
+
}
|
|
187
|
+
});
|
|
165
188
|
const handlePairing = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
166
189
|
if (!walletConnectUri.startsWith('wc:')) {
|
|
167
190
|
showBanner(t('global_wallet.banner.bad_input'), 'error');
|
|
@@ -71,6 +71,7 @@ import { Input } from '../../../../components/Input/Input.js';
|
|
|
71
71
|
import '../../../../views/TransactionConfirmationView/helpers/transactionErrorMessage.js';
|
|
72
72
|
import '../../../../context/PasskeyContext/PasskeyContext.js';
|
|
73
73
|
import '../ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
74
|
+
import { isMaliciousUrl } from '../../../../data/api/transactions/blockaid.js';
|
|
74
75
|
import { GlobalWalletScanner } from './scanner/GlobalWalletScanner.js';
|
|
75
76
|
import '../../../../../polyfills.js';
|
|
76
77
|
import '../../../../context/DynamicContext/DynamicContext.js';
|
|
@@ -103,6 +104,7 @@ const GlobalWalletView = () => {
|
|
|
103
104
|
const { setShowAuthFlow } = useInternalDynamicContext();
|
|
104
105
|
const { primaryWallet } = useDynamicContext();
|
|
105
106
|
const [walletConnectUri, setWalletConnectUri] = useState('');
|
|
107
|
+
const { environmentId } = useInternalDynamicContext();
|
|
106
108
|
const [bannerMessage, setBannerMessage] = useState(null);
|
|
107
109
|
const [isScanned, setIsScanned] = useState(false);
|
|
108
110
|
const { globalWallet } =
|
|
@@ -119,11 +121,7 @@ const GlobalWalletView = () => {
|
|
|
119
121
|
goToInitialDynamicWidgetView();
|
|
120
122
|
}, timeout);
|
|
121
123
|
}, [goToInitialDynamicWidgetView]);
|
|
122
|
-
const
|
|
123
|
-
const pendingPairing = globalWallet.getPendingPairing();
|
|
124
|
-
if (!pendingPairing)
|
|
125
|
-
throw new Error('No pending pairing');
|
|
126
|
-
const { name, url, icons } = pendingPairing.params.proposer.metadata;
|
|
124
|
+
const handleConfirmView = (pairingInfo) => {
|
|
127
125
|
setView('global-wallet-confirm', {
|
|
128
126
|
onCancel: () => {
|
|
129
127
|
setDynamicWidgetView('global-wallet');
|
|
@@ -134,6 +132,7 @@ const GlobalWalletView = () => {
|
|
|
134
132
|
setWalletConnectUri('');
|
|
135
133
|
},
|
|
136
134
|
onConfirm: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
135
|
+
var _a, _b;
|
|
137
136
|
try {
|
|
138
137
|
yield globalWallet.confirmPairing(true);
|
|
139
138
|
setDynamicWidgetView('global-wallet');
|
|
@@ -142,22 +141,46 @@ const GlobalWalletView = () => {
|
|
|
142
141
|
performMultiWalletChecks: false,
|
|
143
142
|
});
|
|
144
143
|
showBanner(t('global_wallet.banner.success', {
|
|
145
|
-
name: name !== null &&
|
|
144
|
+
name: (_a = pairingInfo.name) !== null && _a !== void 0 ? _a : t('global_wallet.the_dapp'),
|
|
146
145
|
}), 'success');
|
|
147
146
|
}
|
|
148
147
|
catch (error) {
|
|
149
148
|
showBanner(t('global_wallet.banner.warning', {
|
|
150
|
-
name: name !== null &&
|
|
149
|
+
name: (_b = pairingInfo.name) !== null && _b !== void 0 ? _b : t('global_wallet.the_dapp'),
|
|
151
150
|
}), 'error');
|
|
152
151
|
}
|
|
153
152
|
}),
|
|
154
|
-
pairingInfo
|
|
153
|
+
pairingInfo,
|
|
155
154
|
});
|
|
156
155
|
setShowAuthFlow(true, {
|
|
157
156
|
ignoreIfIsEmbeddedWidget: false,
|
|
158
157
|
performMultiWalletChecks: false,
|
|
159
158
|
});
|
|
160
159
|
};
|
|
160
|
+
const popupConfirmView = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
161
|
+
const pendingPairing = globalWallet.getPendingPairing();
|
|
162
|
+
if (!pendingPairing)
|
|
163
|
+
throw new Error('No pending pairing');
|
|
164
|
+
const { name, url, icons } = pendingPairing.params.proposer.metadata;
|
|
165
|
+
const pairingInfo = { icons, name, url };
|
|
166
|
+
const isDefinitelyMalicious = yield isMaliciousUrl({ environmentId, url });
|
|
167
|
+
if (isDefinitelyMalicious || isDefinitelyMalicious === undefined) {
|
|
168
|
+
setView('global-wallet-malicious', {
|
|
169
|
+
maliciousSiteInfo: {
|
|
170
|
+
isDefinitelyMalicious: isDefinitelyMalicious !== null && isDefinitelyMalicious !== void 0 ? isDefinitelyMalicious : false,
|
|
171
|
+
proceedFlow: () => handleConfirmView(pairingInfo),
|
|
172
|
+
url,
|
|
173
|
+
},
|
|
174
|
+
});
|
|
175
|
+
setShowAuthFlow(true, {
|
|
176
|
+
ignoreIfIsEmbeddedWidget: false,
|
|
177
|
+
performMultiWalletChecks: false,
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
handleConfirmView(pairingInfo);
|
|
182
|
+
}
|
|
183
|
+
});
|
|
161
184
|
const handlePairing = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
162
185
|
if (!walletConnectUri.startsWith('wc:')) {
|
|
163
186
|
showBanner(t('global_wallet.banner.bad_input'), 'error');
|