@dynamic-labs/sdk-react-core 4.60.0 → 4.61.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 +30 -0
- package/package.cjs +4 -4
- package/package.js +4 -4
- package/package.json +15 -15
- package/src/index.cjs +4 -4
- package/src/index.d.ts +1 -1
- package/src/index.js +2 -2
- package/src/lib/layout/DynamicAuthLayout/Header/header.cjs +2 -1
- package/src/lib/layout/DynamicAuthLayout/Header/header.js +2 -1
- package/src/lib/shared/assets/error-circle-x.cjs +54 -0
- package/src/lib/shared/assets/error-circle-x.js +30 -0
- package/src/lib/shared/assets/index.d.ts +1 -0
- package/src/lib/shared/types/dynamicHandlers.d.ts +64 -0
- package/src/lib/shared/utils/functions/chain/getChainIcon.cjs +1 -0
- package/src/lib/shared/utils/functions/chain/getChainIcon.js +2 -1
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/hooks/index.d.ts +3 -1
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +18 -16
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.d.ts +4 -8
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +18 -16
- package/src/lib/utils/hooks/useGetWalletPassword/index.d.ts +2 -0
- package/src/lib/utils/hooks/useGetWalletPassword/useGetWalletPassword.cjs +130 -0
- package/src/lib/utils/hooks/useGetWalletPassword/useGetWalletPassword.d.ts +6 -0
- package/src/lib/utils/hooks/useGetWalletPassword/useGetWalletPassword.js +126 -0
- package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.cjs +7 -2
- package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.js +7 -2
- package/src/lib/utils/hooks/useSetupPassword/useSetupPassword.cjs +87 -0
- package/src/lib/utils/hooks/useSetupPassword/useSetupPassword.d.ts +3 -0
- package/src/lib/utils/hooks/useSetupPassword/useSetupPassword.js +88 -1
- package/src/lib/utils/hooks/useSmartWallets/useSmartWallets.cjs +1 -1
- package/src/lib/utils/hooks/useSmartWallets/useSmartWallets.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/useUserAuth/useUserAuth.cjs +12 -4
- package/src/lib/utils/hooks/useUserAuth/useUserAuth.js +12 -4
- package/src/lib/utils/hooks/useWalletBackup/useWalletBackup.cjs +1 -1
- package/src/lib/utils/hooks/useWalletBackup/useWalletBackup.js +1 -1
- package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.cjs +1 -1
- package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.js +1 -1
- package/src/lib/utils/hooks/useWalletPassword/index.d.ts +1 -0
- package/src/lib/utils/hooks/useWalletPassword/useWalletPassword.cjs +152 -0
- package/src/lib/utils/hooks/useWalletPassword/useWalletPassword.d.ts +30 -0
- package/src/lib/utils/hooks/useWalletPassword/useWalletPassword.js +148 -0
- package/src/lib/views/UnlockWalletView/UnlockWalletView.cjs +32 -1
- package/src/lib/views/UnlockWalletView/UnlockWalletView.js +32 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.js +2 -2
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/MfaSection/MfaSection.cjs +11 -14
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/MfaSection/MfaSection.js +11 -14
- package/src/lib/widgets/DynamicWidget/views/EnterPasswordView/EnterPasswordView.cjs +15 -5
- package/src/lib/widgets/DynamicWidget/views/EnterPasswordView/EnterPasswordView.js +15 -5
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordKnowledgeCheckView/SetupPasswordKnowledgeCheckView.cjs +7 -15
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordKnowledgeCheckView/SetupPasswordKnowledgeCheckView.d.ts +0 -1
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordKnowledgeCheckView/SetupPasswordKnowledgeCheckView.js +7 -15
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordTermsView/SetupPasswordTermsView.cjs +9 -2
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordTermsView/SetupPasswordTermsView.d.ts +1 -1
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordTermsView/SetupPasswordTermsView.js +9 -2
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordView/SetupPasswordView.cjs +13 -8
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordView/SetupPasswordView.js +13 -8
- package/src/lib/utils/hooks/useGetPasswordForSigning/index.d.ts +0 -2
- package/src/lib/utils/hooks/useGetPasswordForSigning/useGetPasswordForSigning.cjs +0 -16
- package/src/lib/utils/hooks/useGetPasswordForSigning/useGetPasswordForSigning.d.ts +0 -5
- package/src/lib/utils/hooks/useGetPasswordForSigning/useGetPasswordForSigning.js +0 -12
|
@@ -102,5 +102,7 @@ export { useRefreshAuth } from './useRefreshAuth';
|
|
|
102
102
|
export { useSetupPassword, PASSWORD_SETUP_CANCELLED_ERROR, } from './useSetupPassword';
|
|
103
103
|
export { useWalletUnlock } from './useWalletUnlock';
|
|
104
104
|
export type { UseWalletUnlockReturn, WalletUnlockState, } from './useWalletUnlock';
|
|
105
|
+
export { useWalletPassword } from './useWalletPassword';
|
|
106
|
+
export type { CheckWalletLockStateParams, UnlockWalletParams, UpdatePasswordParams, UseWalletPasswordReturn, WalletPasswordState, } from './useWalletPassword';
|
|
105
107
|
export { usePromptWalletUnlock } from './usePromptWalletUnlock';
|
|
106
|
-
export {
|
|
108
|
+
export { useGetWalletPassword } from './useGetWalletPassword';
|
|
@@ -86,6 +86,13 @@ require('qrcode');
|
|
|
86
86
|
require('formik');
|
|
87
87
|
require('../useSubdomainCheck/useSubdomainCheck.cjs');
|
|
88
88
|
require('../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
89
|
+
var apiUrl = require('../../constants/waas/apiUrl.cjs');
|
|
90
|
+
var useClientSessionKeys = require('../useClientSessionKeys/useClientSessionKeys.cjs');
|
|
91
|
+
var useGetMfaToken = require('../useGetMfaToken/useGetMfaToken.cjs');
|
|
92
|
+
var useGetWalletPassword = require('../useGetWalletPassword/useGetWalletPassword.cjs');
|
|
93
|
+
var useRefreshAuth = require('../useRefreshAuth/useRefreshAuth.cjs');
|
|
94
|
+
var constants = require('./constants.cjs');
|
|
95
|
+
var normalizeWalletRequirements = require('./normalizeWalletRequirements.cjs');
|
|
89
96
|
require('../useWalletBackup/useWalletBackup.cjs');
|
|
90
97
|
require('../useWalletBackup/types.cjs');
|
|
91
98
|
require('../useWalletBackup/cloudProviders.cjs');
|
|
@@ -101,13 +108,6 @@ require('../../../context/FooterAnimationContext/index.cjs');
|
|
|
101
108
|
require('../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.cjs');
|
|
102
109
|
require('../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
103
110
|
require('../../../context/OnrampContext/OnrampContext.cjs');
|
|
104
|
-
var useRefreshAuth = require('../useRefreshAuth/useRefreshAuth.cjs');
|
|
105
|
-
var apiUrl = require('../../constants/waas/apiUrl.cjs');
|
|
106
|
-
var useClientSessionKeys = require('../useClientSessionKeys/useClientSessionKeys.cjs');
|
|
107
|
-
var useGetMfaToken = require('../useGetMfaToken/useGetMfaToken.cjs');
|
|
108
|
-
var useGetPasswordForSigning = require('../useGetPasswordForSigning/useGetPasswordForSigning.cjs');
|
|
109
|
-
var constants = require('./constants.cjs');
|
|
110
|
-
var normalizeWalletRequirements = require('./normalizeWalletRequirements.cjs');
|
|
111
111
|
require('../../../store/state/sendBalances.cjs');
|
|
112
112
|
require('../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
113
113
|
require('../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
@@ -123,7 +123,7 @@ require('../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
|
123
123
|
var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
124
124
|
|
|
125
125
|
const dynamicWaasKey = 'dynamicwaas';
|
|
126
|
-
const configWaasWalletConnector = ({ walletConnector, environmentId, apiBaseUrl, relayUrl, baseClientKeysharesRelayApiUrl, authMode = 'header', getSignedSessionId, getMfaToken,
|
|
126
|
+
const configWaasWalletConnector = ({ walletConnector, environmentId, apiBaseUrl, relayUrl, baseClientKeysharesRelayApiUrl, authMode = 'header', getSignedSessionId, getMfaToken, getWalletPassword, getSvmGasSponsorshipEnabled = () => false, }) => {
|
|
127
127
|
var _a;
|
|
128
128
|
walletConnector.setEnvironmentId(environmentId);
|
|
129
129
|
walletConnector.setBaseApiUrl((_a = (apiBaseUrl || apiUrl.DEFAULT_WAAS_API_URL)) === null || _a === void 0 ? void 0 : _a.replace('/api/v0', ''));
|
|
@@ -140,14 +140,14 @@ const configWaasWalletConnector = ({ walletConnector, environmentId, apiBaseUrl,
|
|
|
140
140
|
walletConnector.setGetMfaTokenFunction(getMfaToken);
|
|
141
141
|
walletConnector.setBaseClientKeysharesRelayApiUrl(baseClientKeysharesRelayApiUrl);
|
|
142
142
|
// Set password provider for locked wallets
|
|
143
|
-
if (
|
|
144
|
-
walletConnector.
|
|
143
|
+
if (getWalletPassword) {
|
|
144
|
+
walletConnector.setGetWalletPasswordFunction(getWalletPassword);
|
|
145
145
|
}
|
|
146
146
|
// Sync SVM gas sponsorship setting for SOL connectors
|
|
147
147
|
const isSolConnector = walletConnector.connectedChain === 'SOL';
|
|
148
148
|
const supportsSponsorshipSetting = 'setSvmGasSponsorshipEnabled' in walletConnector;
|
|
149
149
|
if (isSolConnector && supportsSponsorshipSetting) {
|
|
150
|
-
walletConnector.setSvmGasSponsorshipEnabled(
|
|
150
|
+
walletConnector.setSvmGasSponsorshipEnabled(getSvmGasSponsorshipEnabled);
|
|
151
151
|
}
|
|
152
152
|
return walletConnector;
|
|
153
153
|
};
|
|
@@ -172,10 +172,12 @@ const useDynamicWaas = () => {
|
|
|
172
172
|
const defaultWalletVersion = embeddedWalletSettings === null || embeddedWalletSettings === void 0 ? void 0 : embeddedWalletSettings.defaultWalletVersion;
|
|
173
173
|
const dynamicWaasIsEnabled = defaultWalletVersion === sdkApiCore.EmbeddedWalletVersionEnum.V3;
|
|
174
174
|
const svmGasSponsorshipEnabled = (_f = embeddedWalletSettings === null || embeddedWalletSettings === void 0 ? void 0 : embeddedWalletSettings.svmGasSponsorshipEnabled) !== null && _f !== void 0 ? _f : false;
|
|
175
|
+
const svmGasSponsorshipEnabledRef = React.useRef(svmGasSponsorshipEnabled);
|
|
176
|
+
svmGasSponsorshipEnabledRef.current = svmGasSponsorshipEnabled;
|
|
175
177
|
const authToken = getMinAuthToken.getMinAuthToken();
|
|
176
178
|
const { getSignedSessionId } = useClientSessionKeys.useClientSessionKeys();
|
|
177
179
|
const getMfaToken = useGetMfaToken.useGetMfaToken();
|
|
178
|
-
const
|
|
180
|
+
const getWalletPassword = useGetWalletPassword.useGetWalletPassword();
|
|
179
181
|
const isCookieAuthEnabled = projectSettings && isCookieEnabled.isCookieEnabled();
|
|
180
182
|
const isUpgrading = React.useRef(false);
|
|
181
183
|
const [recoveredWallets, setRecoveredWallets] = React.useState(() => new Set());
|
|
@@ -197,10 +199,10 @@ const useDynamicWaas = () => {
|
|
|
197
199
|
baseClientKeysharesRelayApiUrl,
|
|
198
200
|
environmentId,
|
|
199
201
|
getMfaToken,
|
|
200
|
-
getPasswordForSigning,
|
|
201
202
|
getSignedSessionId,
|
|
203
|
+
getSvmGasSponsorshipEnabled: () => svmGasSponsorshipEnabledRef.current,
|
|
204
|
+
getWalletPassword,
|
|
202
205
|
relayUrl: relayUrl !== null && relayUrl !== void 0 ? relayUrl : '',
|
|
203
|
-
svmGasSponsorshipEnabled,
|
|
204
206
|
walletConnector,
|
|
205
207
|
});
|
|
206
208
|
return configuredWalletConnector;
|
|
@@ -211,11 +213,10 @@ const useDynamicWaas = () => {
|
|
|
211
213
|
environmentId,
|
|
212
214
|
apiBaseUrl,
|
|
213
215
|
getMfaToken,
|
|
214
|
-
|
|
216
|
+
getWalletPassword,
|
|
215
217
|
getSignedSessionId,
|
|
216
218
|
relayUrl,
|
|
217
219
|
baseClientKeysharesRelayApiUrl,
|
|
218
|
-
svmGasSponsorshipEnabled,
|
|
219
220
|
]);
|
|
220
221
|
const shouldInitializeWaas = React.useMemo(() => {
|
|
221
222
|
var _a;
|
|
@@ -293,6 +294,7 @@ const useDynamicWaas = () => {
|
|
|
293
294
|
const signedSessionId = yield getSignedSessionId();
|
|
294
295
|
yield client.getWallet({
|
|
295
296
|
accountAddress: wallet.address,
|
|
297
|
+
authToken: getMinAuthToken.getMinAuthToken(),
|
|
296
298
|
signedSessionId,
|
|
297
299
|
walletOperation: 'RECOVER',
|
|
298
300
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChainEnum, MFAAction } from '@dynamic-labs/sdk-api-core';
|
|
2
|
-
import { IDynamicWaasConnector, Wallet, WalletConnectorCore } from '@dynamic-labs/wallet-connector-core';
|
|
2
|
+
import { GetWalletPasswordFn, IDynamicWaasConnector, Wallet, WalletConnectorCore } from '@dynamic-labs/wallet-connector-core';
|
|
3
3
|
/**
|
|
4
4
|
* Type for wallet creation requirements
|
|
5
5
|
* For BTC: includes bitcoinConfig with addressType
|
|
@@ -12,11 +12,7 @@ export type WalletCreationRequirement = {
|
|
|
12
12
|
network?: string;
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
|
-
export
|
|
16
|
-
accountAddress: string;
|
|
17
|
-
chainName: string;
|
|
18
|
-
}) => Promise<string | undefined>;
|
|
19
|
-
export declare const configWaasWalletConnector: ({ walletConnector, environmentId, apiBaseUrl, relayUrl, baseClientKeysharesRelayApiUrl, authMode, getSignedSessionId, getMfaToken, getPasswordForSigning, svmGasSponsorshipEnabled, }: {
|
|
15
|
+
export declare const configWaasWalletConnector: ({ walletConnector, environmentId, apiBaseUrl, relayUrl, baseClientKeysharesRelayApiUrl, authMode, getSignedSessionId, getMfaToken, getWalletPassword, getSvmGasSponsorshipEnabled, }: {
|
|
20
16
|
walletConnector: IDynamicWaasConnector;
|
|
21
17
|
environmentId: string;
|
|
22
18
|
apiBaseUrl: string;
|
|
@@ -27,8 +23,8 @@ export declare const configWaasWalletConnector: ({ walletConnector, environmentI
|
|
|
27
23
|
getMfaToken: (props?: {
|
|
28
24
|
mfaAction?: MFAAction;
|
|
29
25
|
}) => Promise<string | undefined>;
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
getWalletPassword?: GetWalletPasswordFn;
|
|
27
|
+
getSvmGasSponsorshipEnabled?: () => boolean;
|
|
32
28
|
}) => IDynamicWaasConnector;
|
|
33
29
|
export declare const useDynamicWaas: () => {
|
|
34
30
|
areWalletsReadyForSettings: () => boolean;
|
|
@@ -82,6 +82,13 @@ import 'qrcode';
|
|
|
82
82
|
import 'formik';
|
|
83
83
|
import '../useSubdomainCheck/useSubdomainCheck.js';
|
|
84
84
|
import '../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
85
|
+
import { DEFAULT_WAAS_API_URL } from '../../constants/waas/apiUrl.js';
|
|
86
|
+
import { useClientSessionKeys } from '../useClientSessionKeys/useClientSessionKeys.js';
|
|
87
|
+
import { useGetMfaToken } from '../useGetMfaToken/useGetMfaToken.js';
|
|
88
|
+
import { useGetWalletPassword } from '../useGetWalletPassword/useGetWalletPassword.js';
|
|
89
|
+
import { useRefreshAuth } from '../useRefreshAuth/useRefreshAuth.js';
|
|
90
|
+
import { DYNAMIC_WAAS_CONNECTOR_NOT_FOUND_ERROR, NO_ENABLED_CHAINS_ERROR, INVALID_CHAINS_ERROR, WALLET_CREATION_FAILED_ERROR } from './constants.js';
|
|
91
|
+
import { normalizeWalletRequirements } from './normalizeWalletRequirements.js';
|
|
85
92
|
import '../useWalletBackup/useWalletBackup.js';
|
|
86
93
|
import '../useWalletBackup/types.js';
|
|
87
94
|
import '../useWalletBackup/cloudProviders.js';
|
|
@@ -97,13 +104,6 @@ import '../../../context/FooterAnimationContext/index.js';
|
|
|
97
104
|
import '../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.js';
|
|
98
105
|
import '../../../context/PasskeyContext/PasskeyContext.js';
|
|
99
106
|
import '../../../context/OnrampContext/OnrampContext.js';
|
|
100
|
-
import { useRefreshAuth } from '../useRefreshAuth/useRefreshAuth.js';
|
|
101
|
-
import { DEFAULT_WAAS_API_URL } from '../../constants/waas/apiUrl.js';
|
|
102
|
-
import { useClientSessionKeys } from '../useClientSessionKeys/useClientSessionKeys.js';
|
|
103
|
-
import { useGetMfaToken } from '../useGetMfaToken/useGetMfaToken.js';
|
|
104
|
-
import { useGetPasswordForSigning } from '../useGetPasswordForSigning/useGetPasswordForSigning.js';
|
|
105
|
-
import { DYNAMIC_WAAS_CONNECTOR_NOT_FOUND_ERROR, NO_ENABLED_CHAINS_ERROR, INVALID_CHAINS_ERROR, WALLET_CREATION_FAILED_ERROR } from './constants.js';
|
|
106
|
-
import { normalizeWalletRequirements } from './normalizeWalletRequirements.js';
|
|
107
107
|
import '../../../store/state/sendBalances.js';
|
|
108
108
|
import '../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
109
109
|
import '../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
|
|
@@ -119,7 +119,7 @@ import '../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
|
119
119
|
import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
120
120
|
|
|
121
121
|
const dynamicWaasKey = 'dynamicwaas';
|
|
122
|
-
const configWaasWalletConnector = ({ walletConnector, environmentId, apiBaseUrl, relayUrl, baseClientKeysharesRelayApiUrl, authMode = 'header', getSignedSessionId, getMfaToken,
|
|
122
|
+
const configWaasWalletConnector = ({ walletConnector, environmentId, apiBaseUrl, relayUrl, baseClientKeysharesRelayApiUrl, authMode = 'header', getSignedSessionId, getMfaToken, getWalletPassword, getSvmGasSponsorshipEnabled = () => false, }) => {
|
|
123
123
|
var _a;
|
|
124
124
|
walletConnector.setEnvironmentId(environmentId);
|
|
125
125
|
walletConnector.setBaseApiUrl((_a = (apiBaseUrl || DEFAULT_WAAS_API_URL)) === null || _a === void 0 ? void 0 : _a.replace('/api/v0', ''));
|
|
@@ -136,14 +136,14 @@ const configWaasWalletConnector = ({ walletConnector, environmentId, apiBaseUrl,
|
|
|
136
136
|
walletConnector.setGetMfaTokenFunction(getMfaToken);
|
|
137
137
|
walletConnector.setBaseClientKeysharesRelayApiUrl(baseClientKeysharesRelayApiUrl);
|
|
138
138
|
// Set password provider for locked wallets
|
|
139
|
-
if (
|
|
140
|
-
walletConnector.
|
|
139
|
+
if (getWalletPassword) {
|
|
140
|
+
walletConnector.setGetWalletPasswordFunction(getWalletPassword);
|
|
141
141
|
}
|
|
142
142
|
// Sync SVM gas sponsorship setting for SOL connectors
|
|
143
143
|
const isSolConnector = walletConnector.connectedChain === 'SOL';
|
|
144
144
|
const supportsSponsorshipSetting = 'setSvmGasSponsorshipEnabled' in walletConnector;
|
|
145
145
|
if (isSolConnector && supportsSponsorshipSetting) {
|
|
146
|
-
walletConnector.setSvmGasSponsorshipEnabled(
|
|
146
|
+
walletConnector.setSvmGasSponsorshipEnabled(getSvmGasSponsorshipEnabled);
|
|
147
147
|
}
|
|
148
148
|
return walletConnector;
|
|
149
149
|
};
|
|
@@ -168,10 +168,12 @@ const useDynamicWaas = () => {
|
|
|
168
168
|
const defaultWalletVersion = embeddedWalletSettings === null || embeddedWalletSettings === void 0 ? void 0 : embeddedWalletSettings.defaultWalletVersion;
|
|
169
169
|
const dynamicWaasIsEnabled = defaultWalletVersion === EmbeddedWalletVersionEnum.V3;
|
|
170
170
|
const svmGasSponsorshipEnabled = (_f = embeddedWalletSettings === null || embeddedWalletSettings === void 0 ? void 0 : embeddedWalletSettings.svmGasSponsorshipEnabled) !== null && _f !== void 0 ? _f : false;
|
|
171
|
+
const svmGasSponsorshipEnabledRef = useRef(svmGasSponsorshipEnabled);
|
|
172
|
+
svmGasSponsorshipEnabledRef.current = svmGasSponsorshipEnabled;
|
|
171
173
|
const authToken = getMinAuthToken();
|
|
172
174
|
const { getSignedSessionId } = useClientSessionKeys();
|
|
173
175
|
const getMfaToken = useGetMfaToken();
|
|
174
|
-
const
|
|
176
|
+
const getWalletPassword = useGetWalletPassword();
|
|
175
177
|
const isCookieAuthEnabled = projectSettings && isCookieEnabled();
|
|
176
178
|
const isUpgrading = useRef(false);
|
|
177
179
|
const [recoveredWallets, setRecoveredWallets] = useState(() => new Set());
|
|
@@ -193,10 +195,10 @@ const useDynamicWaas = () => {
|
|
|
193
195
|
baseClientKeysharesRelayApiUrl,
|
|
194
196
|
environmentId,
|
|
195
197
|
getMfaToken,
|
|
196
|
-
getPasswordForSigning,
|
|
197
198
|
getSignedSessionId,
|
|
199
|
+
getSvmGasSponsorshipEnabled: () => svmGasSponsorshipEnabledRef.current,
|
|
200
|
+
getWalletPassword,
|
|
198
201
|
relayUrl: relayUrl !== null && relayUrl !== void 0 ? relayUrl : '',
|
|
199
|
-
svmGasSponsorshipEnabled,
|
|
200
202
|
walletConnector,
|
|
201
203
|
});
|
|
202
204
|
return configuredWalletConnector;
|
|
@@ -207,11 +209,10 @@ const useDynamicWaas = () => {
|
|
|
207
209
|
environmentId,
|
|
208
210
|
apiBaseUrl,
|
|
209
211
|
getMfaToken,
|
|
210
|
-
|
|
212
|
+
getWalletPassword,
|
|
211
213
|
getSignedSessionId,
|
|
212
214
|
relayUrl,
|
|
213
215
|
baseClientKeysharesRelayApiUrl,
|
|
214
|
-
svmGasSponsorshipEnabled,
|
|
215
216
|
]);
|
|
216
217
|
const shouldInitializeWaas = useMemo(() => {
|
|
217
218
|
var _a;
|
|
@@ -289,6 +290,7 @@ const useDynamicWaas = () => {
|
|
|
289
290
|
const signedSessionId = yield getSignedSessionId();
|
|
290
291
|
yield client.getWallet({
|
|
291
292
|
accountAddress: wallet.address,
|
|
293
|
+
authToken: getMinAuthToken(),
|
|
292
294
|
signedSessionId,
|
|
293
295
|
walletOperation: 'RECOVER',
|
|
294
296
|
});
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
require('../../../context/DynamicContext/DynamicContext.cjs');
|
|
9
|
+
require('../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
|
|
10
|
+
require('@dynamic-labs/iconic');
|
|
11
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
12
|
+
require('react/jsx-runtime');
|
|
13
|
+
require('../../../context/ViewContext/ViewContext.cjs');
|
|
14
|
+
require('../../../shared/logger.cjs');
|
|
15
|
+
require('@dynamic-labs/wallet-book');
|
|
16
|
+
require('@dynamic-labs/utils');
|
|
17
|
+
require('../../constants/colors.cjs');
|
|
18
|
+
require('../../constants/values.cjs');
|
|
19
|
+
require('@dynamic-labs/sdk-api-core');
|
|
20
|
+
require('../../../shared/consts/index.cjs');
|
|
21
|
+
require('../../../events/dynamicEvents.cjs');
|
|
22
|
+
require('../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
23
|
+
require('../../../context/ErrorContext/ErrorContext.cjs');
|
|
24
|
+
require('@dynamic-labs/multi-wallet');
|
|
25
|
+
require('react-international-phone');
|
|
26
|
+
require('../../../store/state/nonce/nonce.cjs');
|
|
27
|
+
require('@dynamic-labs-sdk/client/core');
|
|
28
|
+
require('../../../client/client.cjs');
|
|
29
|
+
require('@dynamic-labs-sdk/client');
|
|
30
|
+
require('../../../config/ApiEndpoint.cjs');
|
|
31
|
+
require('@dynamic-labs/locale');
|
|
32
|
+
require('../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
33
|
+
require('../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
34
|
+
require('../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
35
|
+
require('../../functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.cjs');
|
|
36
|
+
require('../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
37
|
+
require('../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
38
|
+
require('../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
39
|
+
require('../../../store/state/authMode/authMode.cjs');
|
|
40
|
+
require('../../../context/VerificationContext/VerificationContext.cjs');
|
|
41
|
+
require('react-dom');
|
|
42
|
+
require('../../functions/compareChains/compareChains.cjs');
|
|
43
|
+
require('../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.cjs');
|
|
44
|
+
require('../../../context/ThemeContext/ThemeContext.cjs');
|
|
45
|
+
require('../useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
46
|
+
require('bs58');
|
|
47
|
+
require('@dynamic-labs/types');
|
|
48
|
+
require('../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
49
|
+
require('../../../context/LoadingContext/LoadingContext.cjs');
|
|
50
|
+
require('../../../context/WalletContext/WalletContext.cjs');
|
|
51
|
+
require('../useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs');
|
|
52
|
+
require('yup');
|
|
53
|
+
require('../../../context/MockContext/MockContext.cjs');
|
|
54
|
+
require('../../../views/CollectUserDataView/useFields.cjs');
|
|
55
|
+
require('../../../context/FieldsStateContext/FieldsStateContext.cjs');
|
|
56
|
+
require('../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
57
|
+
require('@dynamic-labs/rpc-providers');
|
|
58
|
+
require('../../../store/state/walletOptions/walletOptions.cjs');
|
|
59
|
+
require('react-i18next');
|
|
60
|
+
require('../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
61
|
+
require('../../../components/Alert/Alert.cjs');
|
|
62
|
+
require('../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
63
|
+
require('../../../components/IconButton/IconButton.cjs');
|
|
64
|
+
require('../../../components/InlineWidget/InlineWidget.cjs');
|
|
65
|
+
require('../../../components/Input/Input.cjs');
|
|
66
|
+
require('../../../components/IsBrowser/IsBrowser.cjs');
|
|
67
|
+
require('../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
68
|
+
require('../../../components/OverlayCard/OverlayCard.cjs');
|
|
69
|
+
require('../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
70
|
+
require('../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
71
|
+
require('../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
72
|
+
require('../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
73
|
+
require('../../../components/Popper/Popper/Popper.cjs');
|
|
74
|
+
require('../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
75
|
+
require('react-focus-lock');
|
|
76
|
+
require('qrcode');
|
|
77
|
+
require('formik');
|
|
78
|
+
require('../useSubdomainCheck/useSubdomainCheck.cjs');
|
|
79
|
+
require('../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
80
|
+
var usePromptWalletUnlock = require('../usePromptWalletUnlock/usePromptWalletUnlock.cjs');
|
|
81
|
+
require('../useWalletBackup/useWalletBackup.cjs');
|
|
82
|
+
require('../useWalletBackup/types.cjs');
|
|
83
|
+
require('../useWalletBackup/cloudProviders.cjs');
|
|
84
|
+
require('../../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
85
|
+
require('../../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
|
|
86
|
+
require('../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
87
|
+
require('@hcaptcha/react-hcaptcha');
|
|
88
|
+
require('../../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
89
|
+
require('../../../widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.cjs');
|
|
90
|
+
require('../../../views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.cjs');
|
|
91
|
+
require('../../../context/ErrorContext/hooks/useErrorText/useErrorText.cjs');
|
|
92
|
+
require('../../../context/FooterAnimationContext/index.cjs');
|
|
93
|
+
require('../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.cjs');
|
|
94
|
+
require('../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
95
|
+
require('../../../context/OnrampContext/OnrampContext.cjs');
|
|
96
|
+
require('../../../store/state/sendBalances.cjs');
|
|
97
|
+
require('../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
98
|
+
require('../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
99
|
+
require('../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
100
|
+
require('../../../views/TransactionConfirmationView/TransactionConfirmationView.cjs');
|
|
101
|
+
require('../../../widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.cjs');
|
|
102
|
+
require('../../../widgets/DynamicWidget/views/CryptoComOnramp/CryptoComOnramp.cjs');
|
|
103
|
+
require('../../../../index.cjs');
|
|
104
|
+
require('../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.cjs');
|
|
105
|
+
require('../../../store/state/tokenBalances.cjs');
|
|
106
|
+
require('../../../store/state/multichainBalances.cjs');
|
|
107
|
+
require('../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
108
|
+
var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
109
|
+
|
|
110
|
+
const useGetWalletPassword = () => {
|
|
111
|
+
const { handlers } = useInternalDynamicContext.useInternalDynamicContext();
|
|
112
|
+
const promptWalletUnlock = usePromptWalletUnlock.usePromptWalletUnlock();
|
|
113
|
+
// Use ref pattern to avoid callback recreation when handlers change
|
|
114
|
+
const getWalletPasswordHandlerRef = React.useRef(handlers === null || handlers === void 0 ? void 0 : handlers.getWalletPassword);
|
|
115
|
+
getWalletPasswordHandlerRef.current = handlers === null || handlers === void 0 ? void 0 : handlers.getWalletPassword;
|
|
116
|
+
const getWalletPassword = React.useCallback((_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ accountAddress, chainName, }) {
|
|
117
|
+
// If custom handler provided, use it
|
|
118
|
+
if (getWalletPasswordHandlerRef.current) {
|
|
119
|
+
return getWalletPasswordHandlerRef.current({
|
|
120
|
+
accountAddress,
|
|
121
|
+
chainName,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
// Otherwise use default UI prompt
|
|
125
|
+
return promptWalletUnlock({ accountAddress, chainName });
|
|
126
|
+
}), [promptWalletUnlock]);
|
|
127
|
+
return getWalletPassword;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
exports.useGetWalletPassword = useGetWalletPassword;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
|
+
import { useRef, useCallback } from 'react';
|
|
4
|
+
import '../../../context/DynamicContext/DynamicContext.js';
|
|
5
|
+
import '../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
6
|
+
import '@dynamic-labs/iconic';
|
|
7
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
8
|
+
import 'react/jsx-runtime';
|
|
9
|
+
import '../../../context/ViewContext/ViewContext.js';
|
|
10
|
+
import '../../../shared/logger.js';
|
|
11
|
+
import '@dynamic-labs/wallet-book';
|
|
12
|
+
import '@dynamic-labs/utils';
|
|
13
|
+
import '../../constants/colors.js';
|
|
14
|
+
import '../../constants/values.js';
|
|
15
|
+
import '@dynamic-labs/sdk-api-core';
|
|
16
|
+
import '../../../shared/consts/index.js';
|
|
17
|
+
import '../../../events/dynamicEvents.js';
|
|
18
|
+
import '../../../context/CaptchaContext/CaptchaContext.js';
|
|
19
|
+
import '../../../context/ErrorContext/ErrorContext.js';
|
|
20
|
+
import '@dynamic-labs/multi-wallet';
|
|
21
|
+
import 'react-international-phone';
|
|
22
|
+
import '../../../store/state/nonce/nonce.js';
|
|
23
|
+
import '@dynamic-labs-sdk/client/core';
|
|
24
|
+
import '../../../client/client.js';
|
|
25
|
+
import '@dynamic-labs-sdk/client';
|
|
26
|
+
import '../../../config/ApiEndpoint.js';
|
|
27
|
+
import '@dynamic-labs/locale';
|
|
28
|
+
import '../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
29
|
+
import '../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
30
|
+
import '../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
31
|
+
import '../../functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.js';
|
|
32
|
+
import '../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
33
|
+
import '../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
34
|
+
import '../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
35
|
+
import '../../../store/state/authMode/authMode.js';
|
|
36
|
+
import '../../../context/VerificationContext/VerificationContext.js';
|
|
37
|
+
import 'react-dom';
|
|
38
|
+
import '../../functions/compareChains/compareChains.js';
|
|
39
|
+
import '../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.js';
|
|
40
|
+
import '../../../context/ThemeContext/ThemeContext.js';
|
|
41
|
+
import '../useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
42
|
+
import 'bs58';
|
|
43
|
+
import '@dynamic-labs/types';
|
|
44
|
+
import '../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
45
|
+
import '../../../context/LoadingContext/LoadingContext.js';
|
|
46
|
+
import '../../../context/WalletContext/WalletContext.js';
|
|
47
|
+
import '../useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
|
|
48
|
+
import 'yup';
|
|
49
|
+
import '../../../context/MockContext/MockContext.js';
|
|
50
|
+
import '../../../views/CollectUserDataView/useFields.js';
|
|
51
|
+
import '../../../context/FieldsStateContext/FieldsStateContext.js';
|
|
52
|
+
import '../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
53
|
+
import '@dynamic-labs/rpc-providers';
|
|
54
|
+
import '../../../store/state/walletOptions/walletOptions.js';
|
|
55
|
+
import 'react-i18next';
|
|
56
|
+
import '../../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
57
|
+
import '../../../components/Alert/Alert.js';
|
|
58
|
+
import '../../../components/ShadowDOM/ShadowDOM.js';
|
|
59
|
+
import '../../../components/IconButton/IconButton.js';
|
|
60
|
+
import '../../../components/InlineWidget/InlineWidget.js';
|
|
61
|
+
import '../../../components/Input/Input.js';
|
|
62
|
+
import '../../../components/IsBrowser/IsBrowser.js';
|
|
63
|
+
import '../../../components/MenuList/Dropdown/Dropdown.js';
|
|
64
|
+
import '../../../components/OverlayCard/OverlayCard.js';
|
|
65
|
+
import '../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
66
|
+
import '../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
67
|
+
import '../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
68
|
+
import '../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
69
|
+
import '../../../components/Popper/Popper/Popper.js';
|
|
70
|
+
import '../../../components/Popper/PopperContext/PopperContext.js';
|
|
71
|
+
import 'react-focus-lock';
|
|
72
|
+
import 'qrcode';
|
|
73
|
+
import 'formik';
|
|
74
|
+
import '../useSubdomainCheck/useSubdomainCheck.js';
|
|
75
|
+
import '../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
76
|
+
import { usePromptWalletUnlock } from '../usePromptWalletUnlock/usePromptWalletUnlock.js';
|
|
77
|
+
import '../useWalletBackup/useWalletBackup.js';
|
|
78
|
+
import '../useWalletBackup/types.js';
|
|
79
|
+
import '../useWalletBackup/cloudProviders.js';
|
|
80
|
+
import '../../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
81
|
+
import '../../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
82
|
+
import '../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
83
|
+
import '@hcaptcha/react-hcaptcha';
|
|
84
|
+
import '../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
85
|
+
import '../../../widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.js';
|
|
86
|
+
import '../../../views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.js';
|
|
87
|
+
import '../../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
|
|
88
|
+
import '../../../context/FooterAnimationContext/index.js';
|
|
89
|
+
import '../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.js';
|
|
90
|
+
import '../../../context/PasskeyContext/PasskeyContext.js';
|
|
91
|
+
import '../../../context/OnrampContext/OnrampContext.js';
|
|
92
|
+
import '../../../store/state/sendBalances.js';
|
|
93
|
+
import '../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
94
|
+
import '../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
|
|
95
|
+
import '../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
96
|
+
import '../../../views/TransactionConfirmationView/TransactionConfirmationView.js';
|
|
97
|
+
import '../../../widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.js';
|
|
98
|
+
import '../../../widgets/DynamicWidget/views/CryptoComOnramp/CryptoComOnramp.js';
|
|
99
|
+
import '../../../../index.js';
|
|
100
|
+
import '../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.js';
|
|
101
|
+
import '../../../store/state/tokenBalances.js';
|
|
102
|
+
import '../../../store/state/multichainBalances.js';
|
|
103
|
+
import '../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
104
|
+
import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
105
|
+
|
|
106
|
+
const useGetWalletPassword = () => {
|
|
107
|
+
const { handlers } = useInternalDynamicContext();
|
|
108
|
+
const promptWalletUnlock = usePromptWalletUnlock();
|
|
109
|
+
// Use ref pattern to avoid callback recreation when handlers change
|
|
110
|
+
const getWalletPasswordHandlerRef = useRef(handlers === null || handlers === void 0 ? void 0 : handlers.getWalletPassword);
|
|
111
|
+
getWalletPasswordHandlerRef.current = handlers === null || handlers === void 0 ? void 0 : handlers.getWalletPassword;
|
|
112
|
+
const getWalletPassword = useCallback((_a) => __awaiter(void 0, [_a], void 0, function* ({ accountAddress, chainName, }) {
|
|
113
|
+
// If custom handler provided, use it
|
|
114
|
+
if (getWalletPasswordHandlerRef.current) {
|
|
115
|
+
return getWalletPasswordHandlerRef.current({
|
|
116
|
+
accountAddress,
|
|
117
|
+
chainName,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
// Otherwise use default UI prompt
|
|
121
|
+
return promptWalletUnlock({ accountAddress, chainName });
|
|
122
|
+
}), [promptWalletUnlock]);
|
|
123
|
+
return getWalletPassword;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export { useGetWalletPassword };
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
+
var React = require('react');
|
|
6
7
|
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
7
|
-
require('react');
|
|
8
8
|
require('../../../events/dynamicEvents.cjs');
|
|
9
9
|
require('../../../../../_virtual/_tslib.cjs');
|
|
10
10
|
require('@dynamic-labs/utils');
|
|
@@ -79,6 +79,7 @@ require('qrcode');
|
|
|
79
79
|
require('formik');
|
|
80
80
|
require('../useSubdomainCheck/useSubdomainCheck.cjs');
|
|
81
81
|
require('../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
82
|
+
var useDynamicWaas = require('../useDynamicWaas/useDynamicWaas.cjs');
|
|
82
83
|
require('../useWalletBackup/useWalletBackup.cjs');
|
|
83
84
|
require('../useWalletBackup/types.cjs');
|
|
84
85
|
require('../useWalletBackup/cloudProviders.cjs');
|
|
@@ -94,7 +95,6 @@ require('../../../context/FooterAnimationContext/index.cjs');
|
|
|
94
95
|
require('../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.cjs');
|
|
95
96
|
require('../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
96
97
|
require('../../../context/OnrampContext/OnrampContext.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');
|
|
@@ -112,11 +112,15 @@ require('../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
|
112
112
|
var useClientSessionKeys = require('../useClientSessionKeys/useClientSessionKeys.cjs');
|
|
113
113
|
|
|
114
114
|
const useSetWalletConnectorFetchers = (walletOptions, environmentId, projectSettings) => {
|
|
115
|
+
var _a, _b, _c;
|
|
115
116
|
const apiBaseUrl = dynamicContextProps.useApiBaseUrl();
|
|
116
117
|
const { registerEmbeddedWalletSessionKey, removeSessionKey } = useEmbeddedWalletSessionKeys.useEmbeddedWalletSessionKeys({ environmentId, projectSettings });
|
|
117
118
|
const { getSignedSessionId } = useClientSessionKeys.useClientSessionKeys();
|
|
118
119
|
const getMfaToken = useGetMfaToken.useGetMfaToken();
|
|
119
120
|
const isCookieAuthEnabled = projectSettings && isCookieEnabled.isCookieEnabled();
|
|
121
|
+
const svmGasSponsorshipEnabled = (_c = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.embeddedWallets) === null || _b === void 0 ? void 0 : _b.svmGasSponsorshipEnabled) !== null && _c !== void 0 ? _c : false;
|
|
122
|
+
const svmGasSponsorshipEnabledRef = React.useRef(svmGasSponsorshipEnabled);
|
|
123
|
+
svmGasSponsorshipEnabledRef.current = svmGasSponsorshipEnabled;
|
|
120
124
|
if (!(walletOptions === null || walletOptions === void 0 ? void 0 : walletOptions.length))
|
|
121
125
|
return;
|
|
122
126
|
walletOptions.forEach((walletOption) => {
|
|
@@ -132,6 +136,7 @@ const useSetWalletConnectorFetchers = (walletOptions, environmentId, projectSett
|
|
|
132
136
|
environmentId,
|
|
133
137
|
getMfaToken,
|
|
134
138
|
getSignedSessionId,
|
|
139
|
+
getSvmGasSponsorshipEnabled: () => svmGasSponsorshipEnabledRef.current,
|
|
135
140
|
relayUrl: (_e = (_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.relayUrl) !== null && _e !== void 0 ? _e : '',
|
|
136
141
|
walletConnector: walletOption.walletConnector,
|
|
137
142
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
|
+
import { useRef } from 'react';
|
|
2
3
|
import { isSessionKeyCompatibleWalletConnector, isDynamicWaasConnector } from '@dynamic-labs/wallet-connector-core';
|
|
3
|
-
import 'react';
|
|
4
4
|
import '../../../events/dynamicEvents.js';
|
|
5
5
|
import '../../../../../_virtual/_tslib.js';
|
|
6
6
|
import '@dynamic-labs/utils';
|
|
@@ -75,6 +75,7 @@ import 'qrcode';
|
|
|
75
75
|
import 'formik';
|
|
76
76
|
import '../useSubdomainCheck/useSubdomainCheck.js';
|
|
77
77
|
import '../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
78
|
+
import { configWaasWalletConnector } from '../useDynamicWaas/useDynamicWaas.js';
|
|
78
79
|
import '../useWalletBackup/useWalletBackup.js';
|
|
79
80
|
import '../useWalletBackup/types.js';
|
|
80
81
|
import '../useWalletBackup/cloudProviders.js';
|
|
@@ -90,7 +91,6 @@ import '../../../context/FooterAnimationContext/index.js';
|
|
|
90
91
|
import '../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.js';
|
|
91
92
|
import '../../../context/PasskeyContext/PasskeyContext.js';
|
|
92
93
|
import '../../../context/OnrampContext/OnrampContext.js';
|
|
93
|
-
import { configWaasWalletConnector } 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,11 +108,15 @@ import '../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
|
108
108
|
import { useClientSessionKeys } from '../useClientSessionKeys/useClientSessionKeys.js';
|
|
109
109
|
|
|
110
110
|
const useSetWalletConnectorFetchers = (walletOptions, environmentId, projectSettings) => {
|
|
111
|
+
var _a, _b, _c;
|
|
111
112
|
const apiBaseUrl = useApiBaseUrl();
|
|
112
113
|
const { registerEmbeddedWalletSessionKey, removeSessionKey } = useEmbeddedWalletSessionKeys({ environmentId, projectSettings });
|
|
113
114
|
const { getSignedSessionId } = useClientSessionKeys();
|
|
114
115
|
const getMfaToken = useGetMfaToken();
|
|
115
116
|
const isCookieAuthEnabled = projectSettings && isCookieEnabled();
|
|
117
|
+
const svmGasSponsorshipEnabled = (_c = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.embeddedWallets) === null || _b === void 0 ? void 0 : _b.svmGasSponsorshipEnabled) !== null && _c !== void 0 ? _c : false;
|
|
118
|
+
const svmGasSponsorshipEnabledRef = useRef(svmGasSponsorshipEnabled);
|
|
119
|
+
svmGasSponsorshipEnabledRef.current = svmGasSponsorshipEnabled;
|
|
116
120
|
if (!(walletOptions === null || walletOptions === void 0 ? void 0 : walletOptions.length))
|
|
117
121
|
return;
|
|
118
122
|
walletOptions.forEach((walletOption) => {
|
|
@@ -128,6 +132,7 @@ const useSetWalletConnectorFetchers = (walletOptions, environmentId, projectSett
|
|
|
128
132
|
environmentId,
|
|
129
133
|
getMfaToken,
|
|
130
134
|
getSignedSessionId,
|
|
135
|
+
getSvmGasSponsorshipEnabled: () => svmGasSponsorshipEnabledRef.current,
|
|
131
136
|
relayUrl: (_e = (_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.relayUrl) !== null && _e !== void 0 ? _e : '',
|
|
132
137
|
walletConnector: walletOption.walletConnector,
|
|
133
138
|
});
|