@dynamic-labs/sdk-react-core 4.25.8-alpha.0 → 4.25.9

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 (30) hide show
  1. package/CHANGELOG.md +15 -2
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +11 -11
  5. package/src/index.cjs +2 -0
  6. package/src/index.d.ts +1 -1
  7. package/src/index.js +1 -0
  8. package/src/lib/locale/en/translation.cjs +2 -0
  9. package/src/lib/locale/en/translation.d.ts +2 -0
  10. package/src/lib/locale/en/translation.js +2 -0
  11. package/src/lib/utils/constants/sessionStorage.cjs +6 -0
  12. package/src/lib/utils/constants/sessionStorage.js +5 -1
  13. package/src/lib/utils/functions/embeddedWalletSessionKeysUtils/embeddedWalletSessionKeysUtils.cjs +35 -0
  14. package/src/lib/utils/functions/embeddedWalletSessionKeysUtils/embeddedWalletSessionKeysUtils.d.ts +15 -0
  15. package/src/lib/utils/functions/embeddedWalletSessionKeysUtils/embeddedWalletSessionKeysUtils.js +30 -0
  16. package/src/lib/utils/functions/embeddedWalletSessionKeysUtils/index.d.ts +2 -0
  17. package/src/lib/utils/hooks/index.d.ts +1 -0
  18. package/src/lib/utils/hooks/useDynamicWaas/constants.cjs +0 -2
  19. package/src/lib/utils/hooks/useDynamicWaas/constants.d.ts +0 -1
  20. package/src/lib/utils/hooks/useDynamicWaas/constants.js +1 -2
  21. package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +1 -9
  22. package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +2 -10
  23. package/src/lib/utils/hooks/useEmbeddedWalletSessionKeys/useEmbeddedWalletSessionKeys.cjs +29 -31
  24. package/src/lib/utils/hooks/useEmbeddedWalletSessionKeys/useEmbeddedWalletSessionKeys.d.ts +1 -8
  25. package/src/lib/utils/hooks/useEmbeddedWalletSessionKeys/useEmbeddedWalletSessionKeys.js +29 -31
  26. package/src/lib/utils/hooks/useTransferWallet/useTransferWallet.cjs +42 -33
  27. package/src/lib/utils/hooks/useTransferWallet/useTransferWallet.js +42 -33
  28. package/src/lib/widgets/DynamicWidget/prompts/PendingSignModal/DefaultPendingSignModalContent/DefaultPendingSignModalContent.cjs +4 -3
  29. package/src/lib/widgets/DynamicWidget/prompts/PendingSignModal/DefaultPendingSignModalContent/DefaultPendingSignModalContent.js +4 -3
  30. package/src/lib/utils/functions/getSessionKeyCompatibleConnectorFetchers/getSessionKeyCompatibleConnectorFetchers.d.ts +0 -11
package/CHANGELOG.md CHANGED
@@ -1,10 +1,23 @@
1
1
 
2
- ### [4.25.8-alpha.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.25.7...v4.25.8-alpha.0) (2025-08-04)
2
+ ### [4.25.9](https://github.com/dynamic-labs/dynamic-auth/compare/v4.25.8...v4.25.9) (2025-08-01)
3
3
 
4
4
 
5
5
  ### Bug Fixes
6
6
 
7
- * don't deep link to metamask in-app browser when already in the in-app browser ([f7c061e](https://github.com/dynamic-labs/dynamic-auth/commit/f7c061e0820ca7d5ff1600c18ad0763b4288dc1d))
7
+ * use zerodev rpc for zerodev calls ([#9280](https://github.com/dynamic-labs/dynamic-auth/issues/9280)) ([87d52f3](https://github.com/dynamic-labs/dynamic-auth/commit/87d52f30de968919d675b0fada15a372b1533b76))
8
+
9
+ ### [4.25.8](https://github.com/dynamic-labs/dynamic-auth/compare/v4.25.7...v4.25.8) (2025-07-31)
10
+
11
+
12
+ ### Features
13
+
14
+ * add link_wallet_message copykey ([#9266](https://github.com/dynamic-labs/dynamic-auth/issues/9266)) ([a465300](https://github.com/dynamic-labs/dynamic-auth/commit/a46530050db5faf6d05dd12723421d33780da034))
15
+ * implement onSignedMessage event trigger for wallet transfer flows ([#9251](https://github.com/dynamic-labs/dynamic-auth/issues/9251)) ([554cd6c](https://github.com/dynamic-labs/dynamic-auth/commit/554cd6c4cb34db5f0096d1de30877c6a6c4dcbee))
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * improve session key handling ([#9249](https://github.com/dynamic-labs/dynamic-auth/issues/9249)) ([fba683a](https://github.com/dynamic-labs/dynamic-auth/commit/fba683abc57bc1ad9bdb6fb2e26b195f616d63cc))
8
21
 
9
22
  ### [4.25.7](https://github.com/dynamic-labs/dynamic-auth/compare/v4.25.6...v4.25.7) (2025-07-28)
10
23
 
package/package.cjs CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.25.8-alpha.0";
6
+ var version = "4.25.9";
7
7
  var dependencies = {
8
8
  "@dynamic-labs/sdk-api-core": "0.0.728",
9
9
  "@dynamic-labs-sdk/client": "0.0.1-alpha.19",
package/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client'
2
- var version = "4.25.8-alpha.0";
2
+ var version = "4.25.9";
3
3
  var dependencies = {
4
4
  "@dynamic-labs/sdk-api-core": "0.0.728",
5
5
  "@dynamic-labs-sdk/client": "0.0.1-alpha.19",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/sdk-react-core",
3
- "version": "4.25.8-alpha.0",
3
+ "version": "4.25.9",
4
4
  "dependencies": {
5
5
  "@dynamic-labs/sdk-api-core": "0.0.728",
6
6
  "@dynamic-labs-sdk/client": "0.0.1-alpha.19",
@@ -15,16 +15,16 @@
15
15
  "yup": "0.32.11",
16
16
  "react-international-phone": "4.5.0",
17
17
  "bs58": "5.0.0",
18
- "@dynamic-labs/assert-package-version": "4.25.8-alpha.0",
19
- "@dynamic-labs/iconic": "4.25.8-alpha.0",
20
- "@dynamic-labs/logger": "4.25.8-alpha.0",
21
- "@dynamic-labs/multi-wallet": "4.25.8-alpha.0",
22
- "@dynamic-labs/rpc-providers": "4.25.8-alpha.0",
23
- "@dynamic-labs/store": "4.25.8-alpha.0",
24
- "@dynamic-labs/types": "4.25.8-alpha.0",
25
- "@dynamic-labs/utils": "4.25.8-alpha.0",
26
- "@dynamic-labs/wallet-book": "4.25.8-alpha.0",
27
- "@dynamic-labs/wallet-connector-core": "4.25.8-alpha.0",
18
+ "@dynamic-labs/assert-package-version": "4.25.9",
19
+ "@dynamic-labs/iconic": "4.25.9",
20
+ "@dynamic-labs/logger": "4.25.9",
21
+ "@dynamic-labs/multi-wallet": "4.25.9",
22
+ "@dynamic-labs/rpc-providers": "4.25.9",
23
+ "@dynamic-labs/store": "4.25.9",
24
+ "@dynamic-labs/types": "4.25.9",
25
+ "@dynamic-labs/utils": "4.25.9",
26
+ "@dynamic-labs/wallet-book": "4.25.9",
27
+ "@dynamic-labs/wallet-connector-core": "4.25.9",
28
28
  "eventemitter3": "5.0.1"
29
29
  },
30
30
  "devDependencies": {
package/src/index.cjs CHANGED
@@ -169,6 +169,7 @@ var useRegisterPasskey = require('./lib/utils/hooks/useRegisterPasskey/useRegist
169
169
  var useAuthenticatePasskeyMFA = require('./lib/utils/hooks/useAuthenticatePasskeyMFA/useAuthenticatePasskeyMFA.cjs');
170
170
  var useSignInWithPasskey = require('./lib/utils/hooks/useSignInWithPasskey/useSignInWithPasskey.cjs');
171
171
  var useGetUserMfaMethods = require('./lib/utils/hooks/useGetUserMfaMethods/useGetUserMfaMethods.cjs');
172
+ var usePromptMfaAuth = require('./lib/utils/hooks/usePromptMfaAuth/usePromptMfaAuth.cjs');
172
173
  var DynamicConnectButton = require('./lib/components/DynamicConnectButton/DynamicConnectButton.cjs');
173
174
  require('./lib/components/InlineWidget/InlineWidget.cjs');
174
175
  var IsBrowser = require('./lib/components/IsBrowser/IsBrowser.cjs');
@@ -307,6 +308,7 @@ exports.useRegisterPasskey = useRegisterPasskey.useRegisterPasskey;
307
308
  exports.useAuthenticatePasskeyMFA = useAuthenticatePasskeyMFA.useAuthenticatePasskeyMFA;
308
309
  exports.useSignInWithPasskey = useSignInWithPasskey.useSignInWithPasskey;
309
310
  exports.useGetUserMfaMethods = useGetUserMfaMethods.useGetUserMfaMethods;
311
+ exports.usePromptMfaAuth = usePromptMfaAuth.usePromptMfaAuth;
310
312
  exports.DynamicConnectButton = DynamicConnectButton.DynamicConnectButton;
311
313
  exports.IsBrowser = IsBrowser.IsBrowser;
312
314
  exports.DynamicBridgeWidget = DynamicBridgeWidget.DynamicBridgeWidget;
package/src/index.d.ts CHANGED
@@ -116,7 +116,7 @@ export { useProjectSettings } from './lib/store/state/projectSettings';
116
116
  export {
117
117
  /** @deprecated */
118
118
  DynamicWidgetContextProvider, } from './lib/widgets/DynamicWidget/context';
119
- export { useWalletItemActions, useAuthenticateConnectedUser, useSocialAccounts, useEmbeddedWallet, useEmbeddedWalletAuthenticator, usePasskeyRecovery, useEmbeddedReveal, useIsLoggedIn, useDynamicModals, useMfa, useTokenBalances, useMultichainTokenBalances, useSwitchWallet, useRpcProviders, useRefreshUser, useWalletOptions, useSmartWallets, EmbeddedWalletVersion, useTelegramLogin, useUpgradeEmbeddedWallet, useEVMTransactionSimulation, useSVMTransactionSimulation, useDeleteUserAccount, useDynamicWaas, useGetPasskeys, useRegisterPasskey, useAuthenticatePasskeyMFA, useGetUserMfaMethods, } from './lib/utils/hooks';
119
+ export { useWalletItemActions, useAuthenticateConnectedUser, useSocialAccounts, useEmbeddedWallet, useEmbeddedWalletAuthenticator, usePasskeyRecovery, useEmbeddedReveal, useIsLoggedIn, useDynamicModals, useMfa, useTokenBalances, useMultichainTokenBalances, useSwitchWallet, useRpcProviders, useRefreshUser, useWalletOptions, useSmartWallets, EmbeddedWalletVersion, useTelegramLogin, useUpgradeEmbeddedWallet, useEVMTransactionSimulation, useSVMTransactionSimulation, useDeleteUserAccount, useDynamicWaas, useGetPasskeys, useRegisterPasskey, useAuthenticatePasskeyMFA, useGetUserMfaMethods, usePromptMfaAuth, } from './lib/utils/hooks';
120
120
  export {
121
121
  /** @deprecated use useOnramp instead */
122
122
  useFunding, } from './lib/utils/hooks/useFunding';
package/src/index.js CHANGED
@@ -165,6 +165,7 @@ export { useRegisterPasskey } from './lib/utils/hooks/useRegisterPasskey/useRegi
165
165
  export { useAuthenticatePasskeyMFA } from './lib/utils/hooks/useAuthenticatePasskeyMFA/useAuthenticatePasskeyMFA.js';
166
166
  export { useSignInWithPasskey } from './lib/utils/hooks/useSignInWithPasskey/useSignInWithPasskey.js';
167
167
  export { useGetUserMfaMethods } from './lib/utils/hooks/useGetUserMfaMethods/useGetUserMfaMethods.js';
168
+ export { usePromptMfaAuth } from './lib/utils/hooks/usePromptMfaAuth/usePromptMfaAuth.js';
168
169
  export { DynamicConnectButton } from './lib/components/DynamicConnectButton/DynamicConnectButton.js';
169
170
  import './lib/components/InlineWidget/InlineWidget.js';
170
171
  export { IsBrowser } from './lib/components/IsBrowser/IsBrowser.js';
@@ -1802,6 +1802,7 @@ const translation = {
1802
1802
  * @default
1803
1803
  * {
1804
1804
  click_to_sign: 'Click to Sign',
1805
+ link_wallet_message: 'Sign the message in your wallet to approve linking this wallet to your account',
1805
1806
  note: 'Note: ',
1806
1807
  phantom_ledger_sign: "Click sign in your wallet to confirm you own this wallet (this doesn't cost gas).",
1807
1808
  phantom_ledger_warning: "Ledger with Phantom doesn't support message signing. When logging in, a small fee (which should not apply) may appear. See below to learn more.",
@@ -1810,6 +1811,7 @@ const translation = {
1810
1811
  */
1811
1812
  dyn_pending_signature: {
1812
1813
  click_to_sign: 'Click to Sign',
1814
+ link_wallet_message: 'Sign the message in your wallet to approve linking this wallet to your account',
1813
1815
  note: 'Note: ',
1814
1816
  phantom_ledger_sign: "Click sign in your wallet to confirm you own this wallet (this doesn't cost gas).",
1815
1817
  phantom_ledger_warning: "Ledger doesn't support message signing. When logging in, a small fee (which should not apply) may appear. See below to learn more.",
@@ -1798,6 +1798,7 @@ export declare const translation: {
1798
1798
  * @default
1799
1799
  * {
1800
1800
  click_to_sign: 'Click to Sign',
1801
+ link_wallet_message: 'Sign the message in your wallet to approve linking this wallet to your account',
1801
1802
  note: 'Note: ',
1802
1803
  phantom_ledger_sign: "Click sign in your wallet to confirm you own this wallet (this doesn't cost gas).",
1803
1804
  phantom_ledger_warning: "Ledger with Phantom doesn't support message signing. When logging in, a small fee (which should not apply) may appear. See below to learn more.",
@@ -1806,6 +1807,7 @@ export declare const translation: {
1806
1807
  */
1807
1808
  dyn_pending_signature: {
1808
1809
  click_to_sign: string;
1810
+ link_wallet_message: string;
1809
1811
  note: string;
1810
1812
  phantom_ledger_sign: string;
1811
1813
  phantom_ledger_warning: string;
@@ -1798,6 +1798,7 @@ const translation = {
1798
1798
  * @default
1799
1799
  * {
1800
1800
  click_to_sign: 'Click to Sign',
1801
+ link_wallet_message: 'Sign the message in your wallet to approve linking this wallet to your account',
1801
1802
  note: 'Note: ',
1802
1803
  phantom_ledger_sign: "Click sign in your wallet to confirm you own this wallet (this doesn't cost gas).",
1803
1804
  phantom_ledger_warning: "Ledger with Phantom doesn't support message signing. When logging in, a small fee (which should not apply) may appear. See below to learn more.",
@@ -1806,6 +1807,7 @@ const translation = {
1806
1807
  */
1807
1808
  dyn_pending_signature: {
1808
1809
  click_to_sign: 'Click to Sign',
1810
+ link_wallet_message: 'Sign the message in your wallet to approve linking this wallet to your account',
1809
1811
  note: 'Note: ',
1810
1812
  phantom_ledger_sign: "Click sign in your wallet to confirm you own this wallet (this doesn't cost gas).",
1811
1813
  phantom_ledger_warning: "Ledger doesn't support message signing. When logging in, a small fee (which should not apply) may appear. See below to learn more.",
@@ -7,6 +7,12 @@ const CLIENT_SESSION_KEYS = 'dynamic_client_session_keys';
7
7
  const CLIENT_SESSION_KEYS_STORAGE_OPTIONS = {
8
8
  priority: ['secureStorage', 'sessionStorage'],
9
9
  };
10
+ const SECURE_ENCLAVE_WALLET_SESSION_KEYS = 'dynamic_secure_enclave_session_keys';
11
+ const SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS = {
12
+ priority: ['secureStorage', 'localStorage'],
13
+ };
10
14
 
11
15
  exports.CLIENT_SESSION_KEYS = CLIENT_SESSION_KEYS;
12
16
  exports.CLIENT_SESSION_KEYS_STORAGE_OPTIONS = CLIENT_SESSION_KEYS_STORAGE_OPTIONS;
17
+ exports.SECURE_ENCLAVE_WALLET_SESSION_KEYS = SECURE_ENCLAVE_WALLET_SESSION_KEYS;
18
+ exports.SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS = SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS;
@@ -3,5 +3,9 @@ const CLIENT_SESSION_KEYS = 'dynamic_client_session_keys';
3
3
  const CLIENT_SESSION_KEYS_STORAGE_OPTIONS = {
4
4
  priority: ['secureStorage', 'sessionStorage'],
5
5
  };
6
+ const SECURE_ENCLAVE_WALLET_SESSION_KEYS = 'dynamic_secure_enclave_session_keys';
7
+ const SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS = {
8
+ priority: ['secureStorage', 'localStorage'],
9
+ };
6
10
 
7
- export { CLIENT_SESSION_KEYS, CLIENT_SESSION_KEYS_STORAGE_OPTIONS };
11
+ export { CLIENT_SESSION_KEYS, CLIENT_SESSION_KEYS_STORAGE_OPTIONS, SECURE_ENCLAVE_WALLET_SESSION_KEYS, SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS };
@@ -0,0 +1,35 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var _tslib = require('../../../../../_virtual/_tslib.cjs');
7
+ var keyService = require('../keyService/keyService.cjs');
8
+ var utils = require('@dynamic-labs/utils');
9
+ var sessionStorage = require('../../constants/sessionStorage.cjs');
10
+
11
+ const generateSessionKey = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
12
+ const { private: privateKey, public: publicKey, privateJwk, } = yield keyService.p256Keygen();
13
+ // convert to base64 and store the session keys in session storage
14
+ return {
15
+ privateKey,
16
+ privateKeyJwk: privateJwk,
17
+ publicKey,
18
+ registered: false,
19
+ };
20
+ });
21
+ // TODO - what is the reason that the session keys are not registered in the backend?
22
+ /**
23
+ * Generates a new session key and saves it to session storage
24
+ * It doesn't register the session key with the backend, it's only used to generate a new key
25
+ * and save it to session storage.
26
+ * @returns the new session key
27
+ */
28
+ const generateAndSaveSessionKey = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
29
+ const newSessionKey = yield generateSessionKey();
30
+ utils.StorageService.setItem(sessionStorage.SECURE_ENCLAVE_WALLET_SESSION_KEYS, keyService.toEncodedFormat(newSessionKey.publicKey, newSessionKey.privateKey, newSessionKey.privateKeyJwk, newSessionKey.registered), sessionStorage.SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS);
31
+ return newSessionKey;
32
+ });
33
+
34
+ exports.generateAndSaveSessionKey = generateAndSaveSessionKey;
35
+ exports.generateSessionKey = generateSessionKey;
@@ -0,0 +1,15 @@
1
+ export type SessionKey = {
2
+ publicKey: string;
3
+ privateKey: string;
4
+ privateKeyJwk: JsonWebKey;
5
+ registered: boolean;
6
+ expirationDate?: Date;
7
+ };
8
+ export declare const generateSessionKey: () => Promise<SessionKey>;
9
+ /**
10
+ * Generates a new session key and saves it to session storage
11
+ * It doesn't register the session key with the backend, it's only used to generate a new key
12
+ * and save it to session storage.
13
+ * @returns the new session key
14
+ */
15
+ export declare const generateAndSaveSessionKey: () => Promise<SessionKey>;
@@ -0,0 +1,30 @@
1
+ 'use client'
2
+ import { __awaiter } from '../../../../../_virtual/_tslib.js';
3
+ import { toEncodedFormat, p256Keygen } from '../keyService/keyService.js';
4
+ import { StorageService } from '@dynamic-labs/utils';
5
+ import { SECURE_ENCLAVE_WALLET_SESSION_KEYS, SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS } from '../../constants/sessionStorage.js';
6
+
7
+ const generateSessionKey = () => __awaiter(void 0, void 0, void 0, function* () {
8
+ const { private: privateKey, public: publicKey, privateJwk, } = yield p256Keygen();
9
+ // convert to base64 and store the session keys in session storage
10
+ return {
11
+ privateKey,
12
+ privateKeyJwk: privateJwk,
13
+ publicKey,
14
+ registered: false,
15
+ };
16
+ });
17
+ // TODO - what is the reason that the session keys are not registered in the backend?
18
+ /**
19
+ * Generates a new session key and saves it to session storage
20
+ * It doesn't register the session key with the backend, it's only used to generate a new key
21
+ * and save it to session storage.
22
+ * @returns the new session key
23
+ */
24
+ const generateAndSaveSessionKey = () => __awaiter(void 0, void 0, void 0, function* () {
25
+ const newSessionKey = yield generateSessionKey();
26
+ StorageService.setItem(SECURE_ENCLAVE_WALLET_SESSION_KEYS, toEncodedFormat(newSessionKey.publicKey, newSessionKey.privateKey, newSessionKey.privateKeyJwk, newSessionKey.registered), SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS);
27
+ return newSessionKey;
28
+ });
29
+
30
+ export { generateAndSaveSessionKey, generateSessionKey };
@@ -0,0 +1,2 @@
1
+ export { generateAndSaveSessionKey, generateSessionKey, } from './embeddedWalletSessionKeysUtils';
2
+ export type { SessionKey } from './embeddedWalletSessionKeysUtils';
@@ -90,3 +90,4 @@ export { useIsPasskeysMfaEnabled } from './useIsPasskeysMfaEnabled';
90
90
  export { useIsTotpMfaEnabled } from './useIsTotpMfaEnabled';
91
91
  export { useSignInWithPasskey } from './useSignInWithPasskey';
92
92
  export { useGetUserMfaMethods } from './useGetUserMfaMethods';
93
+ export { usePromptMfaAuth } from './usePromptMfaAuth';
@@ -7,10 +7,8 @@ const NO_ENABLED_CHAINS_ERROR = 'No enabled embedded wallet chains. Please go to
7
7
  const DYNAMIC_WAAS_CONNECTOR_NOT_FOUND_ERROR = 'Dynamic Waas connector not found';
8
8
  const INVALID_CHAINS_ERROR = 'The following chains are not enabled for embedded wallets';
9
9
  const WALLET_CREATION_FAILED_ERROR = 'Failed to create wallet account for the following chains';
10
- const EMBEDDED_WALLET_NOT_ENABLED_ERROR = 'Embedded wallet is not enabled, if this is unintended, go to the dashboard and make sure embedded wallet option is enabled.';
11
10
 
12
11
  exports.DYNAMIC_WAAS_CONNECTOR_NOT_FOUND_ERROR = DYNAMIC_WAAS_CONNECTOR_NOT_FOUND_ERROR;
13
- exports.EMBEDDED_WALLET_NOT_ENABLED_ERROR = EMBEDDED_WALLET_NOT_ENABLED_ERROR;
14
12
  exports.INVALID_CHAINS_ERROR = INVALID_CHAINS_ERROR;
15
13
  exports.NO_ENABLED_CHAINS_ERROR = NO_ENABLED_CHAINS_ERROR;
16
14
  exports.WALLET_CREATION_FAILED_ERROR = WALLET_CREATION_FAILED_ERROR;
@@ -2,4 +2,3 @@ export declare const NO_ENABLED_CHAINS_ERROR = "No enabled embedded wallet chain
2
2
  export declare const DYNAMIC_WAAS_CONNECTOR_NOT_FOUND_ERROR = "Dynamic Waas connector not found";
3
3
  export declare const INVALID_CHAINS_ERROR = "The following chains are not enabled for embedded wallets";
4
4
  export declare const WALLET_CREATION_FAILED_ERROR = "Failed to create wallet account for the following chains";
5
- export declare const EMBEDDED_WALLET_NOT_ENABLED_ERROR = "Embedded wallet is not enabled, if this is unintended, go to the dashboard and make sure embedded wallet option is enabled.";
@@ -3,6 +3,5 @@ const NO_ENABLED_CHAINS_ERROR = 'No enabled embedded wallet chains. Please go to
3
3
  const DYNAMIC_WAAS_CONNECTOR_NOT_FOUND_ERROR = 'Dynamic Waas connector not found';
4
4
  const INVALID_CHAINS_ERROR = 'The following chains are not enabled for embedded wallets';
5
5
  const WALLET_CREATION_FAILED_ERROR = 'Failed to create wallet account for the following chains';
6
- const EMBEDDED_WALLET_NOT_ENABLED_ERROR = 'Embedded wallet is not enabled, if this is unintended, go to the dashboard and make sure embedded wallet option is enabled.';
7
6
 
8
- export { DYNAMIC_WAAS_CONNECTOR_NOT_FOUND_ERROR, EMBEDDED_WALLET_NOT_ENABLED_ERROR, INVALID_CHAINS_ERROR, NO_ENABLED_CHAINS_ERROR, WALLET_CREATION_FAILED_ERROR };
7
+ export { DYNAMIC_WAAS_CONNECTOR_NOT_FOUND_ERROR, INVALID_CHAINS_ERROR, NO_ENABLED_CHAINS_ERROR, WALLET_CREATION_FAILED_ERROR };
@@ -24,7 +24,6 @@ require('../../../context/ViewContext/ViewContext.cjs');
24
24
  require('@dynamic-labs/wallet-book');
25
25
  require('../../../shared/consts/index.cjs');
26
26
  require('../../../store/state/nonce/nonce.cjs');
27
- var isTurnkeyEnabled = require('../../functions/isTurnkeyEnabled/isTurnkeyEnabled.cjs');
28
27
  var isCookieEnabled = require('../../functions/isCookieEnabled/isCookieEnabled.cjs');
29
28
  var updatePrimaryWalletId = require('../../functions/updatePrimaryWalletId/updatePrimaryWalletId.cjs');
30
29
  require('../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
@@ -139,7 +138,6 @@ const useDynamicWaas = () => {
139
138
  const relayUrl = (_b = (_a = projectSettings$1 === null || projectSettings$1 === void 0 ? void 0 : projectSettings$1.sdk) === null || _a === void 0 ? void 0 : _a.waas) === null || _b === void 0 ? void 0 : _b.relayUrl;
140
139
  const embeddedWalletSettings = projectSettings$1 === null || projectSettings$1 === void 0 ? void 0 : projectSettings$1.sdk.embeddedWallets;
141
140
  const enabledChains = (_c = embeddedWalletSettings === null || embeddedWalletSettings === void 0 ? void 0 : embeddedWalletSettings.chainConfigurations) === null || _c === void 0 ? void 0 : _c.filter((c) => c.enabled);
142
- const isEmbeddedWalletEnabled = isTurnkeyEnabled.isTurnkeyEnabled(projectSettings$1);
143
141
  const primaryChain = enabledChains === null || enabledChains === void 0 ? void 0 : enabledChains.find((chain) => chain.primary);
144
142
  const enabledChainNames = enabledChains === null || enabledChains === void 0 ? void 0 : enabledChains.map((chain) => chain.name);
145
143
  const automaticEmbeddedWalletCreationEnabled = embeddedWalletSettings === null || embeddedWalletSettings === void 0 ? void 0 : embeddedWalletSettings.automaticEmbeddedWalletCreation;
@@ -184,9 +182,6 @@ const useDynamicWaas = () => {
184
182
  // If no chain names are provided, filter out chains that already have a wallet
185
183
  // and make a wallet for each enabled chain
186
184
  const createWalletAccount = React.useCallback((chainNames) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
187
- if (!isEmbeddedWalletEnabled) {
188
- throw new utils.DynamicError(constants.EMBEDDED_WALLET_NOT_ENABLED_ERROR);
189
- }
190
185
  if (!(enabledChainNames === null || enabledChainNames === void 0 ? void 0 : enabledChainNames.length)) {
191
186
  throw new utils.DynamicError(constants.NO_ENABLED_CHAINS_ERROR);
192
187
  }
@@ -274,13 +269,11 @@ const useDynamicWaas = () => {
274
269
  setShowAuthFlow,
275
270
  user === null || user === void 0 ? void 0 : user.verifiedCredentials,
276
271
  addedWalletsIds,
277
- isEmbeddedWalletEnabled,
278
272
  ]);
279
273
  const needsAutoCreateWalletChains = React.useMemo(() => {
280
274
  if (!user ||
281
275
  !dynamicWaasIsEnabled ||
282
- !automaticEmbeddedWalletCreationEnabled ||
283
- !isEmbeddedWalletEnabled) {
276
+ !automaticEmbeddedWalletCreationEnabled) {
284
277
  return [];
285
278
  }
286
279
  // check if user have any wallet (V1, V2, or V3/dynamicwaas) for this chain
@@ -305,7 +298,6 @@ const useDynamicWaas = () => {
305
298
  automaticEmbeddedWalletCreationEnabled,
306
299
  automaticEmbeddedWalletCreationForExternalEnabled,
307
300
  enabledChainNames,
308
- isEmbeddedWalletEnabled,
309
301
  ]);
310
302
  const importPrivateKey = (_d) => _tslib.__awaiter(void 0, [_d], void 0, function* ({ chainName, privateKey, }) {
311
303
  const walletConnector = getWalletConnector(chainName);
@@ -20,7 +20,6 @@ import '../../../context/ViewContext/ViewContext.js';
20
20
  import '@dynamic-labs/wallet-book';
21
21
  import '../../../shared/consts/index.js';
22
22
  import '../../../store/state/nonce/nonce.js';
23
- import { isTurnkeyEnabled } from '../../functions/isTurnkeyEnabled/isTurnkeyEnabled.js';
24
23
  import { isCookieEnabled } from '../../functions/isCookieEnabled/isCookieEnabled.js';
25
24
  import { updatePrimaryWalletId } from '../../functions/updatePrimaryWalletId/updatePrimaryWalletId.js';
26
25
  import '../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
@@ -105,7 +104,7 @@ import { DEFAULT_WAAS_API_URL } from '../../constants/waas/apiUrl.js';
105
104
  import { useClientSessionKeys } from '../useClientSessionKeys/useClientSessionKeys.js';
106
105
  import { useRefreshUser } from '../useRefreshUser/useRefreshUser.js';
107
106
  import { useGetMfaToken } from '../useGetMfaToken/useGetMfaToken.js';
108
- import { DYNAMIC_WAAS_CONNECTOR_NOT_FOUND_ERROR, EMBEDDED_WALLET_NOT_ENABLED_ERROR, NO_ENABLED_CHAINS_ERROR, INVALID_CHAINS_ERROR, WALLET_CREATION_FAILED_ERROR } from './constants.js';
107
+ import { DYNAMIC_WAAS_CONNECTOR_NOT_FOUND_ERROR, NO_ENABLED_CHAINS_ERROR, INVALID_CHAINS_ERROR, WALLET_CREATION_FAILED_ERROR } from './constants.js';
109
108
  import '../../../store/state/tokenBalances.js';
110
109
  import '../../../store/state/multichainBalances.js';
111
110
  import '../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
@@ -135,7 +134,6 @@ const useDynamicWaas = () => {
135
134
  const relayUrl = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.waas) === null || _b === void 0 ? void 0 : _b.relayUrl;
136
135
  const embeddedWalletSettings = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets;
137
136
  const enabledChains = (_c = embeddedWalletSettings === null || embeddedWalletSettings === void 0 ? void 0 : embeddedWalletSettings.chainConfigurations) === null || _c === void 0 ? void 0 : _c.filter((c) => c.enabled);
138
- const isEmbeddedWalletEnabled = isTurnkeyEnabled(projectSettings);
139
137
  const primaryChain = enabledChains === null || enabledChains === void 0 ? void 0 : enabledChains.find((chain) => chain.primary);
140
138
  const enabledChainNames = enabledChains === null || enabledChains === void 0 ? void 0 : enabledChains.map((chain) => chain.name);
141
139
  const automaticEmbeddedWalletCreationEnabled = embeddedWalletSettings === null || embeddedWalletSettings === void 0 ? void 0 : embeddedWalletSettings.automaticEmbeddedWalletCreation;
@@ -180,9 +178,6 @@ const useDynamicWaas = () => {
180
178
  // If no chain names are provided, filter out chains that already have a wallet
181
179
  // and make a wallet for each enabled chain
182
180
  const createWalletAccount = useCallback((chainNames) => __awaiter(void 0, void 0, void 0, function* () {
183
- if (!isEmbeddedWalletEnabled) {
184
- throw new DynamicError(EMBEDDED_WALLET_NOT_ENABLED_ERROR);
185
- }
186
181
  if (!(enabledChainNames === null || enabledChainNames === void 0 ? void 0 : enabledChainNames.length)) {
187
182
  throw new DynamicError(NO_ENABLED_CHAINS_ERROR);
188
183
  }
@@ -270,13 +265,11 @@ const useDynamicWaas = () => {
270
265
  setShowAuthFlow,
271
266
  user === null || user === void 0 ? void 0 : user.verifiedCredentials,
272
267
  addedWalletsIds,
273
- isEmbeddedWalletEnabled,
274
268
  ]);
275
269
  const needsAutoCreateWalletChains = useMemo(() => {
276
270
  if (!user ||
277
271
  !dynamicWaasIsEnabled ||
278
- !automaticEmbeddedWalletCreationEnabled ||
279
- !isEmbeddedWalletEnabled) {
272
+ !automaticEmbeddedWalletCreationEnabled) {
280
273
  return [];
281
274
  }
282
275
  // check if user have any wallet (V1, V2, or V3/dynamicwaas) for this chain
@@ -301,7 +294,6 @@ const useDynamicWaas = () => {
301
294
  automaticEmbeddedWalletCreationEnabled,
302
295
  automaticEmbeddedWalletCreationForExternalEnabled,
303
296
  enabledChainNames,
304
- isEmbeddedWalletEnabled,
305
297
  ]);
306
298
  const importPrivateKey = (_d) => __awaiter(void 0, [_d], void 0, function* ({ chainName, privateKey, }) {
307
299
  const walletConnector = getWalletConnector(chainName);
@@ -34,6 +34,7 @@ var keyService = require('../../functions/keyService/keyService.cjs');
34
34
  var dynamicEvents = require('../../../events/dynamicEvents.cjs');
35
35
  var useOnboardingCompleteUser = require('../../../client/extension/user/useOnboardingCompleteUser/useOnboardingCompleteUser.cjs');
36
36
  var getPrimaryTurnkeyWalletId = require('../../functions/getPrimaryTurnkeyWalletId/getPrimaryTurnkeyWalletId.cjs');
37
+ var embeddedWalletSessionKeysUtils = require('../../functions/embeddedWalletSessionKeysUtils/embeddedWalletSessionKeysUtils.cjs');
37
38
 
38
39
  const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
39
40
  const user = useOnboardingCompleteUser.useOnboardingCompleteUserProfile();
@@ -42,17 +43,21 @@ const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
42
43
  // but never registered with the backend)
43
44
  // scenario 3: session expired and needs to be refreshed
44
45
  // Helper to get decoded session keys from storage
46
+ /**
47
+ * @param ignoreRestore - if true, will not use the session keys if they are found in storage and didn't expire
48
+ * @returns - the session key
49
+ */
45
50
  const registerEmbeddedWalletSessionKey = (...args_1) => _tslib.__awaiter(void 0, [...args_1], void 0, function* ({ ignoreRestore = false, } = {}) {
46
51
  if (!user) {
47
52
  throw new Error('User not found');
48
53
  }
49
54
  // check if session keys are already stored in session storage
50
- let decodedSessionKeys = getDecodedSessionKeys();
55
+ let existingSessionKey = getDecodedSessionKeys();
51
56
  utils.tracing.logEvent('session-key', 'registerEmbeddedWalletSessionKey', utils.tracing.formatObject({
52
- hasDecodedSessionKeys: Boolean(decodedSessionKeys),
53
- publicKey: decodedSessionKeys === null || decodedSessionKeys === void 0 ? void 0 : decodedSessionKeys.publicKey,
57
+ hasDecodedSessionKeys: Boolean(existingSessionKey),
58
+ publicKey: existingSessionKey === null || existingSessionKey === void 0 ? void 0 : existingSessionKey.publicKey,
54
59
  }));
55
- if (!decodedSessionKeys) {
60
+ if (!existingSessionKey) {
56
61
  // We should never be in a situation where we don't have session keys in storage.
57
62
  // But right now we are in a situation where we don't have session keys in storage,
58
63
  // in many situations.
@@ -63,34 +68,36 @@ const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
63
68
  // This logic will be removed and reverted back to logging out once we find
64
69
  // the culprit that cause many of these to happen.
65
70
  walletConnectorCore.logger.error('Session keys not found in storage. Generating new session keys.', { userId: user === null || user === void 0 ? void 0 : user.userId });
66
- decodedSessionKeys = yield generateSessionKey();
71
+ existingSessionKey = yield embeddedWalletSessionKeysUtils.generateAndSaveSessionKey();
67
72
  }
68
- const isSessionKeyValid = decodedSessionKeys.expirationDate &&
69
- new Date() <= new Date(decodedSessionKeys.expirationDate) &&
73
+ const isSessionKeyValid = existingSessionKey.registered &&
74
+ existingSessionKey.expirationDate &&
75
+ new Date() <= new Date(existingSessionKey.expirationDate) &&
70
76
  !ignoreRestore;
71
77
  utils.tracing.logEvent('session-key', 'isSessionKeyValid', utils.tracing.formatObject({
72
78
  isSessionKeyValid: Boolean(isSessionKeyValid),
73
79
  }));
74
80
  if (isSessionKeyValid) {
75
81
  // scenario 1 - session is valid and registered
76
- return decodedSessionKeys;
82
+ return existingSessionKey;
77
83
  }
78
84
  utils.tracing.logEvent('session-key', 'decodedSessionKeys', utils.tracing.formatObject({
79
- publicKey: decodedSessionKeys.publicKey,
80
- registered: decodedSessionKeys.registered,
85
+ publicKey: existingSessionKey.publicKey,
86
+ registered: existingSessionKey.registered,
81
87
  }));
82
88
  let publicKey;
83
89
  let privateKey;
84
90
  let privateKeyJwk;
85
91
  let prevSessionKeySignature = undefined;
86
- if (!decodedSessionKeys.registered) {
92
+ if (!existingSessionKey.registered) {
87
93
  // scenario 2 - session needs to be registered
88
- ({ publicKey, privateKey, privateKeyJwk } = decodedSessionKeys);
94
+ ({ publicKey, privateKey, privateKeyJwk } = existingSessionKey);
89
95
  }
90
96
  else {
91
97
  // scenario 3 - session expired singing with the old key and generating a new one
92
- prevSessionKeySignature = yield keyService.p256Sign(decodedSessionKeys.privateKeyJwk, user.sessionId);
93
- ({ publicKey, privateKey, privateKeyJwk } = yield generateSessionKey());
98
+ prevSessionKeySignature = yield keyService.p256Sign(existingSessionKey.privateKeyJwk, user.sessionId);
99
+ // Note that the key is only generated here, it will get saved to storage in the registerHelper
100
+ ({ publicKey, privateKey, privateKeyJwk } = yield embeddedWalletSessionKeysUtils.generateSessionKey());
94
101
  utils.tracing.logEvent('session-key', 'Loaded prevSessionKeySignature', utils.tracing.formatObject({ prevSessionKeySignature, publicKey }));
95
102
  }
96
103
  return registerHelper({
@@ -102,20 +109,6 @@ const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
102
109
  user,
103
110
  });
104
111
  });
105
- const generateSessionKey = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
106
- const { private: privateKey, public: publicKey, privateJwk, } = yield keyService.p256Keygen();
107
- // convert to base64 and store the session keys in session storage
108
- utils.tracing.logEvent('session-key', 'Generated new session key', utils.tracing.formatObject({
109
- publicKey,
110
- }));
111
- utils.StorageService.setItem(localStorage.SECURE_ENCLAVE_WALLET_SESSION_KEYS, keyService.toEncodedFormat(publicKey, privateKey, privateJwk, false), localStorage.SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS);
112
- return {
113
- privateKey,
114
- privateKeyJwk: privateJwk,
115
- publicKey,
116
- registered: false,
117
- };
118
- });
119
112
  const getSessionPublicKey = () => {
120
113
  const decodedSessionKeys = getDecodedSessionKeys();
121
114
  if (!(decodedSessionKeys === null || decodedSessionKeys === void 0 ? void 0 : decodedSessionKeys.publicKey)) {
@@ -150,7 +143,7 @@ const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
150
143
  /////////////////////
151
144
  // Helper Methods ///
152
145
  /////////////////////
153
- const registerHelper = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ environmentId, prevSessionKeySignature, publicKey, privateKey, privateKeyJwk, user, }) {
146
+ const registerHelper = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ environmentId, privateKey, privateKeyJwk, publicKey, prevSessionKeySignature, user, }) {
154
147
  let resp;
155
148
  const primaryWalletId$1 = primaryWalletId.getPrimaryWalletId();
156
149
  if (!primaryWalletId$1) {
@@ -172,6 +165,7 @@ const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
172
165
  walletConnectorCore.logger.warn('Invalid embedded wallet session key. Re-authentication is required to create new session keys.');
173
166
  dynamicEvents.dynamicEvents.emit('triggerLogout');
174
167
  }
168
+ walletConnectorCore.logger.error('Error registering session key', { error });
175
169
  throw error;
176
170
  }
177
171
  const expirationDate = new Date(resp.expiresAt * 1000);
@@ -180,7 +174,11 @@ const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
180
174
  publicKey,
181
175
  }));
182
176
  utils.StorageService.setItem(localStorage.SECURE_ENCLAVE_WALLET_SESSION_KEYS, keyService.toEncodedFormat(publicKey, privateKey, privateKeyJwk, true, expirationDate), localStorage.SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS);
183
- return { expirationDate, privateKey, publicKey };
177
+ return {
178
+ expirationDate,
179
+ privateKey,
180
+ publicKey,
181
+ };
184
182
  });
185
183
  const getDecodedSessionKeys = () => {
186
184
  const sessionKeysSS = utils.StorageService.getItem(localStorage.SECURE_ENCLAVE_WALLET_SESSION_KEYS, localStorage.SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS);
@@ -189,7 +187,7 @@ const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
189
187
  : undefined;
190
188
  };
191
189
  return {
192
- generateSessionKey,
190
+ generateSessionKey: embeddedWalletSessionKeysUtils.generateAndSaveSessionKey,
193
191
  getSessionPublicKey,
194
192
  getSignedSessionId,
195
193
  registerEmbeddedWalletSessionKey,
@@ -1,11 +1,5 @@
1
1
  import { ProjectSettings } from '@dynamic-labs/sdk-api-core';
2
- type SessionKey = {
3
- publicKey: string;
4
- privateKey: string;
5
- privateKeyJwk: JsonWebKey;
6
- registered: boolean;
7
- expirationDate?: Date;
8
- };
2
+ import { SessionKey } from '../../functions/embeddedWalletSessionKeysUtils';
9
3
  export declare const useEmbeddedWalletSessionKeys: ({ environmentId, projectSettings, }: {
10
4
  environmentId: string;
11
5
  projectSettings?: ProjectSettings;
@@ -23,4 +17,3 @@ export declare const useEmbeddedWalletSessionKeys: ({ environmentId, projectSett
23
17
  removeSessionKey: () => void;
24
18
  shouldRegisterSessionKeysOnSignin: () => boolean;
25
19
  };
26
- export {};
@@ -26,10 +26,11 @@ import '../../../locale/locale.js';
26
26
  import '../../../store/state/dynamicContextProps/dynamicContextProps.js';
27
27
  import { getPrimaryWalletId } from '../../../store/state/primaryWalletId/primaryWalletId.js';
28
28
  import '../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
29
- import { p256Sign, p256Keygen, toEncodedFormat } from '../../functions/keyService/keyService.js';
29
+ import { p256Sign, toEncodedFormat } from '../../functions/keyService/keyService.js';
30
30
  import { dynamicEvents } from '../../../events/dynamicEvents.js';
31
31
  import { useOnboardingCompleteUserProfile } from '../../../client/extension/user/useOnboardingCompleteUser/useOnboardingCompleteUser.js';
32
32
  import { getPrimaryTurnkeyWalletId } from '../../functions/getPrimaryTurnkeyWalletId/getPrimaryTurnkeyWalletId.js';
33
+ import { generateAndSaveSessionKey, generateSessionKey } from '../../functions/embeddedWalletSessionKeysUtils/embeddedWalletSessionKeysUtils.js';
33
34
 
34
35
  const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
35
36
  const user = useOnboardingCompleteUserProfile();
@@ -38,17 +39,21 @@ const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
38
39
  // but never registered with the backend)
39
40
  // scenario 3: session expired and needs to be refreshed
40
41
  // Helper to get decoded session keys from storage
42
+ /**
43
+ * @param ignoreRestore - if true, will not use the session keys if they are found in storage and didn't expire
44
+ * @returns - the session key
45
+ */
41
46
  const registerEmbeddedWalletSessionKey = (...args_1) => __awaiter(void 0, [...args_1], void 0, function* ({ ignoreRestore = false, } = {}) {
42
47
  if (!user) {
43
48
  throw new Error('User not found');
44
49
  }
45
50
  // check if session keys are already stored in session storage
46
- let decodedSessionKeys = getDecodedSessionKeys();
51
+ let existingSessionKey = getDecodedSessionKeys();
47
52
  tracing.logEvent('session-key', 'registerEmbeddedWalletSessionKey', tracing.formatObject({
48
- hasDecodedSessionKeys: Boolean(decodedSessionKeys),
49
- publicKey: decodedSessionKeys === null || decodedSessionKeys === void 0 ? void 0 : decodedSessionKeys.publicKey,
53
+ hasDecodedSessionKeys: Boolean(existingSessionKey),
54
+ publicKey: existingSessionKey === null || existingSessionKey === void 0 ? void 0 : existingSessionKey.publicKey,
50
55
  }));
51
- if (!decodedSessionKeys) {
56
+ if (!existingSessionKey) {
52
57
  // We should never be in a situation where we don't have session keys in storage.
53
58
  // But right now we are in a situation where we don't have session keys in storage,
54
59
  // in many situations.
@@ -59,33 +64,35 @@ const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
59
64
  // This logic will be removed and reverted back to logging out once we find
60
65
  // the culprit that cause many of these to happen.
61
66
  logger.error('Session keys not found in storage. Generating new session keys.', { userId: user === null || user === void 0 ? void 0 : user.userId });
62
- decodedSessionKeys = yield generateSessionKey();
67
+ existingSessionKey = yield generateAndSaveSessionKey();
63
68
  }
64
- const isSessionKeyValid = decodedSessionKeys.expirationDate &&
65
- new Date() <= new Date(decodedSessionKeys.expirationDate) &&
69
+ const isSessionKeyValid = existingSessionKey.registered &&
70
+ existingSessionKey.expirationDate &&
71
+ new Date() <= new Date(existingSessionKey.expirationDate) &&
66
72
  !ignoreRestore;
67
73
  tracing.logEvent('session-key', 'isSessionKeyValid', tracing.formatObject({
68
74
  isSessionKeyValid: Boolean(isSessionKeyValid),
69
75
  }));
70
76
  if (isSessionKeyValid) {
71
77
  // scenario 1 - session is valid and registered
72
- return decodedSessionKeys;
78
+ return existingSessionKey;
73
79
  }
74
80
  tracing.logEvent('session-key', 'decodedSessionKeys', tracing.formatObject({
75
- publicKey: decodedSessionKeys.publicKey,
76
- registered: decodedSessionKeys.registered,
81
+ publicKey: existingSessionKey.publicKey,
82
+ registered: existingSessionKey.registered,
77
83
  }));
78
84
  let publicKey;
79
85
  let privateKey;
80
86
  let privateKeyJwk;
81
87
  let prevSessionKeySignature = undefined;
82
- if (!decodedSessionKeys.registered) {
88
+ if (!existingSessionKey.registered) {
83
89
  // scenario 2 - session needs to be registered
84
- ({ publicKey, privateKey, privateKeyJwk } = decodedSessionKeys);
90
+ ({ publicKey, privateKey, privateKeyJwk } = existingSessionKey);
85
91
  }
86
92
  else {
87
93
  // scenario 3 - session expired singing with the old key and generating a new one
88
- prevSessionKeySignature = yield p256Sign(decodedSessionKeys.privateKeyJwk, user.sessionId);
94
+ prevSessionKeySignature = yield p256Sign(existingSessionKey.privateKeyJwk, user.sessionId);
95
+ // Note that the key is only generated here, it will get saved to storage in the registerHelper
89
96
  ({ publicKey, privateKey, privateKeyJwk } = yield generateSessionKey());
90
97
  tracing.logEvent('session-key', 'Loaded prevSessionKeySignature', tracing.formatObject({ prevSessionKeySignature, publicKey }));
91
98
  }
@@ -98,20 +105,6 @@ const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
98
105
  user,
99
106
  });
100
107
  });
101
- const generateSessionKey = () => __awaiter(void 0, void 0, void 0, function* () {
102
- const { private: privateKey, public: publicKey, privateJwk, } = yield p256Keygen();
103
- // convert to base64 and store the session keys in session storage
104
- tracing.logEvent('session-key', 'Generated new session key', tracing.formatObject({
105
- publicKey,
106
- }));
107
- StorageService.setItem(SECURE_ENCLAVE_WALLET_SESSION_KEYS, toEncodedFormat(publicKey, privateKey, privateJwk, false), SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS);
108
- return {
109
- privateKey,
110
- privateKeyJwk: privateJwk,
111
- publicKey,
112
- registered: false,
113
- };
114
- });
115
108
  const getSessionPublicKey = () => {
116
109
  const decodedSessionKeys = getDecodedSessionKeys();
117
110
  if (!(decodedSessionKeys === null || decodedSessionKeys === void 0 ? void 0 : decodedSessionKeys.publicKey)) {
@@ -146,7 +139,7 @@ const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
146
139
  /////////////////////
147
140
  // Helper Methods ///
148
141
  /////////////////////
149
- const registerHelper = (_a) => __awaiter(void 0, [_a], void 0, function* ({ environmentId, prevSessionKeySignature, publicKey, privateKey, privateKeyJwk, user, }) {
142
+ const registerHelper = (_a) => __awaiter(void 0, [_a], void 0, function* ({ environmentId, privateKey, privateKeyJwk, publicKey, prevSessionKeySignature, user, }) {
150
143
  let resp;
151
144
  const primaryWalletId = getPrimaryWalletId();
152
145
  if (!primaryWalletId) {
@@ -168,6 +161,7 @@ const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
168
161
  logger.warn('Invalid embedded wallet session key. Re-authentication is required to create new session keys.');
169
162
  dynamicEvents.emit('triggerLogout');
170
163
  }
164
+ logger.error('Error registering session key', { error });
171
165
  throw error;
172
166
  }
173
167
  const expirationDate = new Date(resp.expiresAt * 1000);
@@ -176,7 +170,11 @@ const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
176
170
  publicKey,
177
171
  }));
178
172
  StorageService.setItem(SECURE_ENCLAVE_WALLET_SESSION_KEYS, toEncodedFormat(publicKey, privateKey, privateKeyJwk, true, expirationDate), SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS);
179
- return { expirationDate, privateKey, publicKey };
173
+ return {
174
+ expirationDate,
175
+ privateKey,
176
+ publicKey,
177
+ };
180
178
  });
181
179
  const getDecodedSessionKeys = () => {
182
180
  const sessionKeysSS = StorageService.getItem(SECURE_ENCLAVE_WALLET_SESSION_KEYS, SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS);
@@ -185,7 +183,7 @@ const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
185
183
  : undefined;
186
184
  };
187
185
  return {
188
- generateSessionKey,
186
+ generateSessionKey: generateAndSaveSessionKey,
189
187
  getSessionPublicKey,
190
188
  getSignedSessionId,
191
189
  registerEmbeddedWalletSessionKey,
@@ -7,35 +7,36 @@ var _tslib = require('../../../../../_virtual/_tslib.cjs');
7
7
  var React = require('react');
8
8
  var utils = require('@dynamic-labs/utils');
9
9
  var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
10
- require('../../../context/DynamicContext/DynamicContext.cjs');
11
- require('../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
10
+ require('@dynamic-labs-sdk/client/core');
12
11
  require('@dynamic-labs/sdk-api-core');
13
- require('../../../shared/logger.cjs');
12
+ require('@dynamic-labs-sdk/client');
13
+ require('../../../client/client.cjs');
14
+ require('../../constants/values.cjs');
15
+ var errors = require('../../constants/errors.cjs');
16
+ require('@dynamic-labs/multi-wallet');
17
+ var logger = require('../../../shared/logger.cjs');
18
+ require('../../constants/colors.cjs');
19
+ require('react-international-phone');
14
20
  require('@dynamic-labs/iconic');
15
21
  require('react/jsx-runtime');
16
22
  require('../../../context/ViewContext/ViewContext.cjs');
17
23
  require('@dynamic-labs/wallet-book');
18
- require('../../constants/colors.cjs');
19
- require('../../constants/values.cjs');
20
24
  require('../../../shared/consts/index.cjs');
21
- require('../../../events/dynamicEvents.cjs');
22
- require('../../../context/CaptchaContext/CaptchaContext.cjs');
23
- require('../../../context/ErrorContext/ErrorContext.cjs');
24
- var errors = require('../../constants/errors.cjs');
25
- require('@dynamic-labs/multi-wallet');
26
- require('react-international-phone');
27
25
  var getVerifyArgs = require('../../functions/getVerifyArgs/getVerifyArgs.cjs');
28
26
  var updatePrimaryWalletId = require('../../functions/updatePrimaryWalletId/updatePrimaryWalletId.cjs');
29
27
  require('../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
30
- require('../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
28
+ var dynamicContextProps = require('../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
31
29
  require('../../../store/state/primaryWalletId/primaryWalletId.cjs');
30
+ require('../../../events/dynamicEvents.cjs');
31
+ require('../../../store/state/projectSettings/projectSettings.cjs');
32
+ var useOnboardingCompleteUser = require('../../../client/extension/user/useOnboardingCompleteUser/useOnboardingCompleteUser.cjs');
33
+ require('../../../context/DynamicContext/DynamicContext.cjs');
34
+ require('../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
35
+ require('../../../context/CaptchaContext/CaptchaContext.cjs');
36
+ require('../../../context/ErrorContext/ErrorContext.cjs');
32
37
  require('../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
33
38
  require('../../../context/AccountExistsContext/AccountExistsContext.cjs');
34
39
  var UserWalletsContext = require('../../../context/UserWalletsContext/UserWalletsContext.cjs');
35
- require('@dynamic-labs-sdk/client/core');
36
- require('@dynamic-labs-sdk/client');
37
- require('../../../client/client.cjs');
38
- require('../../../store/state/projectSettings/projectSettings.cjs');
39
40
  require('../../../config/ApiEndpoint.cjs');
40
41
  require('../../../locale/locale.cjs');
41
42
  var wallets = require('../../../data/api/wallets/wallets.cjs');
@@ -107,25 +108,21 @@ require('../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
107
108
  var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
108
109
 
109
110
  const useTransferWallet = () => {
110
- const { displaySiweStatement, environmentId, user, primaryWallet } = useInternalDynamicContext.useInternalDynamicContext();
111
+ const user = useOnboardingCompleteUser.useOnboardingCompleteUser();
112
+ const { displaySiweStatement, events } = dynamicContextProps.useDynamicSettings();
113
+ const environmentId = dynamicContextProps.useEnvironmentId();
114
+ const { primaryWallet } = useInternalDynamicContext.useInternalDynamicContext();
111
115
  const { addedWalletsIds } = UserWalletsContext.useInternalUserWallets();
112
116
  const updatePrimaryWallet = React.useCallback((walletConnector, user) => {
113
- const newWalletKey = walletConnector.key;
114
- if (user.lastVerifiedCredentialId) {
115
- if (!primaryWallet) {
116
- updatePrimaryWalletId.updatePrimaryWalletId(user.lastVerifiedCredentialId);
117
- return;
118
- }
119
- const currentPrimaryWalletKey = primaryWallet.connector.key;
120
- if (newWalletKey === currentPrimaryWalletKey) {
121
- updatePrimaryWalletId.updatePrimaryWalletId(user.lastVerifiedCredentialId);
122
- }
123
- // if both wallets are flow wallets, set the last verified wallet as primary
124
- // this is a limitation of flow as all wallets use the same flow connector
125
- if (primaryWallet.connector.connectedChain === 'FLOW' &&
126
- walletConnector.connectedChain === 'FLOW') {
127
- updatePrimaryWalletId.updatePrimaryWalletId(user.lastVerifiedCredentialId);
128
- }
117
+ const credentialId = user.lastVerifiedCredentialId;
118
+ if (!credentialId)
119
+ return;
120
+ const shouldUpdatePrimary = !primaryWallet ||
121
+ walletConnector.key === primaryWallet.connector.key ||
122
+ (primaryWallet.connector.connectedChain === 'FLOW' &&
123
+ walletConnector.connectedChain === 'FLOW');
124
+ if (shouldUpdatePrimary) {
125
+ updatePrimaryWalletId.updatePrimaryWalletId(credentialId);
129
126
  }
130
127
  }, [primaryWallet]);
131
128
  return React.useCallback((props) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
@@ -135,6 +132,17 @@ const useTransferWallet = () => {
135
132
  const args = Object.assign(Object.assign({}, props), { displaySiweStatement,
136
133
  environmentId, siweStatement: overrideSiweStatement, walletProvider: walletConnectorCore.getWalletProvider(walletConnector) });
137
134
  const verifyArgs = yield getVerifyArgs.getVerifyArgs(args);
135
+ if (events === null || events === void 0 ? void 0 : events.onSignedMessage) {
136
+ try {
137
+ events.onSignedMessage({
138
+ messageToSign: verifyArgs.messageToSign,
139
+ signedMessage: verifyArgs.signedMessage,
140
+ });
141
+ }
142
+ catch (error) {
143
+ logger.logger.warn('Error calling onSignedMessage callback:', error);
144
+ }
145
+ }
138
146
  const userProfile = yield wallets.transferWallet(environmentId, verifyArgs);
139
147
  if (!userProfile) {
140
148
  throw new utils.DynamicError('Error transferring wallet.');
@@ -148,6 +156,7 @@ const useTransferWallet = () => {
148
156
  addedWalletsIds,
149
157
  displaySiweStatement,
150
158
  environmentId,
159
+ events,
151
160
  updatePrimaryWallet,
152
161
  user,
153
162
  ]);
@@ -3,35 +3,36 @@ import { __awaiter } from '../../../../../_virtual/_tslib.js';
3
3
  import { useCallback } from 'react';
4
4
  import { DynamicError } from '@dynamic-labs/utils';
5
5
  import { getWalletProvider } from '@dynamic-labs/wallet-connector-core';
6
- import '../../../context/DynamicContext/DynamicContext.js';
7
- import '../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
6
+ import '@dynamic-labs-sdk/client/core';
8
7
  import '@dynamic-labs/sdk-api-core';
9
- import '../../../shared/logger.js';
8
+ import '@dynamic-labs-sdk/client';
9
+ import '../../../client/client.js';
10
+ import '../../constants/values.js';
11
+ import { USER_NOT_LOGGED_IN } from '../../constants/errors.js';
12
+ import '@dynamic-labs/multi-wallet';
13
+ import { logger } from '../../../shared/logger.js';
14
+ import '../../constants/colors.js';
15
+ import 'react-international-phone';
10
16
  import '@dynamic-labs/iconic';
11
17
  import 'react/jsx-runtime';
12
18
  import '../../../context/ViewContext/ViewContext.js';
13
19
  import '@dynamic-labs/wallet-book';
14
- import '../../constants/colors.js';
15
- import '../../constants/values.js';
16
20
  import '../../../shared/consts/index.js';
17
- import '../../../events/dynamicEvents.js';
18
- import '../../../context/CaptchaContext/CaptchaContext.js';
19
- import '../../../context/ErrorContext/ErrorContext.js';
20
- import { USER_NOT_LOGGED_IN } from '../../constants/errors.js';
21
- import '@dynamic-labs/multi-wallet';
22
- import 'react-international-phone';
23
21
  import { getVerifyArgs } from '../../functions/getVerifyArgs/getVerifyArgs.js';
24
22
  import { updatePrimaryWalletId } from '../../functions/updatePrimaryWalletId/updatePrimaryWalletId.js';
25
23
  import '../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
26
- import '../../../store/state/dynamicContextProps/dynamicContextProps.js';
24
+ import { useDynamicSettings, useEnvironmentId } from '../../../store/state/dynamicContextProps/dynamicContextProps.js';
27
25
  import '../../../store/state/primaryWalletId/primaryWalletId.js';
26
+ import '../../../events/dynamicEvents.js';
27
+ import '../../../store/state/projectSettings/projectSettings.js';
28
+ import { useOnboardingCompleteUser } from '../../../client/extension/user/useOnboardingCompleteUser/useOnboardingCompleteUser.js';
29
+ import '../../../context/DynamicContext/DynamicContext.js';
30
+ import '../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
31
+ import '../../../context/CaptchaContext/CaptchaContext.js';
32
+ import '../../../context/ErrorContext/ErrorContext.js';
28
33
  import '../../../context/AccessDeniedContext/AccessDeniedContext.js';
29
34
  import '../../../context/AccountExistsContext/AccountExistsContext.js';
30
35
  import { useInternalUserWallets } from '../../../context/UserWalletsContext/UserWalletsContext.js';
31
- import '@dynamic-labs-sdk/client/core';
32
- import '@dynamic-labs-sdk/client';
33
- import '../../../client/client.js';
34
- import '../../../store/state/projectSettings/projectSettings.js';
35
36
  import '../../../config/ApiEndpoint.js';
36
37
  import '../../../locale/locale.js';
37
38
  import { transferWallet } from '../../../data/api/wallets/wallets.js';
@@ -103,25 +104,21 @@ import '../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
103
104
  import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
104
105
 
105
106
  const useTransferWallet = () => {
106
- const { displaySiweStatement, environmentId, user, primaryWallet } = useInternalDynamicContext();
107
+ const user = useOnboardingCompleteUser();
108
+ const { displaySiweStatement, events } = useDynamicSettings();
109
+ const environmentId = useEnvironmentId();
110
+ const { primaryWallet } = useInternalDynamicContext();
107
111
  const { addedWalletsIds } = useInternalUserWallets();
108
112
  const updatePrimaryWallet = useCallback((walletConnector, user) => {
109
- const newWalletKey = walletConnector.key;
110
- if (user.lastVerifiedCredentialId) {
111
- if (!primaryWallet) {
112
- updatePrimaryWalletId(user.lastVerifiedCredentialId);
113
- return;
114
- }
115
- const currentPrimaryWalletKey = primaryWallet.connector.key;
116
- if (newWalletKey === currentPrimaryWalletKey) {
117
- updatePrimaryWalletId(user.lastVerifiedCredentialId);
118
- }
119
- // if both wallets are flow wallets, set the last verified wallet as primary
120
- // this is a limitation of flow as all wallets use the same flow connector
121
- if (primaryWallet.connector.connectedChain === 'FLOW' &&
122
- walletConnector.connectedChain === 'FLOW') {
123
- updatePrimaryWalletId(user.lastVerifiedCredentialId);
124
- }
113
+ const credentialId = user.lastVerifiedCredentialId;
114
+ if (!credentialId)
115
+ return;
116
+ const shouldUpdatePrimary = !primaryWallet ||
117
+ walletConnector.key === primaryWallet.connector.key ||
118
+ (primaryWallet.connector.connectedChain === 'FLOW' &&
119
+ walletConnector.connectedChain === 'FLOW');
120
+ if (shouldUpdatePrimary) {
121
+ updatePrimaryWalletId(credentialId);
125
122
  }
126
123
  }, [primaryWallet]);
127
124
  return useCallback((props) => __awaiter(void 0, void 0, void 0, function* () {
@@ -131,6 +128,17 @@ const useTransferWallet = () => {
131
128
  const args = Object.assign(Object.assign({}, props), { displaySiweStatement,
132
129
  environmentId, siweStatement: overrideSiweStatement, walletProvider: getWalletProvider(walletConnector) });
133
130
  const verifyArgs = yield getVerifyArgs(args);
131
+ if (events === null || events === void 0 ? void 0 : events.onSignedMessage) {
132
+ try {
133
+ events.onSignedMessage({
134
+ messageToSign: verifyArgs.messageToSign,
135
+ signedMessage: verifyArgs.signedMessage,
136
+ });
137
+ }
138
+ catch (error) {
139
+ logger.warn('Error calling onSignedMessage callback:', error);
140
+ }
141
+ }
134
142
  const userProfile = yield transferWallet(environmentId, verifyArgs);
135
143
  if (!userProfile) {
136
144
  throw new DynamicError('Error transferring wallet.');
@@ -144,6 +152,7 @@ const useTransferWallet = () => {
144
152
  addedWalletsIds,
145
153
  displaySiweStatement,
146
154
  environmentId,
155
+ events,
147
156
  updatePrimaryWallet,
148
157
  user,
149
158
  ]);
@@ -5,11 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var _tslib = require('../../../../../../../_virtual/_tslib.cjs');
7
7
  var jsxRuntime = require('react/jsx-runtime');
8
+ var reactI18next = require('react-i18next');
8
9
  var utils = require('@dynamic-labs/utils');
9
10
  var walletBook = require('@dynamic-labs/wallet-book');
10
11
  var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
11
12
  require('../../../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
12
- require('react-i18next');
13
13
  require('react');
14
14
  require('@dynamic-labs/iconic');
15
15
  require('../../../../../context/ViewContext/ViewContext.cjs');
@@ -108,6 +108,7 @@ require('../../../../../components/Popper/Popper/Popper.cjs');
108
108
  require('../../../../../components/Popper/PopperContext/PopperContext.cjs');
109
109
 
110
110
  const DefaultPendingSignModalContent = () => {
111
+ const { t } = reactI18next.useTranslation();
111
112
  const { selectedWalletConnector, setMultiWalletWidgetState } = useInternalDynamicContext.useInternalDynamicContext();
112
113
  const { signAlreadyConnectedUser } = useConnectAndSignSplitSteps.useConnectAndSignSplitSteps();
113
114
  const onClickToSign = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
@@ -125,8 +126,8 @@ const DefaultPendingSignModalContent = () => {
125
126
  setMultiWalletWidgetState('idle');
126
127
  }
127
128
  });
128
- return (jsxRuntime.jsxs(DefaultPromptModal.DefaultPromptModal, { onClose: useCloseMultiWalletPrompt.useCloseMultiWalletPrompt(), dataTestId: 'pending-account-switch', icon: jsxRuntime.jsx(walletBook.WalletIcon, { icon: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.metadata.icon, walletKey: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.key }), children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', weight: 'regular', "data-testid": 'content', children: "Sign the message in your wallet to approve linking this wallet to your account" }), utils.isMobile() &&
129
- !(selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.canConnectViaCustodialService) && (jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonClassName: 'default-prompt-modal__button', expanded: true, type: 'button', buttonPadding: 'medium', typographyProps: { variant: 'button_secondary' }, onClick: onClickToSign, dataTestId: 'click-to-sign-button', children: "Click to Sign" }))] }));
129
+ return (jsxRuntime.jsxs(DefaultPromptModal.DefaultPromptModal, { onClose: useCloseMultiWalletPrompt.useCloseMultiWalletPrompt(), dataTestId: 'pending-account-switch', icon: jsxRuntime.jsx(walletBook.WalletIcon, { icon: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.metadata.icon, walletKey: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.key }), children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', weight: 'regular', "data-testid": 'content', copykey: 'dyn_pending_signature.link_wallet_message', children: t('dyn_pending_signature.link_wallet_message') }), utils.isMobile() &&
130
+ !(selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.canConnectViaCustodialService) && (jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonClassName: 'default-prompt-modal__button', expanded: true, type: 'button', buttonPadding: 'medium', typographyProps: { variant: 'button_secondary' }, onClick: onClickToSign, dataTestId: 'click-to-sign-button', copykey: 'dyn_pending_signature.click_to_sign', children: t('dyn_pending_signature.click_to_sign') }))] }));
130
131
  };
131
132
 
132
133
  exports.DefaultPendingSignModalContent = DefaultPendingSignModalContent;
@@ -1,11 +1,11 @@
1
1
  'use client'
2
2
  import { __awaiter } from '../../../../../../../_virtual/_tslib.js';
3
3
  import { jsxs, jsx } from 'react/jsx-runtime';
4
+ import { useTranslation } from 'react-i18next';
4
5
  import { isMobile } from '@dynamic-labs/utils';
5
6
  import { WalletIcon } from '@dynamic-labs/wallet-book';
6
7
  import { logger } from '@dynamic-labs/wallet-connector-core';
7
8
  import '../../../../../components/Accordion/components/AccordionItem/AccordionItem.js';
8
- import 'react-i18next';
9
9
  import 'react';
10
10
  import '@dynamic-labs/iconic';
11
11
  import '../../../../../context/ViewContext/ViewContext.js';
@@ -104,6 +104,7 @@ import '../../../../../components/Popper/Popper/Popper.js';
104
104
  import '../../../../../components/Popper/PopperContext/PopperContext.js';
105
105
 
106
106
  const DefaultPendingSignModalContent = () => {
107
+ const { t } = useTranslation();
107
108
  const { selectedWalletConnector, setMultiWalletWidgetState } = useInternalDynamicContext();
108
109
  const { signAlreadyConnectedUser } = useConnectAndSignSplitSteps();
109
110
  const onClickToSign = () => __awaiter(void 0, void 0, void 0, function* () {
@@ -121,8 +122,8 @@ const DefaultPendingSignModalContent = () => {
121
122
  setMultiWalletWidgetState('idle');
122
123
  }
123
124
  });
124
- return (jsxs(DefaultPromptModal, { onClose: useCloseMultiWalletPrompt(), dataTestId: 'pending-account-switch', icon: jsx(WalletIcon, { icon: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.metadata.icon, walletKey: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.key }), children: [jsx(Typography, { variant: 'body_normal', color: 'secondary', weight: 'regular', "data-testid": 'content', children: "Sign the message in your wallet to approve linking this wallet to your account" }), isMobile() &&
125
- !(selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.canConnectViaCustodialService) && (jsx(TypographyButton, { buttonClassName: 'default-prompt-modal__button', expanded: true, type: 'button', buttonPadding: 'medium', typographyProps: { variant: 'button_secondary' }, onClick: onClickToSign, dataTestId: 'click-to-sign-button', children: "Click to Sign" }))] }));
125
+ return (jsxs(DefaultPromptModal, { onClose: useCloseMultiWalletPrompt(), dataTestId: 'pending-account-switch', icon: jsx(WalletIcon, { icon: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.metadata.icon, walletKey: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.key }), children: [jsx(Typography, { variant: 'body_normal', color: 'secondary', weight: 'regular', "data-testid": 'content', copykey: 'dyn_pending_signature.link_wallet_message', children: t('dyn_pending_signature.link_wallet_message') }), isMobile() &&
126
+ !(selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.canConnectViaCustodialService) && (jsx(TypographyButton, { buttonClassName: 'default-prompt-modal__button', expanded: true, type: 'button', buttonPadding: 'medium', typographyProps: { variant: 'button_secondary' }, onClick: onClickToSign, dataTestId: 'click-to-sign-button', copykey: 'dyn_pending_signature.click_to_sign', children: t('dyn_pending_signature.click_to_sign') }))] }));
126
127
  };
127
128
 
128
129
  export { DefaultPendingSignModalContent };
@@ -1,11 +0,0 @@
1
- type Props = {
2
- environmentId: string;
3
- sessionKeys: string | undefined;
4
- setSessionKeySessionStorage: (sessionKeysBase64: string) => void;
5
- };
6
- export declare const getSessionKeyCompatibleConnectorFetchers: ({ environmentId, sessionKeys, setSessionKeySessionStorage, }: Props) => {
7
- registerEmbeddedWalletSessionKey: ({ ignoreRestore, }?: {
8
- ignoreRestore?: boolean;
9
- }) => Promise<any>;
10
- };
11
- export {};