@dynamic-labs/sdk-react-core 4.20.4 → 4.20.5
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 +14 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +12 -12
- package/src/functions.d.ts +1 -0
- package/src/index.cjs +5 -2
- package/src/index.d.ts +3 -1
- package/src/index.js +3 -2
- package/src/lib/Main.cjs +2 -2
- package/src/lib/Main.js +3 -3
- package/src/lib/components/ModalCard/ModalCard.cjs +3 -1
- package/src/lib/components/ModalCard/ModalCard.d.ts +2 -0
- package/src/lib/components/ModalCard/ModalCard.js +3 -1
- package/src/lib/components/UserWalletsList/UserWalletsList.cjs +2 -2
- package/src/lib/components/UserWalletsList/UserWalletsList.js +3 -3
- package/src/lib/context/DynamicContext/DynamicContext.cjs +3 -0
- package/src/lib/context/DynamicContext/DynamicContext.js +3 -0
- package/src/lib/context/UserWalletsContext/UserWalletsContext.cjs +2 -2
- package/src/lib/context/UserWalletsContext/UserWalletsContext.d.ts +1 -1
- package/src/lib/context/UserWalletsContext/UserWalletsContext.js +2 -2
- package/src/lib/data/api/api.cjs +5 -0
- package/src/lib/data/api/api.js +5 -0
- package/src/lib/layout/DynamicUserProfileLayout/DynamicUserProfileLayout.cjs +1 -0
- package/src/lib/layout/DynamicUserProfileLayout/DynamicUserProfileLayout.js +1 -0
- package/src/lib/locale/en/translation.cjs +15 -0
- package/src/lib/locale/en/translation.d.ts +15 -0
- package/src/lib/locale/en/translation.js +15 -0
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/constants/sessionStorage.cjs +12 -0
- package/src/lib/utils/constants/sessionStorage.d.ts +2 -0
- package/src/lib/utils/constants/sessionStorage.js +7 -0
- package/src/lib/utils/functions/clientSessionKeys/constants.cjs +8 -0
- package/src/lib/utils/functions/clientSessionKeys/constants.d.ts +1 -0
- package/src/lib/utils/functions/clientSessionKeys/constants.js +4 -0
- package/src/lib/utils/functions/clientSessionKeys/getClientSessionKeys.cjs +67 -0
- package/src/lib/utils/functions/clientSessionKeys/getClientSessionKeys.d.ts +17 -0
- package/src/lib/utils/functions/clientSessionKeys/getClientSessionKeys.js +58 -0
- package/src/lib/utils/functions/clientSessionKeys/index.d.ts +1 -0
- package/src/lib/utils/functions/clientSessionKeys/types.d.ts +5 -0
- package/src/lib/utils/functions/index.d.ts +2 -0
- package/src/lib/utils/functions/keyService/index.d.ts +1 -0
- package/src/lib/utils/{hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/utils.cjs → functions/keyService/keyService.cjs} +13 -1
- package/src/lib/utils/{hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/utils.d.ts → functions/keyService/keyService.d.ts} +1 -0
- package/src/lib/utils/{hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/utils.js → functions/keyService/keyService.js} +13 -2
- package/src/lib/utils/functions/usingV3Wallets/index.d.ts +1 -0
- package/src/lib/utils/hooks/index.d.ts +1 -0
- package/src/lib/utils/hooks/useClientSessionKeys/index.d.ts +1 -0
- package/src/lib/utils/hooks/useClientSessionKeys/useClientSessionKeys.cjs +63 -0
- package/src/lib/utils/hooks/useClientSessionKeys/useClientSessionKeys.d.ts +5 -0
- package/src/lib/utils/hooks/useClientSessionKeys/useClientSessionKeys.js +59 -0
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.cjs +4 -0
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.js +4 -0
- package/src/lib/utils/hooks/useDynamicWaas/constants.cjs +2 -0
- package/src/lib/utils/hooks/useDynamicWaas/constants.d.ts +1 -0
- package/src/lib/utils/hooks/useDynamicWaas/constants.js +2 -1
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +51 -36
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.d.ts +1 -1
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +52 -37
- package/src/lib/utils/hooks/useEmbeddedWalletSessionKeys/useEmbeddedWalletSessionKeys.cjs +6 -17
- package/src/lib/utils/hooks/useEmbeddedWalletSessionKeys/useEmbeddedWalletSessionKeys.js +1 -12
- package/src/lib/utils/hooks/useFundWithWallet/useChooseLinkedWallet/useChooseLinkedWallet.cjs +1 -1
- package/src/lib/utils/hooks/useFundWithWallet/useChooseLinkedWallet/useChooseLinkedWallet.js +2 -2
- package/src/lib/utils/hooks/useFundWithWallet/useConnectWalletForFunding/useConnectWalletForFunding.cjs +1 -1
- package/src/lib/utils/hooks/useFundWithWallet/useConnectWalletForFunding/useConnectWalletForFunding.js +2 -2
- package/src/lib/utils/hooks/useIsLoggedIn/useIsLoggedIn.cjs +1 -1
- package/src/lib/utils/hooks/useIsLoggedIn/useIsLoggedIn.js +1 -1
- package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.cjs +3 -1
- package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.js +3 -1
- package/src/lib/utils/hooks/useSwitchWallet/useSwitchWallet.cjs +1 -1
- package/src/lib/utils/hooks/useSwitchWallet/useSwitchWallet.js +2 -2
- package/src/lib/utils/hooks/useSyncDynamicWaas/useSyncDynamicWaas.cjs +0 -5
- package/src/lib/utils/hooks/useSyncDynamicWaas/useSyncDynamicWaas.js +0 -5
- package/src/lib/utils/hooks/useWalletConnectors/utils/smartWallet/smartWallet.cjs +4 -1
- package/src/lib/utils/hooks/useWalletConnectors/utils/smartWallet/smartWallet.js +4 -1
- package/src/lib/utils/hooks/useWalletList/useWalletList.cjs +1 -1
- package/src/lib/utils/hooks/useWalletList/useWalletList.js +2 -2
- package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSimpleSignIn/WalletSimpleSignIn.cjs +1 -1
- package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSimpleSignIn/WalletSimpleSignIn.js +2 -2
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.cjs +2 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.d.ts +13 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.js +2 -0
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.types.d.ts +1 -1
- package/src/lib/widgets/DynamicWidget/views/ConfirmExchangeTransferView/ConfirmExchangeTransferView.cjs +134 -0
- package/src/lib/widgets/DynamicWidget/views/ConfirmExchangeTransferView/ConfirmExchangeTransferView.d.ts +18 -0
- package/src/lib/widgets/DynamicWidget/views/ConfirmExchangeTransferView/ConfirmExchangeTransferView.js +130 -0
- package/src/lib/widgets/DynamicWidget/views/ConfirmExchangeTransferView/index.d.ts +1 -0
|
@@ -29,7 +29,7 @@ import '../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
|
29
29
|
import '../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
30
30
|
import '../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
31
31
|
import '../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
32
|
-
import {
|
|
32
|
+
import { useInternalUserWallets } from '../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
33
33
|
import '../../../store/state/authMode/authMode.js';
|
|
34
34
|
import '../../../context/VerificationContext/VerificationContext.js';
|
|
35
35
|
import 'react-dom';
|
|
@@ -122,7 +122,7 @@ import { useInternalDynamicContext } from '../../../context/DynamicContext/useDy
|
|
|
122
122
|
const useSwitchWallet = () => {
|
|
123
123
|
const { setPrimaryWallet, user, primaryWallet } = useInternalDynamicContext();
|
|
124
124
|
const { getEOAWallet } = useSmartWallets();
|
|
125
|
-
const userWallets =
|
|
125
|
+
const { userWallets } = useInternalUserWallets();
|
|
126
126
|
return useCallback((walletId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
127
127
|
var _a, _b, _c;
|
|
128
128
|
const wallet = userWallets.find((wallet) => wallet.id === walletId);
|
|
@@ -96,7 +96,6 @@ require('../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFu
|
|
|
96
96
|
require('../../../../index.cjs');
|
|
97
97
|
var useDynamicWaas = require('../useDynamicWaas/useDynamicWaas.cjs');
|
|
98
98
|
require('../../../store/state/tokenBalances.cjs');
|
|
99
|
-
var useRefreshUser = require('../useRefreshUser/useRefreshUser.cjs');
|
|
100
99
|
require('../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
101
100
|
var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
102
101
|
|
|
@@ -107,7 +106,6 @@ const useSyncDynamicWaas = () => {
|
|
|
107
106
|
const { user: user$1 } = user.useUser();
|
|
108
107
|
const projectSettings$1 = projectSettings.useProjectSettings();
|
|
109
108
|
const walletConnectorOptions = walletOptions.useWalletConnectorOptions();
|
|
110
|
-
const refresh = useRefreshUser.useRefreshUser();
|
|
111
109
|
const { createWalletAccount, needsAutoCreateWalletChains } = useDynamicWaas.useDynamicWaas();
|
|
112
110
|
const triggeredCreate = React.useRef(false);
|
|
113
111
|
useDynamicEvents.useInternalDynamicEvents('logout', () => {
|
|
@@ -126,8 +124,6 @@ const useSyncDynamicWaas = () => {
|
|
|
126
124
|
}
|
|
127
125
|
catch (error) {
|
|
128
126
|
logger.logger.error('Error creating dynamic waas wallet', error);
|
|
129
|
-
// we need to refresh the user to update the created wallets before running the auto-create flow again
|
|
130
|
-
refresh();
|
|
131
127
|
setShowAuthFlow(true);
|
|
132
128
|
clearStackAndPush('backup-unsuccessful');
|
|
133
129
|
}
|
|
@@ -154,7 +150,6 @@ const useSyncDynamicWaas = () => {
|
|
|
154
150
|
primaryWallet,
|
|
155
151
|
needsAutoCreateWalletChains,
|
|
156
152
|
clearStackAndPush,
|
|
157
|
-
refresh,
|
|
158
153
|
]);
|
|
159
154
|
};
|
|
160
155
|
|
|
@@ -92,7 +92,6 @@ import '../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFun
|
|
|
92
92
|
import '../../../../index.js';
|
|
93
93
|
import { useDynamicWaas } from '../useDynamicWaas/useDynamicWaas.js';
|
|
94
94
|
import '../../../store/state/tokenBalances.js';
|
|
95
|
-
import { useRefreshUser } from '../useRefreshUser/useRefreshUser.js';
|
|
96
95
|
import '../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
97
96
|
import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
98
97
|
|
|
@@ -103,7 +102,6 @@ const useSyncDynamicWaas = () => {
|
|
|
103
102
|
const { user } = useUser();
|
|
104
103
|
const projectSettings = useProjectSettings();
|
|
105
104
|
const walletConnectorOptions = useWalletConnectorOptions();
|
|
106
|
-
const refresh = useRefreshUser();
|
|
107
105
|
const { createWalletAccount, needsAutoCreateWalletChains } = useDynamicWaas();
|
|
108
106
|
const triggeredCreate = useRef(false);
|
|
109
107
|
useInternalDynamicEvents('logout', () => {
|
|
@@ -122,8 +120,6 @@ const useSyncDynamicWaas = () => {
|
|
|
122
120
|
}
|
|
123
121
|
catch (error) {
|
|
124
122
|
logger.error('Error creating dynamic waas wallet', error);
|
|
125
|
-
// we need to refresh the user to update the created wallets before running the auto-create flow again
|
|
126
|
-
refresh();
|
|
127
123
|
setShowAuthFlow(true);
|
|
128
124
|
clearStackAndPush('backup-unsuccessful');
|
|
129
125
|
}
|
|
@@ -150,7 +146,6 @@ const useSyncDynamicWaas = () => {
|
|
|
150
146
|
primaryWallet,
|
|
151
147
|
needsAutoCreateWalletChains,
|
|
152
148
|
clearStackAndPush,
|
|
153
|
-
refresh,
|
|
154
149
|
]);
|
|
155
150
|
};
|
|
156
151
|
|
|
@@ -17,7 +17,10 @@ const initializeSmartWallet = (_a) => _tslib.__awaiter(void 0, [_a], void 0, fun
|
|
|
17
17
|
var _b, _c;
|
|
18
18
|
const smartWallet = findWalletOptionFor.findWalletOptionFor(account, walletConnectorOptions);
|
|
19
19
|
if (!smartWallet) {
|
|
20
|
-
throw new Error(
|
|
20
|
+
throw new Error(`could not find smart wallet from wallet options. Account: ${JSON.stringify(account)}, Wallet options found: ${walletConnectorOptions
|
|
21
|
+
.filter((option) => ['turnkeyhd', 'dynamicwaas', 'zerodev', 'zksync'].includes(option.key))
|
|
22
|
+
.map((option) => option.key)
|
|
23
|
+
.join(', ')}`);
|
|
21
24
|
}
|
|
22
25
|
const connector = smartWallet.walletConnector;
|
|
23
26
|
if (!walletConnectorCore.isAccountAbstractionConnector(connector)) {
|
|
@@ -13,7 +13,10 @@ const initializeSmartWallet = (_a) => __awaiter(void 0, [_a], void 0, function*
|
|
|
13
13
|
var _b, _c;
|
|
14
14
|
const smartWallet = findWalletOptionFor(account, walletConnectorOptions);
|
|
15
15
|
if (!smartWallet) {
|
|
16
|
-
throw new Error(
|
|
16
|
+
throw new Error(`could not find smart wallet from wallet options. Account: ${JSON.stringify(account)}, Wallet options found: ${walletConnectorOptions
|
|
17
|
+
.filter((option) => ['turnkeyhd', 'dynamicwaas', 'zerodev', 'zksync'].includes(option.key))
|
|
18
|
+
.map((option) => option.key)
|
|
19
|
+
.join(', ')}`);
|
|
17
20
|
}
|
|
18
21
|
const connector = smartWallet.walletConnector;
|
|
19
22
|
if (!isAccountAbstractionConnector(connector)) {
|
|
@@ -103,7 +103,7 @@ var useInternalDynamicContext = require('../../../context/DynamicContext/useDyna
|
|
|
103
103
|
|
|
104
104
|
const useWalletList = ({ isWalletConnectList = false, viewWalletsFilter, searchFilter, lastUsedWalletKey, }) => {
|
|
105
105
|
const { walletsFilter, walletConnectorOptions, defaultNumberOfWalletsToShow, bridgeChainsToConnect, multiWallet, recommendedWallets, selectedTabSettings, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
106
|
-
const userWallets = UserWalletsContext.
|
|
106
|
+
const { userWallets } = UserWalletsContext.useInternalUserWallets();
|
|
107
107
|
const walletGroups = walletOptions.useWalletGroups();
|
|
108
108
|
const getFilteredBridgeChains = (bridgeChainsToConnect === null || bridgeChainsToConnect === void 0 ? void 0 : bridgeChainsToConnect.length) &&
|
|
109
109
|
index.FilterBridgeChainsName(bridgeChainsToConnect[0].chain);
|
|
@@ -29,7 +29,7 @@ import '../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
|
29
29
|
import '../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
30
30
|
import '../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
31
31
|
import '../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
32
|
-
import {
|
|
32
|
+
import { useInternalUserWallets } from '../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
33
33
|
import '../../../store/state/authMode/authMode.js';
|
|
34
34
|
import '../../../context/VerificationContext/VerificationContext.js';
|
|
35
35
|
import 'react-dom';
|
|
@@ -99,7 +99,7 @@ import { useInternalDynamicContext } from '../../../context/DynamicContext/useDy
|
|
|
99
99
|
|
|
100
100
|
const useWalletList = ({ isWalletConnectList = false, viewWalletsFilter, searchFilter, lastUsedWalletKey, }) => {
|
|
101
101
|
const { walletsFilter, walletConnectorOptions, defaultNumberOfWalletsToShow, bridgeChainsToConnect, multiWallet, recommendedWallets, selectedTabSettings, } = useInternalDynamicContext();
|
|
102
|
-
const userWallets =
|
|
102
|
+
const { userWallets } = useInternalUserWallets();
|
|
103
103
|
const walletGroups = useWalletGroups();
|
|
104
104
|
const getFilteredBridgeChains = (bridgeChainsToConnect === null || bridgeChainsToConnect === void 0 ? void 0 : bridgeChainsToConnect.length) &&
|
|
105
105
|
FilterBridgeChainsName(bridgeChainsToConnect[0].chain);
|
|
@@ -107,7 +107,7 @@ const WalletSimpleSignIn = ({ previewWalletsNumber, disabled = false, onshowAllW
|
|
|
107
107
|
var _a;
|
|
108
108
|
const { t } = reactI18next.useTranslation();
|
|
109
109
|
const { walletConnectorOptions, projectSettings, walletsFilter, multiWallet, recommendedWallets, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
110
|
-
const userWallets = UserWalletsContext.
|
|
110
|
+
const { userWallets } = UserWalletsContext.useInternalUserWallets();
|
|
111
111
|
const walletGroups = walletOptions.useWalletGroups();
|
|
112
112
|
const { handleWalletItemClick } = useWalletItemActions.useWalletItemActions();
|
|
113
113
|
const { numberOfWallets, walletsList } = walletListBuilder.walletListBuilder({
|
|
@@ -32,7 +32,7 @@ import '../../../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
|
32
32
|
import '../../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
33
33
|
import '../../../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
34
34
|
import '../../../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
35
|
-
import {
|
|
35
|
+
import { useInternalUserWallets } from '../../../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
36
36
|
import '../../../../../store/state/authMode/authMode.js';
|
|
37
37
|
import '../../../../../context/VerificationContext/VerificationContext.js';
|
|
38
38
|
import 'react-dom';
|
|
@@ -103,7 +103,7 @@ const WalletSimpleSignIn = ({ previewWalletsNumber, disabled = false, onshowAllW
|
|
|
103
103
|
var _a;
|
|
104
104
|
const { t } = useTranslation();
|
|
105
105
|
const { walletConnectorOptions, projectSettings, walletsFilter, multiWallet, recommendedWallets, } = useInternalDynamicContext();
|
|
106
|
-
const userWallets =
|
|
106
|
+
const { userWallets } = useInternalUserWallets();
|
|
107
107
|
const walletGroups = useWalletGroups();
|
|
108
108
|
const { handleWalletItemClick } = useWalletItemActions();
|
|
109
109
|
const { numberOfWallets, walletsList } = walletListBuilder({
|
|
@@ -14,6 +14,7 @@ var SessionManagementView = require('../../views/SessionManagementView/SessionMa
|
|
|
14
14
|
var ChooseLinkedWalletView = require('../../views/ChooseLinkedWalletView/ChooseLinkedWalletView.cjs');
|
|
15
15
|
var ChooseOnrampProviderView = require('../../views/ChooseOnrampProviderView/ChooseOnrampProviderView.cjs');
|
|
16
16
|
var ChooseWalletFundingMethod = require('../../views/ChooseWalletFundingMethod/ChooseWalletFundingMethod.cjs');
|
|
17
|
+
var ConfirmExchangeTransferView = require('../../views/ConfirmExchangeTransferView/ConfirmExchangeTransferView.cjs');
|
|
17
18
|
var ConnectedAppsView = require('../../views/ConnectedAppsView/ConnectedAppsView.cjs');
|
|
18
19
|
var DepositView = require('../../views/DepositView/DepositView.cjs');
|
|
19
20
|
var GlobalWalletView = require('../../views/GlobalWalletView/GlobalWalletView.cjs');
|
|
@@ -27,6 +28,7 @@ const mapViewToComponent = {
|
|
|
27
28
|
'choose-linked-wallet': ChooseLinkedWalletView.ChooseLinkedWalletView,
|
|
28
29
|
'choose-onramp-provider': ChooseOnrampProviderView.ChooseOnrampProviderView,
|
|
29
30
|
'choose-wallet-funding-method': ChooseWalletFundingMethod.ChooseWalletFundingMethod,
|
|
31
|
+
'confirm-exchange-transfer': ConfirmExchangeTransferView.ConfirmExchangeTransferView,
|
|
30
32
|
'connected-apps': ConnectedAppsView.ConnectedAppsView,
|
|
31
33
|
'deposit-view': DepositView.DepositView,
|
|
32
34
|
'edit-profile': EditProfileView.EditProfileView,
|
|
@@ -8,6 +8,19 @@ export declare const mapViewToComponent: {
|
|
|
8
8
|
}>;
|
|
9
9
|
'choose-onramp-provider': () => JSX.Element;
|
|
10
10
|
'choose-wallet-funding-method': import("react").FC;
|
|
11
|
+
'confirm-exchange-transfer': import("react").FC<{
|
|
12
|
+
amount?: number | undefined;
|
|
13
|
+
fiatAmount?: number | undefined;
|
|
14
|
+
toAddress?: string | undefined;
|
|
15
|
+
exchange: import("@dynamic-labs/sdk-api-core").ExchangeKeyEnum;
|
|
16
|
+
accountIdentifier?: string | undefined;
|
|
17
|
+
token?: import("../../views/ReceiveWalletFunds/types").FundingTokenData | undefined;
|
|
18
|
+
fee?: number | undefined;
|
|
19
|
+
feeInFiat?: number | undefined;
|
|
20
|
+
fiatCurrencySymbol?: string | undefined;
|
|
21
|
+
onSubmit: () => void;
|
|
22
|
+
onBack: () => void;
|
|
23
|
+
}>;
|
|
11
24
|
'connected-apps': import("react").FC<import("../../views/ConnectedAppsView").ConnectedAppsViewProps>;
|
|
12
25
|
'deposit-view': () => JSX.Element | null;
|
|
13
26
|
'edit-profile': import("react").FC<import("../../views/EditProfileView/EditProfileView").EditProfileViewProps>;
|
|
@@ -10,6 +10,7 @@ import { SessionManagementView } from '../../views/SessionManagementView/Session
|
|
|
10
10
|
import { ChooseLinkedWalletView } from '../../views/ChooseLinkedWalletView/ChooseLinkedWalletView.js';
|
|
11
11
|
import { ChooseOnrampProviderView } from '../../views/ChooseOnrampProviderView/ChooseOnrampProviderView.js';
|
|
12
12
|
import { ChooseWalletFundingMethod } from '../../views/ChooseWalletFundingMethod/ChooseWalletFundingMethod.js';
|
|
13
|
+
import { ConfirmExchangeTransferView } from '../../views/ConfirmExchangeTransferView/ConfirmExchangeTransferView.js';
|
|
13
14
|
import { ConnectedAppsView } from '../../views/ConnectedAppsView/ConnectedAppsView.js';
|
|
14
15
|
import { DepositView } from '../../views/DepositView/DepositView.js';
|
|
15
16
|
import { GlobalWalletView } from '../../views/GlobalWalletView/GlobalWalletView.js';
|
|
@@ -23,6 +24,7 @@ const mapViewToComponent = {
|
|
|
23
24
|
'choose-linked-wallet': ChooseLinkedWalletView,
|
|
24
25
|
'choose-onramp-provider': ChooseOnrampProviderView,
|
|
25
26
|
'choose-wallet-funding-method': ChooseWalletFundingMethod,
|
|
27
|
+
'confirm-exchange-transfer': ConfirmExchangeTransferView,
|
|
26
28
|
'connected-apps': ConnectedAppsView,
|
|
27
29
|
'deposit-view': DepositView,
|
|
28
30
|
'edit-profile': EditProfileView,
|
|
@@ -13,7 +13,7 @@ export declare const DynamicSessionManagementViews: readonly ["session-managemen
|
|
|
13
13
|
export type DynamicSessionManagementViewsType = typeof DynamicSessionManagementViews[number];
|
|
14
14
|
export declare const DynamicTransactionsWidgetViews: readonly ["send-balance"];
|
|
15
15
|
export type DynamicTransactionsWidgetViewsType = typeof DynamicTransactionsWidgetViews[number];
|
|
16
|
-
export type DynamicWidgetViews = 'wallets' | 'profile' | 'edit-profile' | 'choose-wallet-funding-method' | 'receive-wallet-funds' | DynamicTransactionsWidgetViewsType | DynamicPasskeyWidgetViewsType | DynamicMfaWidgetViewsType | DynamicSettingsType | DynamicGlobalWalletType | DynamicSessionManagementViewsType | 'connected-apps' | 'deposit-view' | 'choose-onramp-provider' | 'choose-linked-wallet';
|
|
16
|
+
export type DynamicWidgetViews = 'wallets' | 'profile' | 'edit-profile' | 'choose-wallet-funding-method' | 'receive-wallet-funds' | DynamicTransactionsWidgetViewsType | DynamicPasskeyWidgetViewsType | DynamicMfaWidgetViewsType | DynamicSettingsType | DynamicGlobalWalletType | DynamicSessionManagementViewsType | 'connected-apps' | 'deposit-view' | 'confirm-exchange-transfer' | 'choose-onramp-provider' | 'choose-linked-wallet';
|
|
17
17
|
export type DynamicWidgetViewMapConstraint = Record<DynamicWidgetViews, FC<any>>;
|
|
18
18
|
export type DynamicWidgetViewMap = typeof mapViewToComponent;
|
|
19
19
|
export type SetDynamicWidgetView = <T extends DynamicWidgetViews>(view: T, props?: ComponentProps<DynamicWidgetViewMap[T]>) => void;
|
|
@@ -0,0 +1,134 @@
|
|
|
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/utils');
|
|
9
|
+
require('../../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
10
|
+
require('react');
|
|
11
|
+
var arrowLeft = require('../../../../shared/assets/arrow-left.cjs');
|
|
12
|
+
require('@dynamic-labs/iconic');
|
|
13
|
+
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
14
|
+
require('../../../../../../_virtual/_tslib.cjs');
|
|
15
|
+
require('@dynamic-labs/sdk-api-core');
|
|
16
|
+
require('../../../../shared/logger.cjs');
|
|
17
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
18
|
+
require('@dynamic-labs/wallet-book');
|
|
19
|
+
var shortenWalletAddress = require('../../../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.cjs');
|
|
20
|
+
require('../../../../utils/constants/colors.cjs');
|
|
21
|
+
require('../../../../utils/constants/values.cjs');
|
|
22
|
+
require('../../../../shared/consts/index.cjs');
|
|
23
|
+
require('../../../../components/Alert/Alert.cjs');
|
|
24
|
+
require('../../../../events/dynamicEvents.cjs');
|
|
25
|
+
require('../../../../context/DynamicContext/DynamicContext.cjs');
|
|
26
|
+
require('../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
|
|
27
|
+
require('../../../../store/state/authMode/authMode.cjs');
|
|
28
|
+
require('../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
29
|
+
require('../../../../context/ErrorContext/ErrorContext.cjs');
|
|
30
|
+
require('@dynamic-labs/multi-wallet');
|
|
31
|
+
require('react-international-phone');
|
|
32
|
+
require('../../../../store/state/nonce/nonce.cjs');
|
|
33
|
+
require('../../../../store/state/projectSettings/projectSettings.cjs');
|
|
34
|
+
require('../../../../config/ApiEndpoint.cjs');
|
|
35
|
+
require('../../../../store/state/user/user.cjs');
|
|
36
|
+
require('../../../../locale/locale.cjs');
|
|
37
|
+
require('../../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
38
|
+
require('../../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
39
|
+
require('../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.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('../../../../utils/functions/compareChains/compareChains.cjs');
|
|
46
|
+
require('../../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.cjs');
|
|
47
|
+
require('../../../../context/ThemeContext/ThemeContext.cjs');
|
|
48
|
+
require('../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
49
|
+
require('bs58');
|
|
50
|
+
require('@dynamic-labs/types');
|
|
51
|
+
require('../../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
52
|
+
require('../../../../context/LoadingContext/LoadingContext.cjs');
|
|
53
|
+
require('../../../../context/WalletContext/WalletContext.cjs');
|
|
54
|
+
require('../../../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs');
|
|
55
|
+
require('yup');
|
|
56
|
+
require('../../../../context/MockContext/MockContext.cjs');
|
|
57
|
+
require('../../../../views/CollectUserDataView/useFields.cjs');
|
|
58
|
+
require('../../../../context/FieldsStateContext/FieldsStateContext.cjs');
|
|
59
|
+
require('../../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
60
|
+
require('@dynamic-labs/rpc-providers');
|
|
61
|
+
require('../../../../store/state/walletOptions/walletOptions.cjs');
|
|
62
|
+
var PoweredByDynamic = require('../../../../components/PoweredByDynamic/PoweredByDynamic.cjs');
|
|
63
|
+
require('../../../../context/FooterAnimationContext/index.cjs');
|
|
64
|
+
require('../../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
65
|
+
require('../../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
66
|
+
require('../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
67
|
+
require('../../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
68
|
+
require('../../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
69
|
+
require('../../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
70
|
+
require('../../components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
71
|
+
var ModalCard = require('../../../../components/ModalCard/ModalCard.cjs');
|
|
72
|
+
require('react-focus-lock');
|
|
73
|
+
var Typography = require('../../../../components/Typography/Typography.cjs');
|
|
74
|
+
var Divider = require('../../../../components/Divider/Divider.cjs');
|
|
75
|
+
var DynamicWidgetContext = require('../../context/DynamicWidgetContext.cjs');
|
|
76
|
+
var IconButton = require('../../../../components/IconButton/IconButton.cjs');
|
|
77
|
+
require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
78
|
+
var Image = require('../../../../components/Image/Image.cjs');
|
|
79
|
+
var TypographyButton = require('../../../../components/TypographyButton/TypographyButton.cjs');
|
|
80
|
+
require('formik');
|
|
81
|
+
require('../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.cjs');
|
|
82
|
+
var ModalHeader = require('../../../../components/ModalHeader/ModalHeader.cjs');
|
|
83
|
+
require('../../../../store/state/sendBalances.cjs');
|
|
84
|
+
require('../../../../components/Input/Input.cjs');
|
|
85
|
+
require('../../../../components/OverlayCard/OverlayCard.cjs');
|
|
86
|
+
require('../../../../views/TransactionConfirmationView/TransactionConfirmationView.cjs');
|
|
87
|
+
require('../../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
88
|
+
require('../ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
89
|
+
require('../../../../context/OnrampContext/OnrampContext.cjs');
|
|
90
|
+
require('qrcode');
|
|
91
|
+
require('../ReceiveWalletFunds/ReceiveWalletFunds.cjs');
|
|
92
|
+
require('../../../../../index.cjs');
|
|
93
|
+
require('../../../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
94
|
+
require('../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
|
|
95
|
+
require('../../../DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
96
|
+
require('@hcaptcha/react-hcaptcha');
|
|
97
|
+
require('../../../../context/ErrorContext/hooks/useErrorText/useErrorText.cjs');
|
|
98
|
+
require('../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
99
|
+
require('../../helpers/convertExchangeKeyAndProviderEnum.cjs');
|
|
100
|
+
require('../../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
101
|
+
require('../../../../store/state/tokenBalances.cjs');
|
|
102
|
+
require('../../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
103
|
+
require('../../../../components/InlineWidget/InlineWidget.cjs');
|
|
104
|
+
require('../../../../components/IsBrowser/IsBrowser.cjs');
|
|
105
|
+
require('../../../../components/Popper/Popper/Popper.cjs');
|
|
106
|
+
require('../../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
107
|
+
|
|
108
|
+
const ConfirmExchangeTransferView = ({ amount, toAddress, exchange, token, accountIdentifier, fiatAmount, fee, feeInFiat, fiatCurrencySymbol, onSubmit, onBack, }) => {
|
|
109
|
+
const { t } = reactI18next.useTranslation();
|
|
110
|
+
const { goToInitialDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
|
|
111
|
+
const backButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', id: 'back-button', "data-testid": 'back-button', onClick: () => {
|
|
112
|
+
onBack();
|
|
113
|
+
}, children: jsxRuntime.jsx(arrowLeft.ReactComponent, {}) }));
|
|
114
|
+
return (jsxRuntime.jsxs("div", { className: 'confirm-exchange-transfer', children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: backButton, children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', children: t('dyn_exchange_transfer_confirmation.title') }) }), jsxRuntime.jsxs("div", { className: 'confirm-exchange-transfer__content', children: [jsxRuntime.jsx("div", { className: 'confirm-exchange-transfer__content__modal', children: jsxRuntime.jsxs(ModalCard.ModalCard, { border: false, sharpBorder: true, dropShadow: false, children: [jsxRuntime.jsxs("div", { className: 'confirm-exchange-transfer__content__modal__top', children: [jsxRuntime.jsxs("div", { className: 'confirm-exchange-transfer__content__modal__top__token', children: [(token === null || token === void 0 ? void 0 : token.logoURI) ? (jsxRuntime.jsx(Image.Image, { src: token.logoURI, alt: token.symbol, className: 'confirm-exchange-transfer__content__modal__top__token__icon', dataTestId: 'confirm-exchange-transfer__content__modal__top__token__icon' })) : (jsxRuntime.jsx("div", { className: 'confirm-exchange-transfer__content__modal__top__token__icon--skeleton', "data-testid": 'confirm-exchange-transfer__content__modal__top__token__icon--skeleton' })), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', className: 'confirm-exchange-transfer__content__modal__top__token__name', children: token === null || token === void 0 ? void 0 : token.symbol }), jsxRuntime.jsxs("div", { className: 'confirm-exchange-transfer__content__modal__top__token__balance-container', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'medium', "data-testid": 'confirm-exchange-transfer_token-option__primary', children: t('dyn_exchange_transfer_confirmation.send', {
|
|
115
|
+
fiatCurrency: fiatAmount,
|
|
116
|
+
fiatCurrencySymbol,
|
|
117
|
+
}) }), jsxRuntime.jsx(Typography.Typography, { weight: 'medium', variant: 'body_small', color: 'secondary', "data-testid": 'confirm-exchange-transfer_token-option__secondary', children: `${amount} ${token === null || token === void 0 ? void 0 : token.symbol}` })] })] }), jsxRuntime.jsx(Divider.Divider, {})] }), jsxRuntime.jsxs("div", { className: 'confirm-exchange-transfer__content__modal__transaction', children: [jsxRuntime.jsxs("div", { className: 'confirm-exchange-transfer__content__modal__transaction__from', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'confirm-exchange-transfer__content__modal__transaction__from__title', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__from__title', children: t('dyn_exchange_transfer_confirmation.from') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', className: 'confirm-exchange-transfer__content__modal__transaction__from__exchange', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__from__exchange', children: accountIdentifier
|
|
118
|
+
? `${(exchange === null || exchange === void 0 ? void 0 : exchange.charAt(0).toUpperCase()) + (exchange === null || exchange === void 0 ? void 0 : exchange.slice(1))} ${accountIdentifier}`
|
|
119
|
+
: `${(exchange === null || exchange === void 0 ? void 0 : exchange.charAt(0).toUpperCase()) + (exchange === null || exchange === void 0 ? void 0 : exchange.slice(1))}` })] }), jsxRuntime.jsx(Divider.Divider, {}), jsxRuntime.jsxs("div", { className: 'confirm-exchange-transfer__content__modal__transaction__from', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'confirm-exchange-transfer__content__modal__transaction__from__title', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__from__title', children: t('dyn_exchange_transfer_confirmation.to') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', className: 'confirm-exchange-transfer__content__modal__transaction__from__exchange', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__from__exchange', children: shortenWalletAddress.shortenWalletAddress(toAddress) })] }), jsxRuntime.jsx(Divider.Divider, {}), jsxRuntime.jsxs("div", { className: 'confirm-exchange-transfer__content__modal__transaction__from', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'confirm-exchange-transfer__content__modal__transaction__from__title', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__from__title', children: t('dyn_exchange_transfer_confirmation.fee') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'medium', className: 'confirm-exchange-transfer__content__modal__transaction__from__exchange', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__from__exchange', children: fee
|
|
120
|
+
? `${fiatCurrencySymbol}${feeInFiat} (${fee} ${token === null || token === void 0 ? void 0 : token.symbol})`
|
|
121
|
+
: t('dyn_exchange_transfer_confirmation.fee_not_found') })] }), jsxRuntime.jsx(Divider.Divider, {}), jsxRuntime.jsxs("div", { className: 'confirm-exchange-transfer__content__modal__transaction__receive', children: [jsxRuntime.jsxs("div", { className: 'confirm-exchange-transfer__content__modal__transaction__receive__container', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'bold', color: 'secondary', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__receive__container', children: t('dyn_exchange_transfer_confirmation.receive') }), jsxRuntime.jsx(Typography.Typography, { weight: 'medium', variant: 'body_small', color: 'secondary', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__receive__container__fees', children: fee
|
|
122
|
+
? t('dyn_exchange_transfer_confirmation.cost')
|
|
123
|
+
: t('dyn_exchange_transfer_confirmation.cost_no_fee') })] }), jsxRuntime.jsxs("div", { className: 'confirm-exchange-transfer__content__modal__transaction__receive__amount-container', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'bold', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__receive__container', children: fee && fiatAmount && feeInFiat
|
|
124
|
+
? `${fiatCurrencySymbol}${fiatAmount - feeInFiat}`
|
|
125
|
+
: `${fiatCurrencySymbol}${fiatAmount}` }), jsxRuntime.jsx(Typography.Typography, { weight: 'medium', variant: 'body_small', color: 'secondary', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__receive__container__fees', children: fee && amount
|
|
126
|
+
? `${amount - fee} ${token === null || token === void 0 ? void 0 : token.symbol}`
|
|
127
|
+
: `${amount} ${token === null || token === void 0 ? void 0 : token.symbol}` })] })] })] })] }) }), jsxRuntime.jsx("div", { className: 'confirm-exchange-transfer__content__terms', children: jsxRuntime.jsx(ModalCard.ModalCard, { border: false, sharpBorder: true, dropShadow: false, children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', weight: 'regular', className: 'confirm-exchange-transfer__content__modal__transaction__from__exchange', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__from__exchange', children: t('dyn_exchange_transfer_confirmation.terms') }) }) }), jsxRuntime.jsxs("div", { className: 'confirm-exchange-transfer__content__buttons', children: [jsxRuntime.jsx("div", { className: 'confirm-exchange-transfer__content__buttons__button', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'cancel-button', buttonVariant: 'card', typographyProps: { weight: 'bold' }, className: 'confirm-exchange-transfer__content__buttons__button', onClick: () => {
|
|
128
|
+
goToInitialDynamicWidgetView();
|
|
129
|
+
}, children: t('dyn_exchange_transfer_confirmation.cancel') }) }), jsxRuntime.jsx("div", { className: 'confirm-exchange-transfer__content__buttons__button', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'confirm-button', buttonVariant: 'brand-primary', typographyProps: { color: 'white', weight: 'bold' }, className: 'confirm-exchange-transfer__content__buttons__button', onClick: () => {
|
|
130
|
+
onSubmit();
|
|
131
|
+
}, children: t('dyn_exchange_transfer_confirmation.confirm') }) })] })] }), jsxRuntime.jsx("div", { className: 'confirm-exchange-transfer__content__footer', children: jsxRuntime.jsx(PoweredByDynamic.PoweredByDynamic, { asFooter: true }) })] }));
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
exports.ConfirmExchangeTransferView = ConfirmExchangeTransferView;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { ExchangeKeyEnum } from '@dynamic-labs/sdk-api-core';
|
|
3
|
+
import { FundingTokenData } from '../ReceiveWalletFunds/types';
|
|
4
|
+
type ConfirmExchangeTransferViewProps = {
|
|
5
|
+
amount?: number;
|
|
6
|
+
fiatAmount?: number;
|
|
7
|
+
toAddress?: string;
|
|
8
|
+
exchange: ExchangeKeyEnum;
|
|
9
|
+
accountIdentifier?: string;
|
|
10
|
+
token?: FundingTokenData;
|
|
11
|
+
fee?: number;
|
|
12
|
+
feeInFiat?: number;
|
|
13
|
+
fiatCurrencySymbol?: string;
|
|
14
|
+
onSubmit: () => void;
|
|
15
|
+
onBack: () => void;
|
|
16
|
+
};
|
|
17
|
+
export declare const ConfirmExchangeTransferView: FC<ConfirmExchangeTransferViewProps>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import '@dynamic-labs/utils';
|
|
5
|
+
import '../../../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
6
|
+
import 'react';
|
|
7
|
+
import { ReactComponent as SvgArrowLeft } from '../../../../shared/assets/arrow-left.js';
|
|
8
|
+
import '@dynamic-labs/iconic';
|
|
9
|
+
import '../../../../context/ViewContext/ViewContext.js';
|
|
10
|
+
import '../../../../../../_virtual/_tslib.js';
|
|
11
|
+
import '@dynamic-labs/sdk-api-core';
|
|
12
|
+
import '../../../../shared/logger.js';
|
|
13
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
14
|
+
import '@dynamic-labs/wallet-book';
|
|
15
|
+
import { shortenWalletAddress } from '../../../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.js';
|
|
16
|
+
import '../../../../utils/constants/colors.js';
|
|
17
|
+
import '../../../../utils/constants/values.js';
|
|
18
|
+
import '../../../../shared/consts/index.js';
|
|
19
|
+
import '../../../../components/Alert/Alert.js';
|
|
20
|
+
import '../../../../events/dynamicEvents.js';
|
|
21
|
+
import '../../../../context/DynamicContext/DynamicContext.js';
|
|
22
|
+
import '../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
23
|
+
import '../../../../store/state/authMode/authMode.js';
|
|
24
|
+
import '../../../../context/CaptchaContext/CaptchaContext.js';
|
|
25
|
+
import '../../../../context/ErrorContext/ErrorContext.js';
|
|
26
|
+
import '@dynamic-labs/multi-wallet';
|
|
27
|
+
import 'react-international-phone';
|
|
28
|
+
import '../../../../store/state/nonce/nonce.js';
|
|
29
|
+
import '../../../../store/state/projectSettings/projectSettings.js';
|
|
30
|
+
import '../../../../config/ApiEndpoint.js';
|
|
31
|
+
import '../../../../store/state/user/user.js';
|
|
32
|
+
import '../../../../locale/locale.js';
|
|
33
|
+
import '../../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
34
|
+
import '../../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
35
|
+
import '../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.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 '../../../../utils/functions/compareChains/compareChains.js';
|
|
42
|
+
import '../../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.js';
|
|
43
|
+
import '../../../../context/ThemeContext/ThemeContext.js';
|
|
44
|
+
import '../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
45
|
+
import 'bs58';
|
|
46
|
+
import '@dynamic-labs/types';
|
|
47
|
+
import '../../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
48
|
+
import '../../../../context/LoadingContext/LoadingContext.js';
|
|
49
|
+
import '../../../../context/WalletContext/WalletContext.js';
|
|
50
|
+
import '../../../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
|
|
51
|
+
import 'yup';
|
|
52
|
+
import '../../../../context/MockContext/MockContext.js';
|
|
53
|
+
import '../../../../views/CollectUserDataView/useFields.js';
|
|
54
|
+
import '../../../../context/FieldsStateContext/FieldsStateContext.js';
|
|
55
|
+
import '../../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
56
|
+
import '@dynamic-labs/rpc-providers';
|
|
57
|
+
import '../../../../store/state/walletOptions/walletOptions.js';
|
|
58
|
+
import { PoweredByDynamic } from '../../../../components/PoweredByDynamic/PoweredByDynamic.js';
|
|
59
|
+
import '../../../../context/FooterAnimationContext/index.js';
|
|
60
|
+
import '../../../../components/ShadowDOM/ShadowDOM.js';
|
|
61
|
+
import '../../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
62
|
+
import '../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
63
|
+
import '../../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
64
|
+
import '../../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
|
|
65
|
+
import '../../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
66
|
+
import '../../components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
67
|
+
import { ModalCard } from '../../../../components/ModalCard/ModalCard.js';
|
|
68
|
+
import 'react-focus-lock';
|
|
69
|
+
import { Typography } from '../../../../components/Typography/Typography.js';
|
|
70
|
+
import { Divider } from '../../../../components/Divider/Divider.js';
|
|
71
|
+
import { useWidgetContext } from '../../context/DynamicWidgetContext.js';
|
|
72
|
+
import { IconButton } from '../../../../components/IconButton/IconButton.js';
|
|
73
|
+
import '../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
74
|
+
import { Image } from '../../../../components/Image/Image.js';
|
|
75
|
+
import { TypographyButton } from '../../../../components/TypographyButton/TypographyButton.js';
|
|
76
|
+
import 'formik';
|
|
77
|
+
import '../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.js';
|
|
78
|
+
import { ModalHeader } from '../../../../components/ModalHeader/ModalHeader.js';
|
|
79
|
+
import '../../../../store/state/sendBalances.js';
|
|
80
|
+
import '../../../../components/Input/Input.js';
|
|
81
|
+
import '../../../../components/OverlayCard/OverlayCard.js';
|
|
82
|
+
import '../../../../views/TransactionConfirmationView/TransactionConfirmationView.js';
|
|
83
|
+
import '../../../../context/PasskeyContext/PasskeyContext.js';
|
|
84
|
+
import '../ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
85
|
+
import '../../../../context/OnrampContext/OnrampContext.js';
|
|
86
|
+
import 'qrcode';
|
|
87
|
+
import '../ReceiveWalletFunds/ReceiveWalletFunds.js';
|
|
88
|
+
import '../../../../../index.js';
|
|
89
|
+
import '../../../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
90
|
+
import '../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
91
|
+
import '../../../DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
92
|
+
import '@hcaptcha/react-hcaptcha';
|
|
93
|
+
import '../../../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
|
|
94
|
+
import '../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
95
|
+
import '../../helpers/convertExchangeKeyAndProviderEnum.js';
|
|
96
|
+
import '../../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
97
|
+
import '../../../../store/state/tokenBalances.js';
|
|
98
|
+
import '../../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
99
|
+
import '../../../../components/InlineWidget/InlineWidget.js';
|
|
100
|
+
import '../../../../components/IsBrowser/IsBrowser.js';
|
|
101
|
+
import '../../../../components/Popper/Popper/Popper.js';
|
|
102
|
+
import '../../../../components/Popper/PopperContext/PopperContext.js';
|
|
103
|
+
|
|
104
|
+
const ConfirmExchangeTransferView = ({ amount, toAddress, exchange, token, accountIdentifier, fiatAmount, fee, feeInFiat, fiatCurrencySymbol, onSubmit, onBack, }) => {
|
|
105
|
+
const { t } = useTranslation();
|
|
106
|
+
const { goToInitialDynamicWidgetView } = useWidgetContext();
|
|
107
|
+
const backButton = (jsx(IconButton, { type: 'button', id: 'back-button', "data-testid": 'back-button', onClick: () => {
|
|
108
|
+
onBack();
|
|
109
|
+
}, children: jsx(SvgArrowLeft, {}) }));
|
|
110
|
+
return (jsxs("div", { className: 'confirm-exchange-transfer', children: [jsx(ModalHeader, { leading: backButton, children: jsx(Typography, { variant: 'title', children: t('dyn_exchange_transfer_confirmation.title') }) }), jsxs("div", { className: 'confirm-exchange-transfer__content', children: [jsx("div", { className: 'confirm-exchange-transfer__content__modal', children: jsxs(ModalCard, { border: false, sharpBorder: true, dropShadow: false, children: [jsxs("div", { className: 'confirm-exchange-transfer__content__modal__top', children: [jsxs("div", { className: 'confirm-exchange-transfer__content__modal__top__token', children: [(token === null || token === void 0 ? void 0 : token.logoURI) ? (jsx(Image, { src: token.logoURI, alt: token.symbol, className: 'confirm-exchange-transfer__content__modal__top__token__icon', dataTestId: 'confirm-exchange-transfer__content__modal__top__token__icon' })) : (jsx("div", { className: 'confirm-exchange-transfer__content__modal__top__token__icon--skeleton', "data-testid": 'confirm-exchange-transfer__content__modal__top__token__icon--skeleton' })), jsx(Typography, { variant: 'body_normal', className: 'confirm-exchange-transfer__content__modal__top__token__name', children: token === null || token === void 0 ? void 0 : token.symbol }), jsxs("div", { className: 'confirm-exchange-transfer__content__modal__top__token__balance-container', children: [jsx(Typography, { variant: 'body_normal', weight: 'medium', "data-testid": 'confirm-exchange-transfer_token-option__primary', children: t('dyn_exchange_transfer_confirmation.send', {
|
|
111
|
+
fiatCurrency: fiatAmount,
|
|
112
|
+
fiatCurrencySymbol,
|
|
113
|
+
}) }), jsx(Typography, { weight: 'medium', variant: 'body_small', color: 'secondary', "data-testid": 'confirm-exchange-transfer_token-option__secondary', children: `${amount} ${token === null || token === void 0 ? void 0 : token.symbol}` })] })] }), jsx(Divider, {})] }), jsxs("div", { className: 'confirm-exchange-transfer__content__modal__transaction', children: [jsxs("div", { className: 'confirm-exchange-transfer__content__modal__transaction__from', children: [jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'confirm-exchange-transfer__content__modal__transaction__from__title', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__from__title', children: t('dyn_exchange_transfer_confirmation.from') }), jsx(Typography, { variant: 'body_normal', weight: 'regular', className: 'confirm-exchange-transfer__content__modal__transaction__from__exchange', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__from__exchange', children: accountIdentifier
|
|
114
|
+
? `${(exchange === null || exchange === void 0 ? void 0 : exchange.charAt(0).toUpperCase()) + (exchange === null || exchange === void 0 ? void 0 : exchange.slice(1))} ${accountIdentifier}`
|
|
115
|
+
: `${(exchange === null || exchange === void 0 ? void 0 : exchange.charAt(0).toUpperCase()) + (exchange === null || exchange === void 0 ? void 0 : exchange.slice(1))}` })] }), jsx(Divider, {}), jsxs("div", { className: 'confirm-exchange-transfer__content__modal__transaction__from', children: [jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'confirm-exchange-transfer__content__modal__transaction__from__title', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__from__title', children: t('dyn_exchange_transfer_confirmation.to') }), jsx(Typography, { variant: 'body_normal', weight: 'regular', className: 'confirm-exchange-transfer__content__modal__transaction__from__exchange', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__from__exchange', children: shortenWalletAddress(toAddress) })] }), jsx(Divider, {}), jsxs("div", { className: 'confirm-exchange-transfer__content__modal__transaction__from', children: [jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'confirm-exchange-transfer__content__modal__transaction__from__title', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__from__title', children: t('dyn_exchange_transfer_confirmation.fee') }), jsx(Typography, { variant: 'body_normal', weight: 'medium', className: 'confirm-exchange-transfer__content__modal__transaction__from__exchange', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__from__exchange', children: fee
|
|
116
|
+
? `${fiatCurrencySymbol}${feeInFiat} (${fee} ${token === null || token === void 0 ? void 0 : token.symbol})`
|
|
117
|
+
: t('dyn_exchange_transfer_confirmation.fee_not_found') })] }), jsx(Divider, {}), jsxs("div", { className: 'confirm-exchange-transfer__content__modal__transaction__receive', children: [jsxs("div", { className: 'confirm-exchange-transfer__content__modal__transaction__receive__container', children: [jsx(Typography, { variant: 'body_normal', weight: 'bold', color: 'secondary', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__receive__container', children: t('dyn_exchange_transfer_confirmation.receive') }), jsx(Typography, { weight: 'medium', variant: 'body_small', color: 'secondary', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__receive__container__fees', children: fee
|
|
118
|
+
? t('dyn_exchange_transfer_confirmation.cost')
|
|
119
|
+
: t('dyn_exchange_transfer_confirmation.cost_no_fee') })] }), jsxs("div", { className: 'confirm-exchange-transfer__content__modal__transaction__receive__amount-container', children: [jsx(Typography, { variant: 'body_normal', weight: 'bold', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__receive__container', children: fee && fiatAmount && feeInFiat
|
|
120
|
+
? `${fiatCurrencySymbol}${fiatAmount - feeInFiat}`
|
|
121
|
+
: `${fiatCurrencySymbol}${fiatAmount}` }), jsx(Typography, { weight: 'medium', variant: 'body_small', color: 'secondary', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__receive__container__fees', children: fee && amount
|
|
122
|
+
? `${amount - fee} ${token === null || token === void 0 ? void 0 : token.symbol}`
|
|
123
|
+
: `${amount} ${token === null || token === void 0 ? void 0 : token.symbol}` })] })] })] })] }) }), jsx("div", { className: 'confirm-exchange-transfer__content__terms', children: jsx(ModalCard, { border: false, sharpBorder: true, dropShadow: false, children: jsx(Typography, { variant: 'body_small', weight: 'regular', className: 'confirm-exchange-transfer__content__modal__transaction__from__exchange', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__from__exchange', children: t('dyn_exchange_transfer_confirmation.terms') }) }) }), jsxs("div", { className: 'confirm-exchange-transfer__content__buttons', children: [jsx("div", { className: 'confirm-exchange-transfer__content__buttons__button', children: jsx(TypographyButton, { dataTestId: 'cancel-button', buttonVariant: 'card', typographyProps: { weight: 'bold' }, className: 'confirm-exchange-transfer__content__buttons__button', onClick: () => {
|
|
124
|
+
goToInitialDynamicWidgetView();
|
|
125
|
+
}, children: t('dyn_exchange_transfer_confirmation.cancel') }) }), jsx("div", { className: 'confirm-exchange-transfer__content__buttons__button', children: jsx(TypographyButton, { dataTestId: 'confirm-button', buttonVariant: 'brand-primary', typographyProps: { color: 'white', weight: 'bold' }, className: 'confirm-exchange-transfer__content__buttons__button', onClick: () => {
|
|
126
|
+
onSubmit();
|
|
127
|
+
}, children: t('dyn_exchange_transfer_confirmation.confirm') }) })] })] }), jsx("div", { className: 'confirm-exchange-transfer__content__footer', children: jsx(PoweredByDynamic, { asFooter: true }) })] }));
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export { ConfirmExchangeTransferView };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ConfirmExchangeTransferView } from './ConfirmExchangeTransferView';
|