@dynamic-labs/sdk-react-core 4.60.1 → 4.61.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +12 -12
  5. package/src/lib/utils/hooks/index.d.ts +2 -0
  6. package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +5 -4
  7. package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.d.ts +2 -2
  8. package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +5 -4
  9. package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.cjs +6 -1
  10. package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.js +6 -1
  11. package/src/lib/utils/hooks/useUserAuth/useUserAuth.cjs +12 -4
  12. package/src/lib/utils/hooks/useUserAuth/useUserAuth.js +12 -4
  13. package/src/lib/utils/hooks/useWalletPassword/index.d.ts +1 -0
  14. package/src/lib/utils/hooks/useWalletPassword/useWalletPassword.cjs +152 -0
  15. package/src/lib/utils/hooks/useWalletPassword/useWalletPassword.d.ts +30 -0
  16. package/src/lib/utils/hooks/useWalletPassword/useWalletPassword.js +148 -0
  17. package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +19 -9
  18. package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +19 -9
  19. package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/MfaSection/MfaSection.cjs +11 -14
  20. package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/MfaSection/MfaSection.js +11 -14
  21. package/src/lib/widgets/DynamicWidget/views/SetupPasswordView/SetupPasswordView.cjs +11 -3
  22. package/src/lib/widgets/DynamicWidget/views/SetupPasswordView/SetupPasswordView.js +11 -3
package/CHANGELOG.md CHANGED
@@ -1,4 +1,26 @@
1
1
 
2
+ ### [4.61.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.61.0...v4.61.1) (2026-02-11)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * remove warning when SVM gas sponsorship enabled ([#10412](https://github.com/dynamic-labs/dynamic-auth/issues/10412)) ([dc1a615](https://github.com/dynamic-labs/dynamic-auth/commit/dc1a615a43c89942c9b17101bb1da4492df8140b))
8
+
9
+ ## [4.61.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.60.1...v4.61.0) (2026-02-10)
10
+
11
+
12
+ ### Features
13
+
14
+ * add unlockWallet and getWalletRecoveryState to WaaS ([#10407](https://github.com/dynamic-labs/dynamic-auth/issues/10407)) ([e0d1a28](https://github.com/dynamic-labs/dynamic-auth/commit/e0d1a2830f36eee6c6e84737011e8cf59966122d))
15
+ * add useWalletPassword hook for waas wallet password management ([#10399](https://github.com/dynamic-labs/dynamic-auth/issues/10399)) ([508835f](https://github.com/dynamic-labs/dynamic-auth/commit/508835fb0f4f17b7353a4378f4c254e02f0a46ff))
16
+ * add WaaS unlock and recovery UI to mobile demo ([#10408](https://github.com/dynamic-labs/dynamic-auth/issues/10408)) ([94cdb88](https://github.com/dynamic-labs/dynamic-auth/commit/94cdb882fca3c34d157b42d5208f56812008c43b))
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * bump axios to fix high vulnerability ([#10406](https://github.com/dynamic-labs/dynamic-auth/issues/10406)) ([303e2dc](https://github.com/dynamic-labs/dynamic-auth/commit/303e2dcf1e7e8ecad4caf2d74e805ee427c1d00e))
22
+ * patch node-forge CVE-2025-12816 in global-wallet ([#10401](https://github.com/dynamic-labs/dynamic-auth/issues/10401)) ([46e6eb2](https://github.com/dynamic-labs/dynamic-auth/commit/46e6eb28a0add0052299eaa4ac2dcbe8b1faa98c))
23
+
2
24
  ### [4.60.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.60.0...v4.60.1) (2026-02-09)
3
25
 
4
26
 
package/package.cjs CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.60.1";
6
+ var version = "4.61.1";
7
7
  var dependencies = {
8
8
  "@dynamic-labs/sdk-api-core": "0.0.864",
9
9
  "@dynamic-labs-sdk/client": "0.8.0",
package/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client'
2
- var version = "4.60.1";
2
+ var version = "4.61.1";
3
3
  var dependencies = {
4
4
  "@dynamic-labs/sdk-api-core": "0.0.864",
5
5
  "@dynamic-labs-sdk/client": "0.8.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/sdk-react-core",
3
- "version": "4.60.1",
3
+ "version": "4.61.1",
4
4
  "dependencies": {
5
5
  "@dynamic-labs/sdk-api-core": "0.0.864",
6
6
  "@dynamic-labs-sdk/client": "0.8.0",
@@ -16,17 +16,17 @@
16
16
  "yup": "0.32.11",
17
17
  "react-international-phone": "4.5.0",
18
18
  "bs58": "5.0.0",
19
- "@dynamic-labs/assert-package-version": "4.60.1",
20
- "@dynamic-labs/iconic": "4.60.1",
21
- "@dynamic-labs/locale": "4.60.1",
22
- "@dynamic-labs/logger": "4.60.1",
23
- "@dynamic-labs/multi-wallet": "4.60.1",
24
- "@dynamic-labs/rpc-providers": "4.60.1",
25
- "@dynamic-labs/store": "4.60.1",
26
- "@dynamic-labs/types": "4.60.1",
27
- "@dynamic-labs/utils": "4.60.1",
28
- "@dynamic-labs/wallet-book": "4.60.1",
29
- "@dynamic-labs/wallet-connector-core": "4.60.1",
19
+ "@dynamic-labs/assert-package-version": "4.61.1",
20
+ "@dynamic-labs/iconic": "4.61.1",
21
+ "@dynamic-labs/locale": "4.61.1",
22
+ "@dynamic-labs/logger": "4.61.1",
23
+ "@dynamic-labs/multi-wallet": "4.61.1",
24
+ "@dynamic-labs/rpc-providers": "4.61.1",
25
+ "@dynamic-labs/store": "4.61.1",
26
+ "@dynamic-labs/types": "4.61.1",
27
+ "@dynamic-labs/utils": "4.61.1",
28
+ "@dynamic-labs/wallet-book": "4.61.1",
29
+ "@dynamic-labs/wallet-connector-core": "4.61.1",
30
30
  "eventemitter3": "5.0.1"
31
31
  },
32
32
  "devDependencies": {
@@ -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
108
  export { useGetWalletPassword } from './useGetWalletPassword';
@@ -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, getWalletPassword, svmGasSponsorshipEnabled = false, }) => {
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', ''));
@@ -147,7 +147,7 @@ const configWaasWalletConnector = ({ walletConnector, environmentId, apiBaseUrl,
147
147
  const isSolConnector = walletConnector.connectedChain === 'SOL';
148
148
  const supportsSponsorshipSetting = 'setSvmGasSponsorshipEnabled' in walletConnector;
149
149
  if (isSolConnector && supportsSponsorshipSetting) {
150
- walletConnector.setSvmGasSponsorshipEnabled(svmGasSponsorshipEnabled);
150
+ walletConnector.setSvmGasSponsorshipEnabled(getSvmGasSponsorshipEnabled);
151
151
  }
152
152
  return walletConnector;
153
153
  };
@@ -172,6 +172,8 @@ 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();
@@ -198,9 +200,9 @@ const useDynamicWaas = () => {
198
200
  environmentId,
199
201
  getMfaToken,
200
202
  getSignedSessionId,
203
+ getSvmGasSponsorshipEnabled: () => svmGasSponsorshipEnabledRef.current,
201
204
  getWalletPassword,
202
205
  relayUrl: relayUrl !== null && relayUrl !== void 0 ? relayUrl : '',
203
- svmGasSponsorshipEnabled,
204
206
  walletConnector,
205
207
  });
206
208
  return configuredWalletConnector;
@@ -215,7 +217,6 @@ const useDynamicWaas = () => {
215
217
  getSignedSessionId,
216
218
  relayUrl,
217
219
  baseClientKeysharesRelayApiUrl,
218
- svmGasSponsorshipEnabled,
219
220
  ]);
220
221
  const shouldInitializeWaas = React.useMemo(() => {
221
222
  var _a;
@@ -12,7 +12,7 @@ export type WalletCreationRequirement = {
12
12
  network?: string;
13
13
  };
14
14
  };
15
- export declare const configWaasWalletConnector: ({ walletConnector, environmentId, apiBaseUrl, relayUrl, baseClientKeysharesRelayApiUrl, authMode, getSignedSessionId, getMfaToken, getWalletPassword, svmGasSponsorshipEnabled, }: {
15
+ export declare const configWaasWalletConnector: ({ walletConnector, environmentId, apiBaseUrl, relayUrl, baseClientKeysharesRelayApiUrl, authMode, getSignedSessionId, getMfaToken, getWalletPassword, getSvmGasSponsorshipEnabled, }: {
16
16
  walletConnector: IDynamicWaasConnector;
17
17
  environmentId: string;
18
18
  apiBaseUrl: string;
@@ -24,7 +24,7 @@ export declare const configWaasWalletConnector: ({ walletConnector, environmentI
24
24
  mfaAction?: MFAAction;
25
25
  }) => Promise<string | undefined>;
26
26
  getWalletPassword?: GetWalletPasswordFn;
27
- svmGasSponsorshipEnabled?: boolean;
27
+ getSvmGasSponsorshipEnabled?: () => boolean;
28
28
  }) => IDynamicWaasConnector;
29
29
  export declare const useDynamicWaas: () => {
30
30
  areWalletsReadyForSettings: () => boolean;
@@ -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, getWalletPassword, svmGasSponsorshipEnabled = false, }) => {
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', ''));
@@ -143,7 +143,7 @@ const configWaasWalletConnector = ({ walletConnector, environmentId, apiBaseUrl,
143
143
  const isSolConnector = walletConnector.connectedChain === 'SOL';
144
144
  const supportsSponsorshipSetting = 'setSvmGasSponsorshipEnabled' in walletConnector;
145
145
  if (isSolConnector && supportsSponsorshipSetting) {
146
- walletConnector.setSvmGasSponsorshipEnabled(svmGasSponsorshipEnabled);
146
+ walletConnector.setSvmGasSponsorshipEnabled(getSvmGasSponsorshipEnabled);
147
147
  }
148
148
  return walletConnector;
149
149
  };
@@ -168,6 +168,8 @@ 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();
@@ -194,9 +196,9 @@ const useDynamicWaas = () => {
194
196
  environmentId,
195
197
  getMfaToken,
196
198
  getSignedSessionId,
199
+ getSvmGasSponsorshipEnabled: () => svmGasSponsorshipEnabledRef.current,
197
200
  getWalletPassword,
198
201
  relayUrl: relayUrl !== null && relayUrl !== void 0 ? relayUrl : '',
199
- svmGasSponsorshipEnabled,
200
202
  walletConnector,
201
203
  });
202
204
  return configuredWalletConnector;
@@ -211,7 +213,6 @@ const useDynamicWaas = () => {
211
213
  getSignedSessionId,
212
214
  relayUrl,
213
215
  baseClientKeysharesRelayApiUrl,
214
- svmGasSponsorshipEnabled,
215
216
  ]);
216
217
  const shouldInitializeWaas = useMemo(() => {
217
218
  var _a;
@@ -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');
@@ -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';
@@ -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
  });
@@ -31,6 +31,7 @@ require('../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
31
31
  require('../../functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.cjs');
32
32
  require('../../../events/dynamicEvents.cjs');
33
33
  var storeTokenAndUser = require('../../../client/extension/storeTokenAndUser/storeTokenAndUser.cjs');
34
+ var useProjectSettings = require('../../../client/extension/projectSettings/useProjectSettings/useProjectSettings.cjs');
34
35
  var AccessDeniedContext = require('../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
35
36
  var AccountExistsContext = require('../../../context/AccountExistsContext/AccountExistsContext.cjs');
36
37
  require('../../../context/DynamicContext/DynamicContext.cjs');
@@ -120,6 +121,7 @@ const useUserAuth = ({ authMethod, }) => {
120
121
  const { setExistentAccountData } = AccountExistsContext.useAccountExistsContext();
121
122
  const handleAuthenticatedUser = useHandleAuthenticatedUser.useHandleAuthenticatedUser();
122
123
  const { shouldAutoCreateEmbeddedWallet, shouldPromptForKeyExport, embeddedWalletSettingVersion, } = useEmbeddedWallet.useEmbeddedWallet();
124
+ const projectSettings = useProjectSettings.useProjectSettings();
123
125
  const isVerifyResponse = (response) => response.user;
124
126
  const cancelAuth = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
125
127
  logger.logger.debug('cancelAuth', { authMethod });
@@ -200,7 +202,7 @@ const useUserAuth = ({ authMethod, }) => {
200
202
  setExistentAccountData,
201
203
  ]);
202
204
  const initAuth = React.useCallback((_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ isSignIn = true, verifyFunction, onVerifySuccess, onSettled, onError, showSuccessMessage = false, skipDefaultErrorHandling = false, }) {
203
- var _b;
205
+ var _b, _c, _d;
204
206
  logger.logger.debug('initAuth', { authMethod, isSignIn });
205
207
  try {
206
208
  // TODO: change this logic to const verifiedUser = await verifyFunction();
@@ -244,7 +246,12 @@ const useUserAuth = ({ authMethod, }) => {
244
246
  setCallback('authSuccess');
245
247
  }
246
248
  const walletVersion = embeddedWalletSettingVersion();
247
- if (walletVersion === sdkApiCore.EmbeddedWalletVersionEnum.V1 &&
249
+ const shouldKeepAuthFlowOpenForPasswordSetup = walletVersion === sdkApiCore.EmbeddedWalletVersionEnum.V3 &&
250
+ Boolean((_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.passcodeRequired);
251
+ if (shouldKeepAuthFlowOpenForPasswordSetup) {
252
+ // Keep auth flow open so setup-password can be shown (useSyncDynamicWaas)
253
+ }
254
+ else if (walletVersion === sdkApiCore.EmbeddedWalletVersionEnum.V1 &&
248
255
  shouldCreateWallet) {
249
256
  setShowAuthFlow(true);
250
257
  }
@@ -271,6 +278,7 @@ const useUserAuth = ({ authMethod, }) => {
271
278
  embeddedWalletSettingVersion,
272
279
  handleAuthError,
273
280
  handleAuthenticatedUser,
281
+ projectSettings,
274
282
  setCallback,
275
283
  setLoading,
276
284
  setMultiWalletWidgetState,
@@ -279,7 +287,7 @@ const useUserAuth = ({ authMethod, }) => {
279
287
  shouldPromptForKeyExport,
280
288
  walletConnectorOptions,
281
289
  ]);
282
- const handleVerifyMissingFields = React.useCallback((_c) => _tslib.__awaiter(void 0, [_c], void 0, function* ({ missingFields, isEmailVerificationRequired, isSmsVerificationRequired, }) {
290
+ const handleVerifyMissingFields = React.useCallback((_e) => _tslib.__awaiter(void 0, [_e], void 0, function* ({ missingFields, isEmailVerificationRequired, isSmsVerificationRequired, }) {
283
291
  if (isEmailVerificationRequired &&
284
292
  missingFields.find((field) => field.name === 'email')) {
285
293
  pushView('verify-email');
@@ -292,7 +300,7 @@ const useUserAuth = ({ authMethod, }) => {
292
300
  }
293
301
  pushView(view.type);
294
302
  }), [pushView, view === null || view === void 0 ? void 0 : view.type]);
295
- const completeAuth = React.useCallback((_d) => _tslib.__awaiter(void 0, [_d], void 0, function* ({ completeSignInFlow, updateJwtFunction, onValidUpdatedJwt, options = {}, }) {
303
+ const completeAuth = React.useCallback((_f) => _tslib.__awaiter(void 0, [_f], void 0, function* ({ completeSignInFlow, updateJwtFunction, onValidUpdatedJwt, options = {}, }) {
296
304
  logger.logger.debug('completeAuth', { authMethod });
297
305
  try {
298
306
  const { updateUserProfileResponse, isSmsVerificationRequired, isEmailVerificationRequired, missingFields, } = yield updateJwtFunction();
@@ -27,6 +27,7 @@ import '../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
27
27
  import '../../functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.js';
28
28
  import '../../../events/dynamicEvents.js';
29
29
  import { storeTokenAndUser } from '../../../client/extension/storeTokenAndUser/storeTokenAndUser.js';
30
+ import { useProjectSettings } from '../../../client/extension/projectSettings/useProjectSettings/useProjectSettings.js';
30
31
  import { useAccessDeniedContext } from '../../../context/AccessDeniedContext/AccessDeniedContext.js';
31
32
  import { useAccountExistsContext } from '../../../context/AccountExistsContext/AccountExistsContext.js';
32
33
  import '../../../context/DynamicContext/DynamicContext.js';
@@ -116,6 +117,7 @@ const useUserAuth = ({ authMethod, }) => {
116
117
  const { setExistentAccountData } = useAccountExistsContext();
117
118
  const handleAuthenticatedUser = useHandleAuthenticatedUser();
118
119
  const { shouldAutoCreateEmbeddedWallet, shouldPromptForKeyExport, embeddedWalletSettingVersion, } = useEmbeddedWallet();
120
+ const projectSettings = useProjectSettings();
119
121
  const isVerifyResponse = (response) => response.user;
120
122
  const cancelAuth = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
121
123
  logger.debug('cancelAuth', { authMethod });
@@ -196,7 +198,7 @@ const useUserAuth = ({ authMethod, }) => {
196
198
  setExistentAccountData,
197
199
  ]);
198
200
  const initAuth = useCallback((_a) => __awaiter(void 0, [_a], void 0, function* ({ isSignIn = true, verifyFunction, onVerifySuccess, onSettled, onError, showSuccessMessage = false, skipDefaultErrorHandling = false, }) {
199
- var _b;
201
+ var _b, _c, _d;
200
202
  logger.debug('initAuth', { authMethod, isSignIn });
201
203
  try {
202
204
  // TODO: change this logic to const verifiedUser = await verifyFunction();
@@ -240,7 +242,12 @@ const useUserAuth = ({ authMethod, }) => {
240
242
  setCallback('authSuccess');
241
243
  }
242
244
  const walletVersion = embeddedWalletSettingVersion();
243
- if (walletVersion === EmbeddedWalletVersionEnum.V1 &&
245
+ const shouldKeepAuthFlowOpenForPasswordSetup = walletVersion === EmbeddedWalletVersionEnum.V3 &&
246
+ Boolean((_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.passcodeRequired);
247
+ if (shouldKeepAuthFlowOpenForPasswordSetup) {
248
+ // Keep auth flow open so setup-password can be shown (useSyncDynamicWaas)
249
+ }
250
+ else if (walletVersion === EmbeddedWalletVersionEnum.V1 &&
244
251
  shouldCreateWallet) {
245
252
  setShowAuthFlow(true);
246
253
  }
@@ -267,6 +274,7 @@ const useUserAuth = ({ authMethod, }) => {
267
274
  embeddedWalletSettingVersion,
268
275
  handleAuthError,
269
276
  handleAuthenticatedUser,
277
+ projectSettings,
270
278
  setCallback,
271
279
  setLoading,
272
280
  setMultiWalletWidgetState,
@@ -275,7 +283,7 @@ const useUserAuth = ({ authMethod, }) => {
275
283
  shouldPromptForKeyExport,
276
284
  walletConnectorOptions,
277
285
  ]);
278
- const handleVerifyMissingFields = useCallback((_c) => __awaiter(void 0, [_c], void 0, function* ({ missingFields, isEmailVerificationRequired, isSmsVerificationRequired, }) {
286
+ const handleVerifyMissingFields = useCallback((_e) => __awaiter(void 0, [_e], void 0, function* ({ missingFields, isEmailVerificationRequired, isSmsVerificationRequired, }) {
279
287
  if (isEmailVerificationRequired &&
280
288
  missingFields.find((field) => field.name === 'email')) {
281
289
  pushView('verify-email');
@@ -288,7 +296,7 @@ const useUserAuth = ({ authMethod, }) => {
288
296
  }
289
297
  pushView(view.type);
290
298
  }), [pushView, view === null || view === void 0 ? void 0 : view.type]);
291
- const completeAuth = useCallback((_d) => __awaiter(void 0, [_d], void 0, function* ({ completeSignInFlow, updateJwtFunction, onValidUpdatedJwt, options = {}, }) {
299
+ const completeAuth = useCallback((_f) => __awaiter(void 0, [_f], void 0, function* ({ completeSignInFlow, updateJwtFunction, onValidUpdatedJwt, options = {}, }) {
292
300
  logger.debug('completeAuth', { authMethod });
293
301
  try {
294
302
  const { updateUserProfileResponse, isSmsVerificationRequired, isEmailVerificationRequired, missingFields, } = yield updateJwtFunction();
@@ -0,0 +1 @@
1
+ export * from './useWalletPassword';
@@ -0,0 +1,152 @@
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
+ var dynamicEvents = require('../../../events/dynamicEvents.cjs');
9
+ require('@dynamic-labs/iconic');
10
+ require('@dynamic-labs/wallet-connector-core');
11
+ require('react/jsx-runtime');
12
+ require('../../../context/ViewContext/ViewContext.cjs');
13
+ var logger = require('../../../shared/logger.cjs');
14
+ require('@dynamic-labs/wallet-book');
15
+ require('@dynamic-labs/utils');
16
+ require('../../constants/colors.cjs');
17
+ require('../../constants/values.cjs');
18
+ require('@dynamic-labs/sdk-api-core');
19
+ require('../../../shared/consts/index.cjs');
20
+ var useDynamicWaas = require('../useDynamicWaas/useDynamicWaas.cjs');
21
+
22
+ const INITIAL_STATE = {
23
+ error: null,
24
+ isLoading: false,
25
+ recoveryState: null,
26
+ };
27
+ const useWalletPassword = () => {
28
+ const { getWaasWalletConnector } = useDynamicWaas.useDynamicWaas();
29
+ const [state, setState] = React.useState(INITIAL_STATE);
30
+ const resetState = React.useCallback(() => {
31
+ setState(INITIAL_STATE);
32
+ }, []);
33
+ const updatePassword = React.useCallback((params) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
34
+ const { accountAddress, chainName, newPassword, existingPassword } = params;
35
+ setState((prev) => (Object.assign(Object.assign({}, prev), { error: null, isLoading: true })));
36
+ try {
37
+ const connector = getWaasWalletConnector(chainName);
38
+ if (!connector) {
39
+ const errorMessage = 'Wallet connector not found';
40
+ setState((prev) => (Object.assign(Object.assign({}, prev), { error: errorMessage, isLoading: false })));
41
+ logger.logger.error(errorMessage, { accountAddress, chainName });
42
+ return false;
43
+ }
44
+ yield connector.updatePassword({
45
+ accountAddress,
46
+ existingPassword,
47
+ newPassword,
48
+ });
49
+ setState((prev) => (Object.assign(Object.assign({}, prev), { error: null, isLoading: false })));
50
+ return true;
51
+ }
52
+ catch (error) {
53
+ const errorMessage = error instanceof Error ? error.message : 'Failed to update password';
54
+ setState((prev) => (Object.assign(Object.assign({}, prev), { error: errorMessage, isLoading: false })));
55
+ logger.logger.error('Failed to update wallet password', {
56
+ accountAddress,
57
+ chainName,
58
+ error,
59
+ });
60
+ return false;
61
+ }
62
+ }), [getWaasWalletConnector]);
63
+ const unlockWallet = React.useCallback((params) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
64
+ const { accountAddress, chainName, password } = params;
65
+ setState((prev) => (Object.assign(Object.assign({}, prev), { error: null, isLoading: true })));
66
+ try {
67
+ const connector = getWaasWalletConnector(chainName);
68
+ if (!connector) {
69
+ const errorMessage = 'Wallet connector not found';
70
+ setState((prev) => (Object.assign(Object.assign({}, prev), { error: errorMessage, isLoading: false })));
71
+ logger.logger.error(errorMessage, { accountAddress, chainName });
72
+ return false;
73
+ }
74
+ dynamicEvents.dynamicEvents.emit('walletUnlockAttempt', {
75
+ accountAddress,
76
+ chainName,
77
+ });
78
+ yield connector.unlockWallet({
79
+ accountAddress,
80
+ password,
81
+ });
82
+ setState((prev) => (Object.assign(Object.assign({}, prev), { error: null, isLoading: false })));
83
+ dynamicEvents.dynamicEvents.emit('walletUnlockCompleted', {
84
+ accountAddress,
85
+ chainName,
86
+ });
87
+ return true;
88
+ }
89
+ catch (error) {
90
+ const errorMessage = error instanceof Error ? error.message : 'Failed to unlock wallet';
91
+ setState((prev) => (Object.assign(Object.assign({}, prev), { error: errorMessage, isLoading: false })));
92
+ logger.logger.error('Failed to unlock wallet', {
93
+ accountAddress,
94
+ chainName,
95
+ error,
96
+ });
97
+ dynamicEvents.dynamicEvents.emit('walletUnlockFailed', {
98
+ accountAddress,
99
+ chainName,
100
+ error,
101
+ });
102
+ return false;
103
+ }
104
+ }), [getWaasWalletConnector]);
105
+ const checkWalletLockState = React.useCallback((params) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
106
+ const { accountAddress, chainName } = params;
107
+ setState((prev) => (Object.assign(Object.assign({}, prev), { error: null, isLoading: true })));
108
+ try {
109
+ const connector = getWaasWalletConnector(chainName);
110
+ if (!connector) {
111
+ const errorMessage = 'Wallet connector not found';
112
+ setState((prev) => (Object.assign(Object.assign({}, prev), { error: errorMessage, isLoading: false })));
113
+ logger.logger.error(errorMessage, { accountAddress, chainName });
114
+ return null;
115
+ }
116
+ const recoveryState = yield connector.getWalletRecoveryState({
117
+ accountAddress,
118
+ });
119
+ setState({
120
+ error: null,
121
+ isLoading: false,
122
+ recoveryState,
123
+ });
124
+ return recoveryState;
125
+ }
126
+ catch (error) {
127
+ const errorMessage = error instanceof Error
128
+ ? error.message
129
+ : 'Failed to check wallet state';
130
+ setState({
131
+ error: errorMessage,
132
+ isLoading: false,
133
+ recoveryState: null,
134
+ });
135
+ logger.logger.error('Failed to check wallet lock state', {
136
+ accountAddress,
137
+ chainName,
138
+ error,
139
+ });
140
+ return null;
141
+ }
142
+ }), [getWaasWalletConnector]);
143
+ return {
144
+ checkWalletLockState,
145
+ resetState,
146
+ state,
147
+ unlockWallet,
148
+ updatePassword,
149
+ };
150
+ };
151
+
152
+ exports.useWalletPassword = useWalletPassword;
@@ -0,0 +1,30 @@
1
+ import { WalletRecoveryState } from '@dynamic-labs-wallet/browser-wallet-client';
2
+ import { ChainEnum } from '@dynamic-labs/sdk-api-core';
3
+ export type UpdatePasswordParams = {
4
+ accountAddress: string;
5
+ chainName: ChainEnum;
6
+ newPassword: string;
7
+ existingPassword?: string;
8
+ };
9
+ export type UnlockWalletParams = {
10
+ accountAddress: string;
11
+ chainName: ChainEnum;
12
+ password: string;
13
+ };
14
+ export type CheckWalletLockStateParams = {
15
+ accountAddress: string;
16
+ chainName: ChainEnum;
17
+ };
18
+ export type WalletPasswordState = {
19
+ isLoading: boolean;
20
+ error: string | null;
21
+ recoveryState: WalletRecoveryState | null;
22
+ };
23
+ export type UseWalletPasswordReturn = {
24
+ updatePassword: (params: UpdatePasswordParams) => Promise<boolean>;
25
+ unlockWallet: (params: UnlockWalletParams) => Promise<boolean>;
26
+ checkWalletLockState: (params: CheckWalletLockStateParams) => Promise<WalletRecoveryState | null>;
27
+ state: WalletPasswordState;
28
+ resetState: () => void;
29
+ };
30
+ export declare const useWalletPassword: () => UseWalletPasswordReturn;
@@ -0,0 +1,148 @@
1
+ 'use client'
2
+ import { __awaiter } from '../../../../../_virtual/_tslib.js';
3
+ import { useState, useCallback } from 'react';
4
+ import { dynamicEvents } from '../../../events/dynamicEvents.js';
5
+ import '@dynamic-labs/iconic';
6
+ import '@dynamic-labs/wallet-connector-core';
7
+ import 'react/jsx-runtime';
8
+ import '../../../context/ViewContext/ViewContext.js';
9
+ import { logger } from '../../../shared/logger.js';
10
+ import '@dynamic-labs/wallet-book';
11
+ import '@dynamic-labs/utils';
12
+ import '../../constants/colors.js';
13
+ import '../../constants/values.js';
14
+ import '@dynamic-labs/sdk-api-core';
15
+ import '../../../shared/consts/index.js';
16
+ import { useDynamicWaas } from '../useDynamicWaas/useDynamicWaas.js';
17
+
18
+ const INITIAL_STATE = {
19
+ error: null,
20
+ isLoading: false,
21
+ recoveryState: null,
22
+ };
23
+ const useWalletPassword = () => {
24
+ const { getWaasWalletConnector } = useDynamicWaas();
25
+ const [state, setState] = useState(INITIAL_STATE);
26
+ const resetState = useCallback(() => {
27
+ setState(INITIAL_STATE);
28
+ }, []);
29
+ const updatePassword = useCallback((params) => __awaiter(void 0, void 0, void 0, function* () {
30
+ const { accountAddress, chainName, newPassword, existingPassword } = params;
31
+ setState((prev) => (Object.assign(Object.assign({}, prev), { error: null, isLoading: true })));
32
+ try {
33
+ const connector = getWaasWalletConnector(chainName);
34
+ if (!connector) {
35
+ const errorMessage = 'Wallet connector not found';
36
+ setState((prev) => (Object.assign(Object.assign({}, prev), { error: errorMessage, isLoading: false })));
37
+ logger.error(errorMessage, { accountAddress, chainName });
38
+ return false;
39
+ }
40
+ yield connector.updatePassword({
41
+ accountAddress,
42
+ existingPassword,
43
+ newPassword,
44
+ });
45
+ setState((prev) => (Object.assign(Object.assign({}, prev), { error: null, isLoading: false })));
46
+ return true;
47
+ }
48
+ catch (error) {
49
+ const errorMessage = error instanceof Error ? error.message : 'Failed to update password';
50
+ setState((prev) => (Object.assign(Object.assign({}, prev), { error: errorMessage, isLoading: false })));
51
+ logger.error('Failed to update wallet password', {
52
+ accountAddress,
53
+ chainName,
54
+ error,
55
+ });
56
+ return false;
57
+ }
58
+ }), [getWaasWalletConnector]);
59
+ const unlockWallet = useCallback((params) => __awaiter(void 0, void 0, void 0, function* () {
60
+ const { accountAddress, chainName, password } = params;
61
+ setState((prev) => (Object.assign(Object.assign({}, prev), { error: null, isLoading: true })));
62
+ try {
63
+ const connector = getWaasWalletConnector(chainName);
64
+ if (!connector) {
65
+ const errorMessage = 'Wallet connector not found';
66
+ setState((prev) => (Object.assign(Object.assign({}, prev), { error: errorMessage, isLoading: false })));
67
+ logger.error(errorMessage, { accountAddress, chainName });
68
+ return false;
69
+ }
70
+ dynamicEvents.emit('walletUnlockAttempt', {
71
+ accountAddress,
72
+ chainName,
73
+ });
74
+ yield connector.unlockWallet({
75
+ accountAddress,
76
+ password,
77
+ });
78
+ setState((prev) => (Object.assign(Object.assign({}, prev), { error: null, isLoading: false })));
79
+ dynamicEvents.emit('walletUnlockCompleted', {
80
+ accountAddress,
81
+ chainName,
82
+ });
83
+ return true;
84
+ }
85
+ catch (error) {
86
+ const errorMessage = error instanceof Error ? error.message : 'Failed to unlock wallet';
87
+ setState((prev) => (Object.assign(Object.assign({}, prev), { error: errorMessage, isLoading: false })));
88
+ logger.error('Failed to unlock wallet', {
89
+ accountAddress,
90
+ chainName,
91
+ error,
92
+ });
93
+ dynamicEvents.emit('walletUnlockFailed', {
94
+ accountAddress,
95
+ chainName,
96
+ error,
97
+ });
98
+ return false;
99
+ }
100
+ }), [getWaasWalletConnector]);
101
+ const checkWalletLockState = useCallback((params) => __awaiter(void 0, void 0, void 0, function* () {
102
+ const { accountAddress, chainName } = params;
103
+ setState((prev) => (Object.assign(Object.assign({}, prev), { error: null, isLoading: true })));
104
+ try {
105
+ const connector = getWaasWalletConnector(chainName);
106
+ if (!connector) {
107
+ const errorMessage = 'Wallet connector not found';
108
+ setState((prev) => (Object.assign(Object.assign({}, prev), { error: errorMessage, isLoading: false })));
109
+ logger.error(errorMessage, { accountAddress, chainName });
110
+ return null;
111
+ }
112
+ const recoveryState = yield connector.getWalletRecoveryState({
113
+ accountAddress,
114
+ });
115
+ setState({
116
+ error: null,
117
+ isLoading: false,
118
+ recoveryState,
119
+ });
120
+ return recoveryState;
121
+ }
122
+ catch (error) {
123
+ const errorMessage = error instanceof Error
124
+ ? error.message
125
+ : 'Failed to check wallet state';
126
+ setState({
127
+ error: errorMessage,
128
+ isLoading: false,
129
+ recoveryState: null,
130
+ });
131
+ logger.error('Failed to check wallet lock state', {
132
+ accountAddress,
133
+ chainName,
134
+ error,
135
+ });
136
+ return null;
137
+ }
138
+ }), [getWaasWalletConnector]);
139
+ return {
140
+ checkWalletLockState,
141
+ resetState,
142
+ state,
143
+ unlockWallet,
144
+ updatePassword,
145
+ };
146
+ };
147
+
148
+ export { useWalletPassword };
@@ -30,6 +30,7 @@ require('@dynamic-labs-sdk/client/core');
30
30
  require('../../client/client.cjs');
31
31
  require('@dynamic-labs-sdk/client');
32
32
  require('../../config/ApiEndpoint.cjs');
33
+ var useProjectSettings = require('../../client/extension/projectSettings/useProjectSettings/useProjectSettings.cjs');
33
34
  require('@dynamic-labs/locale');
34
35
  var blockaid = require('../../data/api/transactions/blockaid.cjs');
35
36
  require('../../store/state/dynamicContextProps/dynamicContextProps.cjs');
@@ -129,7 +130,10 @@ var SimulationStatus;
129
130
  SimulationStatus["SUCCESS"] = "success";
130
131
  })(SimulationStatus || (SimulationStatus = {}));
131
132
  const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation, onClickBack, walletConnector, onClickClose, title, displayPoweredByDynamicFooter = false, copykey, hideModal, currentToken, isNativeToken, transactionValue, isModal, sendBalanceTransaction, }) => {
133
+ var _a, _b, _c;
132
134
  const { primaryWallet, environmentId } = useInternalDynamicContext.useInternalDynamicContext();
135
+ const projectSettings = useProjectSettings.useProjectSettings();
136
+ 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;
133
137
  const [isGasSponsored, setIsGasSponsored] = React.useState(false);
134
138
  const [isGasSponsoredLoading, setIsGasSponsoredLoading] = React.useState(false);
135
139
  const update = useForceUpdate.useForceUpdate();
@@ -149,7 +153,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
149
153
  const [recipient, setRecipient] = React.useState(undefined);
150
154
  const isFetchingSimulationRef = React.useRef(false);
151
155
  const fetchSimulationResult = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
152
- var _a, _b, _c, _d, _e, _f, _g;
156
+ var _d, _e, _f, _g, _h, _j, _k;
153
157
  if (simulationState.status !== SimulationStatus.LOADING) {
154
158
  return;
155
159
  }
@@ -187,19 +191,19 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
187
191
  const formattedUserOperation = yield connector.formatUserOperation(userOperation);
188
192
  // Set the gas fee on the transaction, only for zero dev
189
193
  transaction.fee.gas = calculateGasUnits(userOperation);
190
- const entryPoint = yield ((_a = connector.getAccountAbstractionProvider()) === null || _a === void 0 ? void 0 : _a.account.entryPoint);
194
+ const entryPoint = yield ((_d = connector.getAccountAbstractionProvider()) === null || _d === void 0 ? void 0 : _d.account.entryPoint);
191
195
  if (!entryPoint) {
192
196
  logger.logger.error('[TransactionConfirmationView] Simulation failed: No entry point address found');
193
197
  setSimulationState({ status: SimulationStatus.FAILED });
194
198
  return;
195
199
  }
196
- setRecipient((_b = transaction === null || transaction === void 0 ? void 0 : transaction.getTransactionRecipient) === null || _b === void 0 ? void 0 : _b.call(transaction));
200
+ setRecipient((_e = transaction === null || transaction === void 0 ? void 0 : transaction.getTransactionRecipient) === null || _e === void 0 ? void 0 : _e.call(transaction));
197
201
  result = yield blockaid.simulateBlockaidUserOperation({
198
202
  chainId: String(chainId),
199
203
  entryPoint,
200
204
  environmentId,
201
205
  userOperation: formattedUserOperation,
202
- value: ((_c = transaction.value) === null || _c === void 0 ? void 0 : _c.toString()) || '0',
206
+ value: ((_f = transaction.value) === null || _f === void 0 ? void 0 : _f.toString()) || '0',
203
207
  });
204
208
  }
205
209
  else {
@@ -210,7 +214,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
210
214
  else {
211
215
  // Handle SOLANA
212
216
  if ((walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.connectedChain) === 'SOL') {
213
- const encodedTransactions = (_d = transaction.multipleTransactions) === null || _d === void 0 ? void 0 : _d.map((tx) => bs58__default["default"].encode(tx.serialize({ requireAllSignatures: false })));
217
+ const encodedTransactions = (_g = transaction.multipleTransactions) === null || _g === void 0 ? void 0 : _g.map((tx) => bs58__default["default"].encode(tx.serialize({ requireAllSignatures: false })));
214
218
  if (!encodedTransactions) {
215
219
  logger.logger.error('[TransactionConfirmationView] Simulation failed: No encoded transactions');
216
220
  setSimulationState({ status: SimulationStatus.FAILED });
@@ -224,7 +228,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
224
228
  });
225
229
  }
226
230
  else if ((walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.connectedChain) === 'EVM') {
227
- setRecipient((_e = transaction === null || transaction === void 0 ? void 0 : transaction.getTransactionRecipient) === null || _e === void 0 ? void 0 : _e.call(transaction));
231
+ setRecipient((_h = transaction === null || transaction === void 0 ? void 0 : transaction.getTransactionRecipient) === null || _h === void 0 ? void 0 : _h.call(transaction));
228
232
  // EVM
229
233
  result = yield blockaid.simulateBlockaidEVMTransaction({
230
234
  chainId: String(chainId),
@@ -232,7 +236,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
232
236
  environmentId,
233
237
  from: transaction.from,
234
238
  to: transaction.to || '',
235
- value: ((_f = transaction.value) === null || _f === void 0 ? void 0 : _f.toString()) || '0',
239
+ value: ((_j = transaction.value) === null || _j === void 0 ? void 0 : _j.toString()) || '0',
236
240
  });
237
241
  }
238
242
  else if ((walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.connectedChain) === 'TON') {
@@ -240,7 +244,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
240
244
  return;
241
245
  }
242
246
  }
243
- if (!result && ((_g = primaryWallet.connector) === null || _g === void 0 ? void 0 : _g.key) !== 'zerodev') {
247
+ if (!result && ((_k = primaryWallet.connector) === null || _k === void 0 ? void 0 : _k.key) !== 'zerodev') {
244
248
  logger.logger.warn('[TransactionConfirmationView] Simulation failed: No result');
245
249
  setSimulationState({ status: SimulationStatus.FAILED });
246
250
  return;
@@ -293,13 +297,19 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
293
297
  }
294
298
  }, [primaryWallet, transaction, update]);
295
299
  React.useEffect(() => {
300
+ // If SVM gas sponsorship is enabled in project settings, treat as sponsored
301
+ // before the fee payer is actually replaced (which happens at send time)
302
+ if (svmGasSponsorshipEnabled && (walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.connectedChain) === 'SOL') {
303
+ setIsGasSponsored(true);
304
+ return;
305
+ }
296
306
  // Solana gas sponsorship check
297
307
  // Only set for transactions that implement isGasSponsored (Solana)
298
308
  // ZeroDev/EVM transactions handle sponsorship via fetchSimulationResult
299
309
  if (transaction.isGasSponsored) {
300
310
  setIsGasSponsored(transaction.isGasSponsored());
301
311
  }
302
- }, [transaction]);
312
+ }, [transaction, svmGasSponsorshipEnabled, walletConnector]);
303
313
  const { mutate: send, isLoading, error: transactionError, } = useMutation.useMutation(mutation, {
304
314
  onFailure: React.useCallback((error) => {
305
315
  fetchTransactionFee();
@@ -26,6 +26,7 @@ import '@dynamic-labs-sdk/client/core';
26
26
  import '../../client/client.js';
27
27
  import '@dynamic-labs-sdk/client';
28
28
  import '../../config/ApiEndpoint.js';
29
+ import { useProjectSettings } from '../../client/extension/projectSettings/useProjectSettings/useProjectSettings.js';
29
30
  import '@dynamic-labs/locale';
30
31
  import { simulateBlockaidUserOperation, simulateBlockaidSVMTransaction, simulateBlockaidEVMTransaction } from '../../data/api/transactions/blockaid.js';
31
32
  import '../../store/state/dynamicContextProps/dynamicContextProps.js';
@@ -121,7 +122,10 @@ var SimulationStatus;
121
122
  SimulationStatus["SUCCESS"] = "success";
122
123
  })(SimulationStatus || (SimulationStatus = {}));
123
124
  const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation, onClickBack, walletConnector, onClickClose, title, displayPoweredByDynamicFooter = false, copykey, hideModal, currentToken, isNativeToken, transactionValue, isModal, sendBalanceTransaction, }) => {
125
+ var _a, _b, _c;
124
126
  const { primaryWallet, environmentId } = useInternalDynamicContext();
127
+ const projectSettings = useProjectSettings();
128
+ 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;
125
129
  const [isGasSponsored, setIsGasSponsored] = useState(false);
126
130
  const [isGasSponsoredLoading, setIsGasSponsoredLoading] = useState(false);
127
131
  const update = useForceUpdate();
@@ -141,7 +145,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
141
145
  const [recipient, setRecipient] = useState(undefined);
142
146
  const isFetchingSimulationRef = useRef(false);
143
147
  const fetchSimulationResult = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
144
- var _a, _b, _c, _d, _e, _f, _g;
148
+ var _d, _e, _f, _g, _h, _j, _k;
145
149
  if (simulationState.status !== SimulationStatus.LOADING) {
146
150
  return;
147
151
  }
@@ -179,19 +183,19 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
179
183
  const formattedUserOperation = yield connector.formatUserOperation(userOperation);
180
184
  // Set the gas fee on the transaction, only for zero dev
181
185
  transaction.fee.gas = calculateGasUnits(userOperation);
182
- const entryPoint = yield ((_a = connector.getAccountAbstractionProvider()) === null || _a === void 0 ? void 0 : _a.account.entryPoint);
186
+ const entryPoint = yield ((_d = connector.getAccountAbstractionProvider()) === null || _d === void 0 ? void 0 : _d.account.entryPoint);
183
187
  if (!entryPoint) {
184
188
  logger.error('[TransactionConfirmationView] Simulation failed: No entry point address found');
185
189
  setSimulationState({ status: SimulationStatus.FAILED });
186
190
  return;
187
191
  }
188
- setRecipient((_b = transaction === null || transaction === void 0 ? void 0 : transaction.getTransactionRecipient) === null || _b === void 0 ? void 0 : _b.call(transaction));
192
+ setRecipient((_e = transaction === null || transaction === void 0 ? void 0 : transaction.getTransactionRecipient) === null || _e === void 0 ? void 0 : _e.call(transaction));
189
193
  result = yield simulateBlockaidUserOperation({
190
194
  chainId: String(chainId),
191
195
  entryPoint,
192
196
  environmentId,
193
197
  userOperation: formattedUserOperation,
194
- value: ((_c = transaction.value) === null || _c === void 0 ? void 0 : _c.toString()) || '0',
198
+ value: ((_f = transaction.value) === null || _f === void 0 ? void 0 : _f.toString()) || '0',
195
199
  });
196
200
  }
197
201
  else {
@@ -202,7 +206,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
202
206
  else {
203
207
  // Handle SOLANA
204
208
  if ((walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.connectedChain) === 'SOL') {
205
- const encodedTransactions = (_d = transaction.multipleTransactions) === null || _d === void 0 ? void 0 : _d.map((tx) => bs58.encode(tx.serialize({ requireAllSignatures: false })));
209
+ const encodedTransactions = (_g = transaction.multipleTransactions) === null || _g === void 0 ? void 0 : _g.map((tx) => bs58.encode(tx.serialize({ requireAllSignatures: false })));
206
210
  if (!encodedTransactions) {
207
211
  logger.error('[TransactionConfirmationView] Simulation failed: No encoded transactions');
208
212
  setSimulationState({ status: SimulationStatus.FAILED });
@@ -216,7 +220,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
216
220
  });
217
221
  }
218
222
  else if ((walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.connectedChain) === 'EVM') {
219
- setRecipient((_e = transaction === null || transaction === void 0 ? void 0 : transaction.getTransactionRecipient) === null || _e === void 0 ? void 0 : _e.call(transaction));
223
+ setRecipient((_h = transaction === null || transaction === void 0 ? void 0 : transaction.getTransactionRecipient) === null || _h === void 0 ? void 0 : _h.call(transaction));
220
224
  // EVM
221
225
  result = yield simulateBlockaidEVMTransaction({
222
226
  chainId: String(chainId),
@@ -224,7 +228,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
224
228
  environmentId,
225
229
  from: transaction.from,
226
230
  to: transaction.to || '',
227
- value: ((_f = transaction.value) === null || _f === void 0 ? void 0 : _f.toString()) || '0',
231
+ value: ((_j = transaction.value) === null || _j === void 0 ? void 0 : _j.toString()) || '0',
228
232
  });
229
233
  }
230
234
  else if ((walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.connectedChain) === 'TON') {
@@ -232,7 +236,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
232
236
  return;
233
237
  }
234
238
  }
235
- if (!result && ((_g = primaryWallet.connector) === null || _g === void 0 ? void 0 : _g.key) !== 'zerodev') {
239
+ if (!result && ((_k = primaryWallet.connector) === null || _k === void 0 ? void 0 : _k.key) !== 'zerodev') {
236
240
  logger.warn('[TransactionConfirmationView] Simulation failed: No result');
237
241
  setSimulationState({ status: SimulationStatus.FAILED });
238
242
  return;
@@ -285,13 +289,19 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
285
289
  }
286
290
  }, [primaryWallet, transaction, update]);
287
291
  useEffect(() => {
292
+ // If SVM gas sponsorship is enabled in project settings, treat as sponsored
293
+ // before the fee payer is actually replaced (which happens at send time)
294
+ if (svmGasSponsorshipEnabled && (walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.connectedChain) === 'SOL') {
295
+ setIsGasSponsored(true);
296
+ return;
297
+ }
288
298
  // Solana gas sponsorship check
289
299
  // Only set for transactions that implement isGasSponsored (Solana)
290
300
  // ZeroDev/EVM transactions handle sponsorship via fetchSimulationResult
291
301
  if (transaction.isGasSponsored) {
292
302
  setIsGasSponsored(transaction.isGasSponsored());
293
303
  }
294
- }, [transaction]);
304
+ }, [transaction, svmGasSponsorshipEnabled, walletConnector]);
295
305
  const { mutate: send, isLoading, error: transactionError, } = useMutation(mutation, {
296
306
  onFailure: useCallback((error) => {
297
307
  fetchTransactionFee();
@@ -114,6 +114,7 @@ require('../../../../../store/state/tokenBalances.cjs');
114
114
  require('../../../../../store/state/multichainBalances.cjs');
115
115
  require('../../../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
116
116
  var useIsPasskeysMfaEnabled = require('../../../../../utils/hooks/useIsPasskeysMfaEnabled/useIsPasskeysMfaEnabled.cjs');
117
+ var useWalletPassword = require('../../../../../utils/hooks/useWalletPassword/useWalletPassword.cjs');
117
118
  var useInternalDynamicContext = require('../../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
118
119
 
119
120
  const MfaSection = ({ isLoading }) => {
@@ -123,6 +124,7 @@ const MfaSection = ({ isLoading }) => {
123
124
  const { primaryWallet } = useInternalDynamicContext.useInternalDynamicContext();
124
125
  const { getEOAWallet } = useSmartWallets.useSmartWallets();
125
126
  const projectSettings = useProjectSettings.useProjectSettings();
127
+ const { updatePassword } = useWalletPassword.useWalletPassword();
126
128
  const isMfaEnabled = useIsMfaEnabled.useIsMfaEnabled();
127
129
  const isTotpMfaEnabled = useIsTotpMfaEnabled.useIsTotpMfaEnabled();
128
130
  const isPasskeyMfaEnabled = useIsPasskeysMfaEnabled.useIsPasskeysMfaEnabled();
@@ -136,24 +138,19 @@ const MfaSection = ({ isLoading }) => {
136
138
  const handlePasscodeClick = React.useCallback(() => {
137
139
  setDynamicWidgetView('setup-password', {
138
140
  onComplete: (password) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
139
- if (!(wallet === null || wallet === void 0 ? void 0 : wallet.address)) {
140
- logger.logger.error('No wallet address available for password setup');
141
+ if (!(wallet === null || wallet === void 0 ? void 0 : wallet.address) || !(wallet === null || wallet === void 0 ? void 0 : wallet.chain)) {
142
+ logger.logger.error('No wallet address or chain available for password setup');
141
143
  return;
142
144
  }
143
- try {
144
- const connector = wallet.connector;
145
- yield connector.updatePassword({
146
- accountAddress: wallet.address,
147
- existingPassword: '',
148
- newPassword: password,
149
- });
150
- }
151
- catch (error) {
152
- logger.logger.error('Failed to update password on modal', error);
153
- }
145
+ yield updatePassword({
146
+ accountAddress: wallet.address,
147
+ chainName: wallet.chain,
148
+ existingPassword: '',
149
+ newPassword: password,
150
+ });
154
151
  }),
155
152
  });
156
- }, [setDynamicWidgetView, wallet]);
153
+ }, [setDynamicWidgetView, wallet, updatePassword]);
157
154
  if (!isMfaEnabled && !isWaasWallet) {
158
155
  return null;
159
156
  }
@@ -110,6 +110,7 @@ import '../../../../../store/state/tokenBalances.js';
110
110
  import '../../../../../store/state/multichainBalances.js';
111
111
  import '../../../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
112
112
  import { useIsPasskeysMfaEnabled } from '../../../../../utils/hooks/useIsPasskeysMfaEnabled/useIsPasskeysMfaEnabled.js';
113
+ import { useWalletPassword } from '../../../../../utils/hooks/useWalletPassword/useWalletPassword.js';
113
114
  import { useInternalDynamicContext } from '../../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
114
115
 
115
116
  const MfaSection = ({ isLoading }) => {
@@ -119,6 +120,7 @@ const MfaSection = ({ isLoading }) => {
119
120
  const { primaryWallet } = useInternalDynamicContext();
120
121
  const { getEOAWallet } = useSmartWallets();
121
122
  const projectSettings = useProjectSettings();
123
+ const { updatePassword } = useWalletPassword();
122
124
  const isMfaEnabled = useIsMfaEnabled();
123
125
  const isTotpMfaEnabled = useIsTotpMfaEnabled();
124
126
  const isPasskeyMfaEnabled = useIsPasskeysMfaEnabled();
@@ -132,24 +134,19 @@ const MfaSection = ({ isLoading }) => {
132
134
  const handlePasscodeClick = useCallback(() => {
133
135
  setDynamicWidgetView('setup-password', {
134
136
  onComplete: (password) => __awaiter(void 0, void 0, void 0, function* () {
135
- if (!(wallet === null || wallet === void 0 ? void 0 : wallet.address)) {
136
- logger.error('No wallet address available for password setup');
137
+ if (!(wallet === null || wallet === void 0 ? void 0 : wallet.address) || !(wallet === null || wallet === void 0 ? void 0 : wallet.chain)) {
138
+ logger.error('No wallet address or chain available for password setup');
137
139
  return;
138
140
  }
139
- try {
140
- const connector = wallet.connector;
141
- yield connector.updatePassword({
142
- accountAddress: wallet.address,
143
- existingPassword: '',
144
- newPassword: password,
145
- });
146
- }
147
- catch (error) {
148
- logger.error('Failed to update password on modal', error);
149
- }
141
+ yield updatePassword({
142
+ accountAddress: wallet.address,
143
+ chainName: wallet.chain,
144
+ existingPassword: '',
145
+ newPassword: password,
146
+ });
150
147
  }),
151
148
  });
152
- }, [setDynamicWidgetView, wallet]);
149
+ }, [setDynamicWidgetView, wallet, updatePassword]);
153
150
  if (!isMfaEnabled && !isWaasWallet) {
154
151
  return null;
155
152
  }
@@ -17,7 +17,7 @@ var SetupPasswordSuccessView = require('../SetupPasswordSuccessView/SetupPasswor
17
17
  var SetupPasswordTermsView = require('../SetupPasswordTermsView/SetupPasswordTermsView.cjs');
18
18
 
19
19
  const SetupPasswordView = ({ onComplete, onCancel, skipKnowledgeCheck = false, }) => {
20
- const { setDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
20
+ const { setDynamicWidgetView, setIsOpen } = DynamicWidgetContext.useWidgetContext();
21
21
  const [currentStep, setCurrentStep] = React.useState('terms');
22
22
  const [password, setPassword] = React.useState('');
23
23
  const goToAccountAndSecurity = React.useCallback(() => {
@@ -64,15 +64,23 @@ const SetupPasswordView = ({ onComplete, onCancel, skipKnowledgeCheck = false, }
64
64
  const handleSuccess = React.useCallback(() => {
65
65
  onComplete(password);
66
66
  // Navigate to appropriate view based on where we came from:
67
- // - If onCancel was provided (auto-create flow), go to wallets view
67
+ // - If onCancel was provided (auto-create flow), go to wallets then close widget
68
68
  // - If onCancel wasn't provided (settings flow), go to account settings
69
69
  if (onCancel) {
70
70
  goToWallets();
71
+ setIsOpen(false);
71
72
  }
72
73
  else {
73
74
  goToAccountAndSecurity();
74
75
  }
75
- }, [onComplete, password, onCancel, goToAccountAndSecurity, goToWallets]);
76
+ }, [
77
+ onComplete,
78
+ password,
79
+ onCancel,
80
+ goToAccountAndSecurity,
81
+ goToWallets,
82
+ setIsOpen,
83
+ ]);
76
84
  switch (currentStep) {
77
85
  case 'terms':
78
86
  return (jsxRuntime.jsx(SetupPasswordTermsView.SetupPasswordTermsView, { onContinue: handleTermsContinue, onBack: onCancel ? undefined : handleCancel }));
@@ -13,7 +13,7 @@ import { SetupPasswordSuccessView } from '../SetupPasswordSuccessView/SetupPassw
13
13
  import { SetupPasswordTermsView } from '../SetupPasswordTermsView/SetupPasswordTermsView.js';
14
14
 
15
15
  const SetupPasswordView = ({ onComplete, onCancel, skipKnowledgeCheck = false, }) => {
16
- const { setDynamicWidgetView } = useWidgetContext();
16
+ const { setDynamicWidgetView, setIsOpen } = useWidgetContext();
17
17
  const [currentStep, setCurrentStep] = useState('terms');
18
18
  const [password, setPassword] = useState('');
19
19
  const goToAccountAndSecurity = useCallback(() => {
@@ -60,15 +60,23 @@ const SetupPasswordView = ({ onComplete, onCancel, skipKnowledgeCheck = false, }
60
60
  const handleSuccess = useCallback(() => {
61
61
  onComplete(password);
62
62
  // Navigate to appropriate view based on where we came from:
63
- // - If onCancel was provided (auto-create flow), go to wallets view
63
+ // - If onCancel was provided (auto-create flow), go to wallets then close widget
64
64
  // - If onCancel wasn't provided (settings flow), go to account settings
65
65
  if (onCancel) {
66
66
  goToWallets();
67
+ setIsOpen(false);
67
68
  }
68
69
  else {
69
70
  goToAccountAndSecurity();
70
71
  }
71
- }, [onComplete, password, onCancel, goToAccountAndSecurity, goToWallets]);
72
+ }, [
73
+ onComplete,
74
+ password,
75
+ onCancel,
76
+ goToAccountAndSecurity,
77
+ goToWallets,
78
+ setIsOpen,
79
+ ]);
72
80
  switch (currentStep) {
73
81
  case 'terms':
74
82
  return (jsx(SetupPasswordTermsView, { onContinue: handleTermsContinue, onBack: onCancel ? undefined : handleCancel }));