@dynamic-labs/sdk-react-core 4.47.2 → 4.48.0
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 +17 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +13 -13
- package/src/lib/client/extension/deprecated/mfa/verifyTotpMfaDevice/verifyTotpMfaDevice.d.ts +1 -1
- package/src/lib/client/extension/hooks/useInitializeSdkClient/useInitializeSdkClient.cjs +6 -5
- package/src/lib/client/extension/hooks/useInitializeSdkClient/useInitializeSdkClient.js +6 -5
- package/src/lib/components/EmbeddedWalletExport/EmbeddedWalletExport.js +1 -1
- package/src/lib/components/index.d.ts +1 -1
- package/src/lib/context/ViewContext/types/index.d.ts +1 -1
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/constants/authViewLayoutChecks.cjs +1 -0
- package/src/lib/utils/constants/authViewLayoutChecks.js +1 -0
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +13 -9
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.d.ts +2 -1
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +13 -9
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.cjs +1 -1
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.js +1 -1
- package/src/lib/utils/hooks/useSyncDynamicWaas/useSyncDynamicWaas.cjs +1 -1
- package/src/lib/utils/hooks/useSyncDynamicWaas/useSyncDynamicWaas.js +1 -1
- package/src/lib/utils/hooks/useSyncMfaFlow/useSyncMfaFlow.cjs +9 -1
- package/src/lib/utils/hooks/useSyncMfaFlow/useSyncMfaFlow.js +9 -1
- package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.cjs +1 -1
- package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.js +1 -1
- package/src/lib/views/EmailVerification/EmailVerification.cjs +1 -1
- package/src/lib/views/EmailVerification/EmailVerification.js +1 -1
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.cjs +59 -58
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.js +60 -59
- package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.cjs +1 -1
- package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.js +1 -1
- package/src/lib/views/ExportSharesView/ExportSharesView.cjs +206 -0
- package/src/lib/views/ExportSharesView/ExportSharesView.d.ts +5 -0
- package/src/lib/views/ExportSharesView/ExportSharesView.js +202 -0
- package/src/lib/views/ExportSharesView/index.d.ts +2 -0
- package/src/lib/views/MfaVerificationView/MfaVerificationView.cjs +8 -6
- package/src/lib/views/MfaVerificationView/MfaVerificationView.js +8 -6
- package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.cjs +2 -2
- package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.js +2 -2
- package/src/lib/views/WalletUpgradeFlowView/WalletUpgradeFlowView.cjs +1 -1
- package/src/lib/views/WalletUpgradeFlowView/WalletUpgradeFlowView.js +1 -1
- package/src/lib/views/viewToComponentMap.cjs +5 -3
- package/src/lib/views/viewToComponentMap.d.ts +1 -0
- package/src/lib/views/viewToComponentMap.js +5 -3
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.cjs +4 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.js +4 -0
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.types.d.ts +1 -1
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/EmbeddedWalletExportSection/EmbeddedWalletExportSection.cjs +16 -7
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/EmbeddedWalletExportSection/EmbeddedWalletExportSection.js +16 -7
- package/src/lib/widgets/DynamicWidget/views/ExportAndRecoveryView/ExportAndRecoveryView.cjs +183 -0
- package/src/lib/widgets/DynamicWidget/views/ExportAndRecoveryView/ExportAndRecoveryView.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/views/ExportAndRecoveryView/ExportAndRecoveryView.js +179 -0
- package/src/lib/widgets/DynamicWidget/views/ExportAndRecoveryView/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/views/ExportSharesPasscodeView/ExportSharesPasscodeView.cjs +146 -0
- package/src/lib/widgets/DynamicWidget/views/ExportSharesPasscodeView/ExportSharesPasscodeView.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/views/ExportSharesPasscodeView/ExportSharesPasscodeView.js +142 -0
- package/src/lib/widgets/DynamicWidget/views/ExportSharesPasscodeView/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupView.cjs +10 -5
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupView.js +10 -5
|
@@ -97,10 +97,10 @@ require('../../../context/FooterAnimationContext/index.cjs');
|
|
|
97
97
|
require('../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.cjs');
|
|
98
98
|
require('../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
99
99
|
require('../../../context/OnrampContext/OnrampContext.cjs');
|
|
100
|
+
var useRefreshUser = require('../useRefreshUser/useRefreshUser.cjs');
|
|
100
101
|
var apiUrl = require('../../constants/waas/apiUrl.cjs');
|
|
101
102
|
var useClientSessionKeys = require('../useClientSessionKeys/useClientSessionKeys.cjs');
|
|
102
103
|
var useGetMfaToken = require('../useGetMfaToken/useGetMfaToken.cjs');
|
|
103
|
-
var useRefreshUser = require('../useRefreshUser/useRefreshUser.cjs');
|
|
104
104
|
var constants = require('./constants.cjs');
|
|
105
105
|
require('../../../store/state/sendBalances.cjs');
|
|
106
106
|
require('../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
@@ -117,7 +117,7 @@ require('../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
|
117
117
|
var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
118
118
|
|
|
119
119
|
const dynamicWaasKey = 'dynamicwaas';
|
|
120
|
-
const configWaasWalletConnector = ({ walletConnector, environmentId, apiBaseUrl, relayUrl, authMode = 'header', getSignedSessionId, getMfaToken, }) => {
|
|
120
|
+
const configWaasWalletConnector = ({ walletConnector, environmentId, apiBaseUrl, relayUrl, baseClientKeysharesRelayApiUrl, authMode = 'header', getSignedSessionId, getMfaToken, }) => {
|
|
121
121
|
var _a;
|
|
122
122
|
walletConnector.setEnvironmentId(environmentId);
|
|
123
123
|
walletConnector.setBaseApiUrl((_a = (apiBaseUrl || apiUrl.DEFAULT_WAAS_API_URL)) === null || _a === void 0 ? void 0 : _a.replace('/api/v0', ''));
|
|
@@ -132,10 +132,11 @@ const configWaasWalletConnector = ({ walletConnector, environmentId, apiBaseUrl,
|
|
|
132
132
|
walletConnector.setGetSignedSessionIdFunction(getSignedSessionId);
|
|
133
133
|
walletConnector.setRelayUrl(relayUrl);
|
|
134
134
|
walletConnector.setGetMfaTokenFunction(getMfaToken);
|
|
135
|
+
walletConnector.setBaseClientKeysharesRelayApiUrl(baseClientKeysharesRelayApiUrl);
|
|
135
136
|
return walletConnector;
|
|
136
137
|
};
|
|
137
138
|
const useDynamicWaas = () => {
|
|
138
|
-
var _a, _b, _c, _d;
|
|
139
|
+
var _a, _b, _c, _d, _e, _f;
|
|
139
140
|
const { setShowAuthFlow, primaryWallet } = useInternalDynamicContext.useInternalDynamicContext();
|
|
140
141
|
const { addedWalletsIds, userWallets } = UserWalletsContext.useInternalUserWallets();
|
|
141
142
|
const user = useUser.useUser();
|
|
@@ -145,8 +146,9 @@ const useDynamicWaas = () => {
|
|
|
145
146
|
const walletConnectorOptions = walletOptions.useWalletConnectorOptions();
|
|
146
147
|
const refresh = useRefreshUser.useRefreshUser();
|
|
147
148
|
const relayUrl = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.waas) === null || _b === void 0 ? void 0 : _b.relayUrl;
|
|
149
|
+
const baseClientKeysharesRelayApiUrl = (_d = (_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _c === void 0 ? void 0 : _c.waas) === null || _d === void 0 ? void 0 : _d.customKeyshareRelayBaseUrl;
|
|
148
150
|
const embeddedWalletSettings = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets;
|
|
149
|
-
const enabledChains = (
|
|
151
|
+
const enabledChains = (_e = embeddedWalletSettings === null || embeddedWalletSettings === void 0 ? void 0 : embeddedWalletSettings.chainConfigurations) === null || _e === void 0 ? void 0 : _e.filter((c) => c.enabled);
|
|
150
152
|
const primaryChain = enabledChains === null || enabledChains === void 0 ? void 0 : enabledChains.find((chain) => chain.primary);
|
|
151
153
|
const enabledChainNames = enabledChains === null || enabledChains === void 0 ? void 0 : enabledChains.map((chain) => chain.name);
|
|
152
154
|
const automaticEmbeddedWalletCreationEnabled = embeddedWalletSettings === null || embeddedWalletSettings === void 0 ? void 0 : embeddedWalletSettings.automaticEmbeddedWalletCreation;
|
|
@@ -173,6 +175,7 @@ const useDynamicWaas = () => {
|
|
|
173
175
|
const configuredWalletConnector = configWaasWalletConnector({
|
|
174
176
|
apiBaseUrl: apiBaseUrl || apiUrl.DEFAULT_WAAS_API_URL,
|
|
175
177
|
authMode: isCookieAuthEnabled ? 'cookie' : 'header',
|
|
178
|
+
baseClientKeysharesRelayApiUrl,
|
|
176
179
|
environmentId,
|
|
177
180
|
getMfaToken,
|
|
178
181
|
getSignedSessionId,
|
|
@@ -189,6 +192,7 @@ const useDynamicWaas = () => {
|
|
|
189
192
|
getMfaToken,
|
|
190
193
|
getSignedSessionId,
|
|
191
194
|
relayUrl,
|
|
195
|
+
baseClientKeysharesRelayApiUrl,
|
|
192
196
|
]);
|
|
193
197
|
const shouldInitializeWaas = React.useMemo(() => {
|
|
194
198
|
var _a;
|
|
@@ -204,7 +208,7 @@ const useDynamicWaas = () => {
|
|
|
204
208
|
}, [
|
|
205
209
|
user === null || user === void 0 ? void 0 : user.id,
|
|
206
210
|
user === null || user === void 0 ? void 0 : user.sessionId,
|
|
207
|
-
(
|
|
211
|
+
(_f = user === null || user === void 0 ? void 0 : user.verifiedCredentials) === null || _f === void 0 ? void 0 : _f.length,
|
|
208
212
|
dynamicWaasIsEnabled,
|
|
209
213
|
enabledChainNames === null || enabledChainNames === void 0 ? void 0 : enabledChainNames.length,
|
|
210
214
|
walletConnectorOptions.length,
|
|
@@ -430,7 +434,7 @@ const useDynamicWaas = () => {
|
|
|
430
434
|
automaticEmbeddedWalletCreationForExternalEnabled,
|
|
431
435
|
enabledChainNames,
|
|
432
436
|
]);
|
|
433
|
-
const importPrivateKey = (
|
|
437
|
+
const importPrivateKey = (_g) => _tslib.__awaiter(void 0, [_g], void 0, function* ({ chainName, privateKey, }) {
|
|
434
438
|
const walletConnector = getWaasWalletConnector(chainName);
|
|
435
439
|
if (!walletConnector)
|
|
436
440
|
return;
|
|
@@ -440,7 +444,7 @@ const useDynamicWaas = () => {
|
|
|
440
444
|
});
|
|
441
445
|
yield refresh();
|
|
442
446
|
});
|
|
443
|
-
const upgradeToDynamicWaas = React.useCallback((
|
|
447
|
+
const upgradeToDynamicWaas = React.useCallback((_h) => _tslib.__awaiter(void 0, [_h], void 0, function* ({ privateKey, wallet, }) {
|
|
444
448
|
isUpgrading.current = true;
|
|
445
449
|
if (!primaryWallet) {
|
|
446
450
|
throw new utils.DynamicError('Primary wallet not found');
|
|
@@ -489,14 +493,14 @@ const useDynamicWaas = () => {
|
|
|
489
493
|
}), [environmentId, getWaasWalletConnector, primaryWallet, refresh]);
|
|
490
494
|
const getWaasWallets = React.useCallback(() => userWallets.filter((w) => w.key === 'dynamicwaas'), [userWallets]);
|
|
491
495
|
const processSignOnWalletSettings = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
492
|
-
var
|
|
496
|
+
var _j;
|
|
493
497
|
if (!(user === null || user === void 0 ? void 0 : user.verifiedCredentials)) {
|
|
494
498
|
return;
|
|
495
499
|
}
|
|
496
500
|
const waasWallets = user.verifiedCredentials.filter((vc) => { var _a; return vc.walletName === 'dynamicwaas' && ((_a = vc.walletProperties) === null || _a === void 0 ? void 0 : _a.settings); });
|
|
497
501
|
for (const wallet of waasWallets) {
|
|
498
502
|
try {
|
|
499
|
-
const settings = (
|
|
503
|
+
const settings = (_j = wallet.walletProperties) === null || _j === void 0 ? void 0 : _j.settings;
|
|
500
504
|
const { address, chain } = wallet;
|
|
501
505
|
if (!settings || !address || !chain) {
|
|
502
506
|
continue;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ChainEnum, MFAAction } from '@dynamic-labs/sdk-api-core';
|
|
2
2
|
import { IDynamicWaasConnector, Wallet, WalletConnectorCore } from '@dynamic-labs/wallet-connector-core';
|
|
3
|
-
export declare const configWaasWalletConnector: ({ walletConnector, environmentId, apiBaseUrl, relayUrl, authMode, getSignedSessionId, getMfaToken, }: {
|
|
3
|
+
export declare const configWaasWalletConnector: ({ walletConnector, environmentId, apiBaseUrl, relayUrl, baseClientKeysharesRelayApiUrl, authMode, getSignedSessionId, getMfaToken, }: {
|
|
4
4
|
walletConnector: IDynamicWaasConnector;
|
|
5
5
|
environmentId: string;
|
|
6
6
|
apiBaseUrl: string;
|
|
7
7
|
relayUrl: string;
|
|
8
|
+
baseClientKeysharesRelayApiUrl?: string;
|
|
8
9
|
authMode?: 'cookie' | 'header';
|
|
9
10
|
getSignedSessionId: () => Promise<string>;
|
|
10
11
|
getMfaToken: (props?: {
|
|
@@ -93,10 +93,10 @@ import '../../../context/FooterAnimationContext/index.js';
|
|
|
93
93
|
import '../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.js';
|
|
94
94
|
import '../../../context/PasskeyContext/PasskeyContext.js';
|
|
95
95
|
import '../../../context/OnrampContext/OnrampContext.js';
|
|
96
|
+
import { useRefreshUser } from '../useRefreshUser/useRefreshUser.js';
|
|
96
97
|
import { DEFAULT_WAAS_API_URL } from '../../constants/waas/apiUrl.js';
|
|
97
98
|
import { useClientSessionKeys } from '../useClientSessionKeys/useClientSessionKeys.js';
|
|
98
99
|
import { useGetMfaToken } from '../useGetMfaToken/useGetMfaToken.js';
|
|
99
|
-
import { useRefreshUser } from '../useRefreshUser/useRefreshUser.js';
|
|
100
100
|
import { DYNAMIC_WAAS_CONNECTOR_NOT_FOUND_ERROR, NO_ENABLED_CHAINS_ERROR, INVALID_CHAINS_ERROR, WALLET_CREATION_FAILED_ERROR } from './constants.js';
|
|
101
101
|
import '../../../store/state/sendBalances.js';
|
|
102
102
|
import '../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
@@ -113,7 +113,7 @@ import '../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
|
113
113
|
import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
114
114
|
|
|
115
115
|
const dynamicWaasKey = 'dynamicwaas';
|
|
116
|
-
const configWaasWalletConnector = ({ walletConnector, environmentId, apiBaseUrl, relayUrl, authMode = 'header', getSignedSessionId, getMfaToken, }) => {
|
|
116
|
+
const configWaasWalletConnector = ({ walletConnector, environmentId, apiBaseUrl, relayUrl, baseClientKeysharesRelayApiUrl, authMode = 'header', getSignedSessionId, getMfaToken, }) => {
|
|
117
117
|
var _a;
|
|
118
118
|
walletConnector.setEnvironmentId(environmentId);
|
|
119
119
|
walletConnector.setBaseApiUrl((_a = (apiBaseUrl || DEFAULT_WAAS_API_URL)) === null || _a === void 0 ? void 0 : _a.replace('/api/v0', ''));
|
|
@@ -128,10 +128,11 @@ const configWaasWalletConnector = ({ walletConnector, environmentId, apiBaseUrl,
|
|
|
128
128
|
walletConnector.setGetSignedSessionIdFunction(getSignedSessionId);
|
|
129
129
|
walletConnector.setRelayUrl(relayUrl);
|
|
130
130
|
walletConnector.setGetMfaTokenFunction(getMfaToken);
|
|
131
|
+
walletConnector.setBaseClientKeysharesRelayApiUrl(baseClientKeysharesRelayApiUrl);
|
|
131
132
|
return walletConnector;
|
|
132
133
|
};
|
|
133
134
|
const useDynamicWaas = () => {
|
|
134
|
-
var _a, _b, _c, _d;
|
|
135
|
+
var _a, _b, _c, _d, _e, _f;
|
|
135
136
|
const { setShowAuthFlow, primaryWallet } = useInternalDynamicContext();
|
|
136
137
|
const { addedWalletsIds, userWallets } = useInternalUserWallets();
|
|
137
138
|
const user = useUser();
|
|
@@ -141,8 +142,9 @@ const useDynamicWaas = () => {
|
|
|
141
142
|
const walletConnectorOptions = useWalletConnectorOptions();
|
|
142
143
|
const refresh = useRefreshUser();
|
|
143
144
|
const relayUrl = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.waas) === null || _b === void 0 ? void 0 : _b.relayUrl;
|
|
145
|
+
const baseClientKeysharesRelayApiUrl = (_d = (_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _c === void 0 ? void 0 : _c.waas) === null || _d === void 0 ? void 0 : _d.customKeyshareRelayBaseUrl;
|
|
144
146
|
const embeddedWalletSettings = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets;
|
|
145
|
-
const enabledChains = (
|
|
147
|
+
const enabledChains = (_e = embeddedWalletSettings === null || embeddedWalletSettings === void 0 ? void 0 : embeddedWalletSettings.chainConfigurations) === null || _e === void 0 ? void 0 : _e.filter((c) => c.enabled);
|
|
146
148
|
const primaryChain = enabledChains === null || enabledChains === void 0 ? void 0 : enabledChains.find((chain) => chain.primary);
|
|
147
149
|
const enabledChainNames = enabledChains === null || enabledChains === void 0 ? void 0 : enabledChains.map((chain) => chain.name);
|
|
148
150
|
const automaticEmbeddedWalletCreationEnabled = embeddedWalletSettings === null || embeddedWalletSettings === void 0 ? void 0 : embeddedWalletSettings.automaticEmbeddedWalletCreation;
|
|
@@ -169,6 +171,7 @@ const useDynamicWaas = () => {
|
|
|
169
171
|
const configuredWalletConnector = configWaasWalletConnector({
|
|
170
172
|
apiBaseUrl: apiBaseUrl || DEFAULT_WAAS_API_URL,
|
|
171
173
|
authMode: isCookieAuthEnabled ? 'cookie' : 'header',
|
|
174
|
+
baseClientKeysharesRelayApiUrl,
|
|
172
175
|
environmentId,
|
|
173
176
|
getMfaToken,
|
|
174
177
|
getSignedSessionId,
|
|
@@ -185,6 +188,7 @@ const useDynamicWaas = () => {
|
|
|
185
188
|
getMfaToken,
|
|
186
189
|
getSignedSessionId,
|
|
187
190
|
relayUrl,
|
|
191
|
+
baseClientKeysharesRelayApiUrl,
|
|
188
192
|
]);
|
|
189
193
|
const shouldInitializeWaas = useMemo(() => {
|
|
190
194
|
var _a;
|
|
@@ -200,7 +204,7 @@ const useDynamicWaas = () => {
|
|
|
200
204
|
}, [
|
|
201
205
|
user === null || user === void 0 ? void 0 : user.id,
|
|
202
206
|
user === null || user === void 0 ? void 0 : user.sessionId,
|
|
203
|
-
(
|
|
207
|
+
(_f = user === null || user === void 0 ? void 0 : user.verifiedCredentials) === null || _f === void 0 ? void 0 : _f.length,
|
|
204
208
|
dynamicWaasIsEnabled,
|
|
205
209
|
enabledChainNames === null || enabledChainNames === void 0 ? void 0 : enabledChainNames.length,
|
|
206
210
|
walletConnectorOptions.length,
|
|
@@ -426,7 +430,7 @@ const useDynamicWaas = () => {
|
|
|
426
430
|
automaticEmbeddedWalletCreationForExternalEnabled,
|
|
427
431
|
enabledChainNames,
|
|
428
432
|
]);
|
|
429
|
-
const importPrivateKey = (
|
|
433
|
+
const importPrivateKey = (_g) => __awaiter(void 0, [_g], void 0, function* ({ chainName, privateKey, }) {
|
|
430
434
|
const walletConnector = getWaasWalletConnector(chainName);
|
|
431
435
|
if (!walletConnector)
|
|
432
436
|
return;
|
|
@@ -436,7 +440,7 @@ const useDynamicWaas = () => {
|
|
|
436
440
|
});
|
|
437
441
|
yield refresh();
|
|
438
442
|
});
|
|
439
|
-
const upgradeToDynamicWaas = useCallback((
|
|
443
|
+
const upgradeToDynamicWaas = useCallback((_h) => __awaiter(void 0, [_h], void 0, function* ({ privateKey, wallet, }) {
|
|
440
444
|
isUpgrading.current = true;
|
|
441
445
|
if (!primaryWallet) {
|
|
442
446
|
throw new DynamicError('Primary wallet not found');
|
|
@@ -485,14 +489,14 @@ const useDynamicWaas = () => {
|
|
|
485
489
|
}), [environmentId, getWaasWalletConnector, primaryWallet, refresh]);
|
|
486
490
|
const getWaasWallets = useCallback(() => userWallets.filter((w) => w.key === 'dynamicwaas'), [userWallets]);
|
|
487
491
|
const processSignOnWalletSettings = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
488
|
-
var
|
|
492
|
+
var _j;
|
|
489
493
|
if (!(user === null || user === void 0 ? void 0 : user.verifiedCredentials)) {
|
|
490
494
|
return;
|
|
491
495
|
}
|
|
492
496
|
const waasWallets = user.verifiedCredentials.filter((vc) => { var _a; return vc.walletName === 'dynamicwaas' && ((_a = vc.walletProperties) === null || _a === void 0 ? void 0 : _a.settings); });
|
|
493
497
|
for (const wallet of waasWallets) {
|
|
494
498
|
try {
|
|
495
|
-
const settings = (
|
|
499
|
+
const settings = (_j = wallet.walletProperties) === null || _j === void 0 ? void 0 : _j.settings;
|
|
496
500
|
const { address, chain } = wallet;
|
|
497
501
|
if (!settings || !address || !chain) {
|
|
498
502
|
continue;
|
|
@@ -296,7 +296,7 @@ const useSecureEnclaveEmbeddedWallet = () => {
|
|
|
296
296
|
}
|
|
297
297
|
const primaryTurnkeyWalletId = getTurnkeyWalletId.getTurnkeyWalletId(primaryWallet.id, (user$1 === null || user$1 === void 0 ? void 0 : user$1.verifiedCredentials) || []);
|
|
298
298
|
const organizationId = (_s = (_r = (_q = (_p = user$1 === null || user$1 === void 0 ? void 0 : user$1.verifiedCredentials) === null || _p === void 0 ? void 0 : _p.find(({ walletName, id }) => (walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey')) && id === primaryTurnkeyWalletId)) === null || _q === void 0 ? void 0 : _q.walletProperties) === null || _r === void 0 ? void 0 : _r.turnkeySubOrganizationId) !== null && _s !== void 0 ? _s : undefined;
|
|
299
|
-
yield turnkeyRecoveryHandler.verifyRecoveryCode(options.oneTimeCode, organizationId);
|
|
299
|
+
yield turnkeyRecoveryHandler.verifyRecoveryCode(options.oneTimeCode, organizationId !== null && organizationId !== void 0 ? organizationId : undefined);
|
|
300
300
|
const sessionSettings = {
|
|
301
301
|
createdAt: new Date().getTime(),
|
|
302
302
|
emailCode: options.oneTimeCode,
|
|
@@ -292,7 +292,7 @@ const useSecureEnclaveEmbeddedWallet = () => {
|
|
|
292
292
|
}
|
|
293
293
|
const primaryTurnkeyWalletId = getTurnkeyWalletId(primaryWallet.id, (user === null || user === void 0 ? void 0 : user.verifiedCredentials) || []);
|
|
294
294
|
const organizationId = (_s = (_r = (_q = (_p = user === null || user === void 0 ? void 0 : user.verifiedCredentials) === null || _p === void 0 ? void 0 : _p.find(({ walletName, id }) => (walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey')) && id === primaryTurnkeyWalletId)) === null || _q === void 0 ? void 0 : _q.walletProperties) === null || _r === void 0 ? void 0 : _r.turnkeySubOrganizationId) !== null && _s !== void 0 ? _s : undefined;
|
|
295
|
-
yield turnkeyRecoveryHandler.verifyRecoveryCode(options.oneTimeCode, organizationId);
|
|
295
|
+
yield turnkeyRecoveryHandler.verifyRecoveryCode(options.oneTimeCode, organizationId !== null && organizationId !== void 0 ? organizationId : undefined);
|
|
296
296
|
const sessionSettings = {
|
|
297
297
|
createdAt: new Date().getTime(),
|
|
298
298
|
emailCode: options.oneTimeCode,
|
|
@@ -92,8 +92,8 @@ require('../../../context/FooterAnimationContext/index.cjs');
|
|
|
92
92
|
require('../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.cjs');
|
|
93
93
|
require('../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
94
94
|
require('../../../context/OnrampContext/OnrampContext.cjs');
|
|
95
|
-
var useDynamicWaas = require('../useDynamicWaas/useDynamicWaas.cjs');
|
|
96
95
|
var useWalletDelegation = require('../useWalletDelegation/useWalletDelegation.cjs');
|
|
96
|
+
var useDynamicWaas = require('../useDynamicWaas/useDynamicWaas.cjs');
|
|
97
97
|
require('../../../store/state/sendBalances.cjs');
|
|
98
98
|
require('../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
99
99
|
require('../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
@@ -88,8 +88,8 @@ import '../../../context/FooterAnimationContext/index.js';
|
|
|
88
88
|
import '../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.js';
|
|
89
89
|
import '../../../context/PasskeyContext/PasskeyContext.js';
|
|
90
90
|
import '../../../context/OnrampContext/OnrampContext.js';
|
|
91
|
-
import { useDynamicWaas } from '../useDynamicWaas/useDynamicWaas.js';
|
|
92
91
|
import { useWalletDelegation } from '../useWalletDelegation/useWalletDelegation.js';
|
|
92
|
+
import { useDynamicWaas } from '../useDynamicWaas/useDynamicWaas.js';
|
|
93
93
|
import '../../../store/state/sendBalances.js';
|
|
94
94
|
import '../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
95
95
|
import '../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
|
|
@@ -115,7 +115,15 @@ const useSyncMfaFlow = ({ handler: headlessHandler, } = {}) => {
|
|
|
115
115
|
// this is used to make sure we only trigger the effect once
|
|
116
116
|
const triggered = React.useRef(false);
|
|
117
117
|
useDynamicEvents.useInternalDynamicEvents('logout', () => {
|
|
118
|
-
|
|
118
|
+
/**
|
|
119
|
+
* We need to wait with node tick to wait for react lifecycle to complete
|
|
120
|
+
* and clear the react state.
|
|
121
|
+
* Otherwise the useEffect will run on logout with old state and set the
|
|
122
|
+
* triggered flag to true, which will prevent the effect from running on next login.
|
|
123
|
+
*/
|
|
124
|
+
setTimeout(() => {
|
|
125
|
+
triggered.current = false;
|
|
126
|
+
}, 0);
|
|
119
127
|
});
|
|
120
128
|
React.useEffect(() => {
|
|
121
129
|
var _a;
|
|
@@ -111,7 +111,15 @@ const useSyncMfaFlow = ({ handler: headlessHandler, } = {}) => {
|
|
|
111
111
|
// this is used to make sure we only trigger the effect once
|
|
112
112
|
const triggered = useRef(false);
|
|
113
113
|
useInternalDynamicEvents('logout', () => {
|
|
114
|
-
|
|
114
|
+
/**
|
|
115
|
+
* We need to wait with node tick to wait for react lifecycle to complete
|
|
116
|
+
* and clear the react state.
|
|
117
|
+
* Otherwise the useEffect will run on logout with old state and set the
|
|
118
|
+
* triggered flag to true, which will prevent the effect from running on next login.
|
|
119
|
+
*/
|
|
120
|
+
setTimeout(() => {
|
|
121
|
+
triggered.current = false;
|
|
122
|
+
}, 0);
|
|
115
123
|
});
|
|
116
124
|
useEffect(() => {
|
|
117
125
|
var _a;
|
|
@@ -92,9 +92,9 @@ require('../../../context/FooterAnimationContext/index.cjs');
|
|
|
92
92
|
require('../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.cjs');
|
|
93
93
|
require('../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
94
94
|
require('../../../context/OnrampContext/OnrampContext.cjs');
|
|
95
|
-
var useDynamicWaas = require('../useDynamicWaas/useDynamicWaas.cjs');
|
|
96
95
|
var waas = require('../../../data/api/waas/waas.cjs');
|
|
97
96
|
var useRefreshUser = require('../useRefreshUser/useRefreshUser.cjs');
|
|
97
|
+
var useDynamicWaas = require('../useDynamicWaas/useDynamicWaas.cjs');
|
|
98
98
|
require('../../../store/state/sendBalances.cjs');
|
|
99
99
|
require('../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
100
100
|
require('../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
@@ -88,9 +88,9 @@ import '../../../context/FooterAnimationContext/index.js';
|
|
|
88
88
|
import '../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.js';
|
|
89
89
|
import '../../../context/PasskeyContext/PasskeyContext.js';
|
|
90
90
|
import '../../../context/OnrampContext/OnrampContext.js';
|
|
91
|
-
import { useDynamicWaas } from '../useDynamicWaas/useDynamicWaas.js';
|
|
92
91
|
import { updateWaasWalletSettings } from '../../../data/api/waas/waas.js';
|
|
93
92
|
import { useRefreshUser } from '../useRefreshUser/useRefreshUser.js';
|
|
93
|
+
import { useDynamicWaas } from '../useDynamicWaas/useDynamicWaas.js';
|
|
94
94
|
import '../../../store/state/sendBalances.js';
|
|
95
95
|
import '../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
96
96
|
import '../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
|
|
@@ -108,6 +108,7 @@ require('../../../index.cjs');
|
|
|
108
108
|
require('../../widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.cjs');
|
|
109
109
|
var TextButton = require('../../components/TextButton/TextButton.cjs');
|
|
110
110
|
require('qrcode');
|
|
111
|
+
var PinField = require('../../components/PinField/PinField.cjs');
|
|
111
112
|
require('../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.cjs');
|
|
112
113
|
var IconWithStatus = require('../../components/IconWithStatus/IconWithStatus.cjs');
|
|
113
114
|
require('../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
@@ -115,7 +116,6 @@ require('../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
|
|
|
115
116
|
var useConnectWithOtp = require('../../context/ConnectWithOtpContext/useConnectWithOtp.cjs');
|
|
116
117
|
require('../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
117
118
|
require('@hcaptcha/react-hcaptcha');
|
|
118
|
-
var PinField = require('../../components/PinField/PinField.cjs');
|
|
119
119
|
var RetrySendVerificationCodeSection = require('../../components/RetrySendVerificationCodeSection/RetrySendVerificationCodeSection.cjs');
|
|
120
120
|
require('../ExchangeWhitelistWarning/ExchangeWhitelistWarning.cjs');
|
|
121
121
|
require('../../context/ErrorContext/hooks/useErrorText/useErrorText.cjs');
|
|
@@ -104,6 +104,7 @@ import '../../../index.js';
|
|
|
104
104
|
import '../../widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.js';
|
|
105
105
|
import { TextButton } from '../../components/TextButton/TextButton.js';
|
|
106
106
|
import 'qrcode';
|
|
107
|
+
import { PinField } from '../../components/PinField/PinField.js';
|
|
107
108
|
import '../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.js';
|
|
108
109
|
import { IconWithStatus } from '../../components/IconWithStatus/IconWithStatus.js';
|
|
109
110
|
import '../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
@@ -111,7 +112,6 @@ import '../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
|
111
112
|
import { useConnectWithOtp } from '../../context/ConnectWithOtpContext/useConnectWithOtp.js';
|
|
112
113
|
import '../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
113
114
|
import '@hcaptcha/react-hcaptcha';
|
|
114
|
-
import { PinField } from '../../components/PinField/PinField.js';
|
|
115
115
|
import { RetrySendVerificationCodeSection } from '../../components/RetrySendVerificationCodeSection/RetrySendVerificationCodeSection.js';
|
|
116
116
|
import '../ExchangeWhitelistWarning/ExchangeWhitelistWarning.js';
|
|
117
117
|
import '../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
|