@dynamic-labs/sdk-react-core 4.91.4 → 4.91.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +12 -12
- package/src/lib/utils/functions/findTurnkeyWallet/findTurnkeyWallet.cjs +24 -0
- package/src/lib/utils/functions/findTurnkeyWallet/findTurnkeyWallet.d.ts +3 -1
- package/src/lib/utils/functions/findTurnkeyWallet/findTurnkeyWallet.js +23 -1
- package/src/lib/utils/functions/findTurnkeyWallet/index.d.ts +1 -1
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.d.ts +3 -1
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.cjs +17 -4
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.d.ts +4 -2
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.js +19 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
|
|
2
|
+
### [4.91.6](https://github.com/dynamic-labs/dynamic-auth/compare/v4.91.5...v4.91.6) (2026-07-03)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* **react-native:** ensure webview loads on cold start ([#11787](https://github.com/dynamic-labs/dynamic-auth/issues/11787)) ([8f3dc8e](https://github.com/dynamic-labs/dynamic-auth/commit/8f3dc8e2a7de06f012ea6e922d4e76aee1c84c1a))
|
|
8
|
+
|
|
9
|
+
### [4.91.5](https://github.com/dynamic-labs/dynamic-auth/compare/v4.91.4...v4.91.5) (2026-07-02)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* revoke WaaS signed-session callback on client rebuild to stop iOS nonce race ([#11766](https://github.com/dynamic-labs/dynamic-auth/issues/11766)) ([c895b5d](https://github.com/dynamic-labs/dynamic-auth/commit/c895b5d0987d62a9f5597741dbeae0ec7fedfe5b))
|
|
15
|
+
* **sdk-react-core:** allow sendOneTimeCode to target non-primary chain wallets ([#11777](https://github.com/dynamic-labs/dynamic-auth/issues/11777)) ([63f82af](https://github.com/dynamic-labs/dynamic-auth/commit/63f82af7c52be595bc2948ec88ee9c919ac9275a))
|
|
16
|
+
* **webview-controller:** resolve post-login wallet race in Viem and ZeroDev controllers ([#11774](https://github.com/dynamic-labs/dynamic-auth/issues/11774)) ([95ed26e](https://github.com/dynamic-labs/dynamic-auth/commit/95ed26eee09d9aff5a5af6517ab7e1360ef5f337))
|
|
17
|
+
|
|
2
18
|
### [4.91.4](https://github.com/dynamic-labs/dynamic-auth/compare/v4.91.3...v4.91.4) (2026-07-01)
|
|
3
19
|
|
|
4
20
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "4.91.
|
|
3
|
+
"version": "4.91.6",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@dynamic-labs/sdk-api-core": "0.0.1046",
|
|
6
6
|
"@dynamic-labs-sdk/client": "1.12.1",
|
|
@@ -17,17 +17,17 @@
|
|
|
17
17
|
"yup": "0.32.11",
|
|
18
18
|
"react-international-phone": "4.5.0",
|
|
19
19
|
"bs58": "5.0.0",
|
|
20
|
-
"@dynamic-labs/assert-package-version": "4.91.
|
|
21
|
-
"@dynamic-labs/iconic": "4.91.
|
|
22
|
-
"@dynamic-labs/locale": "4.91.
|
|
23
|
-
"@dynamic-labs/logger": "4.91.
|
|
24
|
-
"@dynamic-labs/multi-wallet": "4.91.
|
|
25
|
-
"@dynamic-labs/rpc-providers": "4.91.
|
|
26
|
-
"@dynamic-labs/store": "4.91.
|
|
27
|
-
"@dynamic-labs/types": "4.91.
|
|
28
|
-
"@dynamic-labs/utils": "4.91.
|
|
29
|
-
"@dynamic-labs/wallet-book": "4.91.
|
|
30
|
-
"@dynamic-labs/wallet-connector-core": "4.91.
|
|
20
|
+
"@dynamic-labs/assert-package-version": "4.91.6",
|
|
21
|
+
"@dynamic-labs/iconic": "4.91.6",
|
|
22
|
+
"@dynamic-labs/locale": "4.91.6",
|
|
23
|
+
"@dynamic-labs/logger": "4.91.6",
|
|
24
|
+
"@dynamic-labs/multi-wallet": "4.91.6",
|
|
25
|
+
"@dynamic-labs/rpc-providers": "4.91.6",
|
|
26
|
+
"@dynamic-labs/store": "4.91.6",
|
|
27
|
+
"@dynamic-labs/types": "4.91.6",
|
|
28
|
+
"@dynamic-labs/utils": "4.91.6",
|
|
29
|
+
"@dynamic-labs/wallet-book": "4.91.6",
|
|
30
|
+
"@dynamic-labs/wallet-connector-core": "4.91.6",
|
|
31
31
|
"eventemitter3": "5.0.1"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
@@ -24,6 +24,30 @@ const findTurnkeyWalletByPrimaryChain = (walletOptions, chainConfigurations, ver
|
|
|
24
24
|
}
|
|
25
25
|
return Object.assign(Object.assign({}, turnkeyVC), walletConnector);
|
|
26
26
|
};
|
|
27
|
+
const findTurnkeyWalletByTargetChain = (walletOptions, chainName, verifiedCredentials) => {
|
|
28
|
+
const vcChainName = values.ChainEnumToVerifiedCredentialName[chainName];
|
|
29
|
+
const walletConnector = findTurnkeyWalletByChain(walletOptions, vcChainName);
|
|
30
|
+
const turnkeyVC = verifiedCredentials === null || verifiedCredentials === void 0 ? void 0 : verifiedCredentials.find(({ walletName, chain }) => (walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey')) && chain === vcChainName);
|
|
31
|
+
if (!walletConnector) {
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
return Object.assign(Object.assign({}, turnkeyVC), walletConnector);
|
|
35
|
+
};
|
|
36
|
+
const findFirstAvailableTurnkeyWallet = (walletOptions, chainConfigurations, verifiedCredentials) => {
|
|
37
|
+
var _a;
|
|
38
|
+
const configuredChains = (_a = chainConfigurations === null || chainConfigurations === void 0 ? void 0 : chainConfigurations.map((chain) => chain.name)) !== null && _a !== void 0 ? _a : [];
|
|
39
|
+
for (const chainName of configuredChains) {
|
|
40
|
+
if (!chainName)
|
|
41
|
+
continue;
|
|
42
|
+
const result = findTurnkeyWalletByTargetChain(walletOptions, chainName, verifiedCredentials);
|
|
43
|
+
if (result && 'id' in result) {
|
|
44
|
+
return result;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return undefined;
|
|
48
|
+
};
|
|
27
49
|
|
|
50
|
+
exports.findFirstAvailableTurnkeyWallet = findFirstAvailableTurnkeyWallet;
|
|
28
51
|
exports.findTurnkeyWalletByChain = findTurnkeyWalletByChain;
|
|
29
52
|
exports.findTurnkeyWalletByPrimaryChain = findTurnkeyWalletByPrimaryChain;
|
|
53
|
+
exports.findTurnkeyWalletByTargetChain = findTurnkeyWalletByTargetChain;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { ChainConfiguration, JwtVerifiedCredential } from '@dynamic-labs/sdk-api-core';
|
|
1
|
+
import { ChainConfiguration, ChainEnum, JwtVerifiedCredential } from '@dynamic-labs/sdk-api-core';
|
|
2
2
|
import { InternalWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
3
3
|
import { WalletOption } from '../../../shared';
|
|
4
4
|
export declare const findTurnkeyWalletByChain: (walletOptions: WalletOption[] | undefined, chainName: string | undefined) => WalletOption | undefined;
|
|
5
5
|
type FindTurnkeyWalletByChainResult = (JwtVerifiedCredential & WalletOption) | WalletOption | undefined;
|
|
6
6
|
export declare const findTurnkeyWalletByPrimaryChain: (walletOptions: WalletOption[] | undefined, chainConfigurations: ChainConfiguration[] | undefined, verifiedCredentials: JwtVerifiedCredential[]) => FindTurnkeyWalletByChainResult;
|
|
7
|
+
export declare const findTurnkeyWalletByTargetChain: (walletOptions: WalletOption[] | undefined, chainName: ChainEnum, verifiedCredentials: JwtVerifiedCredential[]) => FindTurnkeyWalletByChainResult;
|
|
8
|
+
export declare const findFirstAvailableTurnkeyWallet: (walletOptions: WalletOption[] | undefined, chainConfigurations: ChainConfiguration[] | undefined, verifiedCredentials: JwtVerifiedCredential[]) => FindTurnkeyWalletByChainResult;
|
|
7
9
|
export declare const findTurnkeyWalletByAddress: (walletOptions: WalletOption[] | undefined, verifiedCredentials: JwtVerifiedCredential[], address: string | undefined) => (JwtVerifiedCredential & {
|
|
8
10
|
walletConnector?: InternalWalletConnector;
|
|
9
11
|
}) | undefined;
|
|
@@ -20,5 +20,27 @@ const findTurnkeyWalletByPrimaryChain = (walletOptions, chainConfigurations, ver
|
|
|
20
20
|
}
|
|
21
21
|
return Object.assign(Object.assign({}, turnkeyVC), walletConnector);
|
|
22
22
|
};
|
|
23
|
+
const findTurnkeyWalletByTargetChain = (walletOptions, chainName, verifiedCredentials) => {
|
|
24
|
+
const vcChainName = ChainEnumToVerifiedCredentialName[chainName];
|
|
25
|
+
const walletConnector = findTurnkeyWalletByChain(walletOptions, vcChainName);
|
|
26
|
+
const turnkeyVC = verifiedCredentials === null || verifiedCredentials === void 0 ? void 0 : verifiedCredentials.find(({ walletName, chain }) => (walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey')) && chain === vcChainName);
|
|
27
|
+
if (!walletConnector) {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
return Object.assign(Object.assign({}, turnkeyVC), walletConnector);
|
|
31
|
+
};
|
|
32
|
+
const findFirstAvailableTurnkeyWallet = (walletOptions, chainConfigurations, verifiedCredentials) => {
|
|
33
|
+
var _a;
|
|
34
|
+
const configuredChains = (_a = chainConfigurations === null || chainConfigurations === void 0 ? void 0 : chainConfigurations.map((chain) => chain.name)) !== null && _a !== void 0 ? _a : [];
|
|
35
|
+
for (const chainName of configuredChains) {
|
|
36
|
+
if (!chainName)
|
|
37
|
+
continue;
|
|
38
|
+
const result = findTurnkeyWalletByTargetChain(walletOptions, chainName, verifiedCredentials);
|
|
39
|
+
if (result && 'id' in result) {
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return undefined;
|
|
44
|
+
};
|
|
23
45
|
|
|
24
|
-
export { findTurnkeyWalletByChain, findTurnkeyWalletByPrimaryChain };
|
|
46
|
+
export { findFirstAvailableTurnkeyWallet, findTurnkeyWalletByChain, findTurnkeyWalletByPrimaryChain, findTurnkeyWalletByTargetChain };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { findTurnkeyWalletByChain, findTurnkeyWalletByPrimaryChain, findTurnkeyWalletByAddress, } from './findTurnkeyWallet';
|
|
1
|
+
export { findTurnkeyWalletByChain, findTurnkeyWalletByPrimaryChain, findTurnkeyWalletByTargetChain, findFirstAvailableTurnkeyWallet, findTurnkeyWalletByAddress, } from './findTurnkeyWallet';
|
|
@@ -36,7 +36,9 @@ export declare const useEmbeddedWallet: () => {
|
|
|
36
36
|
type: "privateKey" | "recoveryPhrase";
|
|
37
37
|
htmlContainerId?: string | undefined;
|
|
38
38
|
} | undefined) => Promise<boolean>;
|
|
39
|
-
readonly sendOneTimeCode: (
|
|
39
|
+
readonly sendOneTimeCode: (options?: {
|
|
40
|
+
chainName?: import("@dynamic-labs/sdk-api-core").ChainEnum | undefined;
|
|
41
|
+
} | undefined) => Promise<string>;
|
|
40
42
|
readonly shouldAutoCreateEmbeddedWallet: () => boolean;
|
|
41
43
|
readonly shouldPromptForKeyExport: () => boolean;
|
|
42
44
|
readonly userHasEmbeddedWallet: () => boolean;
|
|
@@ -405,14 +405,26 @@ const useSecureEnclaveEmbeddedWallet = () => {
|
|
|
405
405
|
]);
|
|
406
406
|
/**
|
|
407
407
|
* Sends a one-time code to the user so they can create a session or add a new passkey
|
|
408
|
+
* @param options - optional parameter to target a specific wallet by chain
|
|
408
409
|
* @returns Promise<'code_sent'>
|
|
409
410
|
*/
|
|
410
|
-
const sendOneTimeCode = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
411
|
-
var _2, _3;
|
|
411
|
+
const sendOneTimeCode = React.useCallback((options) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
412
|
+
var _2, _3, _4, _5, _6;
|
|
412
413
|
if (!user$1) {
|
|
413
414
|
throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN, 'user_not_logged_in');
|
|
414
415
|
}
|
|
415
|
-
const
|
|
416
|
+
const chainConfigurations = (_2 = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets) === null || _2 === void 0 ? void 0 : _2.chainConfigurations;
|
|
417
|
+
const primaryWalletIsTurnkey = (_3 = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) === null || _3 === void 0 ? void 0 : _3.key.startsWith('turnkey');
|
|
418
|
+
const primaryWalletChain = primaryWalletIsTurnkey
|
|
419
|
+
? primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.chain
|
|
420
|
+
: undefined;
|
|
421
|
+
const primaryConfiguredChain = (_5 = (_4 = chainConfigurations === null || chainConfigurations === void 0 ? void 0 : chainConfigurations.find((chain) => chain.primary)) === null || _4 === void 0 ? void 0 : _4.name) !== null && _5 !== void 0 ? _5 : sdkApiCore.ChainEnum.Evm;
|
|
422
|
+
const targetChain = (options === null || options === void 0 ? void 0 : options.chainName) || primaryWalletChain || primaryConfiguredChain;
|
|
423
|
+
let targetTurnkeyWallet = findTurnkeyWallet.findTurnkeyWalletByTargetChain(walletConnectorOptions, targetChain, user$1.verifiedCredentials);
|
|
424
|
+
if (!(options === null || options === void 0 ? void 0 : options.chainName) &&
|
|
425
|
+
(!targetTurnkeyWallet || !('id' in targetTurnkeyWallet))) {
|
|
426
|
+
targetTurnkeyWallet = findTurnkeyWallet.findFirstAvailableTurnkeyWallet(walletConnectorOptions, chainConfigurations, user$1.verifiedCredentials);
|
|
427
|
+
}
|
|
416
428
|
if (!targetTurnkeyWallet || !('id' in targetTurnkeyWallet)) {
|
|
417
429
|
throw new utils.DynamicError('User does not have a valid secure enclave wallet', errors.INVALID_WALLET_DATA);
|
|
418
430
|
}
|
|
@@ -423,7 +435,7 @@ const useSecureEnclaveEmbeddedWallet = () => {
|
|
|
423
435
|
throw new utils.DynamicError('Session is active. No need to create a new one', errors.ACTIVE_SESSION);
|
|
424
436
|
}
|
|
425
437
|
const turnkeyAuthIframeContainerRef = createRootElement(constants.iframeContainerId);
|
|
426
|
-
const publicKey = yield turnkeyAuthenticatorHandler.initRecovery('email', turnkeyAuthIframeContainerRef.current, constants.iframeElementId, getEmbeddedWalletSessionExpiration.getEmbeddedWalletSessionExpiration((
|
|
438
|
+
const publicKey = yield turnkeyAuthenticatorHandler.initRecovery('email', turnkeyAuthIframeContainerRef.current, constants.iframeElementId, getEmbeddedWalletSessionExpiration.getEmbeddedWalletSessionExpiration((_6 = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets) === null || _6 === void 0 ? void 0 : _6.sessionKeyDuration));
|
|
427
439
|
if (!publicKey) {
|
|
428
440
|
throw new utils.DynamicError(errors.ERROR_SENDING_CODE, 'error_sending_code');
|
|
429
441
|
}
|
|
@@ -437,6 +449,7 @@ const useSecureEnclaveEmbeddedWallet = () => {
|
|
|
437
449
|
return errors.CODE_SENT;
|
|
438
450
|
}), [
|
|
439
451
|
createRootElement,
|
|
452
|
+
primaryWallet,
|
|
440
453
|
user$1,
|
|
441
454
|
environmentId,
|
|
442
455
|
projectSettings,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EmbeddedWalletChainEnum } from '@dynamic-labs/sdk-api-core';
|
|
1
|
+
import { ChainEnum, EmbeddedWalletChainEnum } from '@dynamic-labs/sdk-api-core';
|
|
2
2
|
import { Wallet, WalletConnector, WebAuthnAttestation } from '@dynamic-labs/wallet-connector-core';
|
|
3
3
|
import { EmbeddedWalletVersion } from './constants';
|
|
4
4
|
export declare const isConnectorSessionKeyActive: (connector: WalletConnector | undefined) => boolean;
|
|
@@ -37,6 +37,8 @@ export declare const useSecureEnclaveEmbeddedWallet: () => {
|
|
|
37
37
|
type: 'recoveryPhrase' | 'privateKey';
|
|
38
38
|
htmlContainerId?: string;
|
|
39
39
|
}) => Promise<boolean>;
|
|
40
|
-
readonly sendOneTimeCode: (
|
|
40
|
+
readonly sendOneTimeCode: (options?: {
|
|
41
|
+
chainName?: ChainEnum;
|
|
42
|
+
}) => Promise<string>;
|
|
41
43
|
readonly userHasEmbeddedWallet: () => boolean;
|
|
42
44
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
3
3
|
import { useCallback, useMemo } from 'react';
|
|
4
|
-
import { JwtVerifiedCredentialFormatEnum } from '@dynamic-labs/sdk-api-core';
|
|
4
|
+
import { JwtVerifiedCredentialFormatEnum, ChainEnum } from '@dynamic-labs/sdk-api-core';
|
|
5
5
|
import { DynamicError, EmbeddedWalletException, StorageService } from '@dynamic-labs/utils';
|
|
6
6
|
import { isSessionKeyCompatibleWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
7
7
|
import '../../../../context/DynamicContext/useDynamicContext/useDynamicContext.js';
|
|
@@ -22,7 +22,7 @@ import '../../../constants/colors.js';
|
|
|
22
22
|
import '../../../constants/values.js';
|
|
23
23
|
import '../../../../shared/consts/index.js';
|
|
24
24
|
import { findEmbeddedWalletFromVerifiedCredentials } from '../../../functions/findEmbeddedWalletFromVerifiedCredentials/findEmbeddedWalletFromVerifiedCredentials.js';
|
|
25
|
-
import { findTurnkeyWalletByPrimaryChain } from '../../../functions/findTurnkeyWallet/findTurnkeyWallet.js';
|
|
25
|
+
import { findTurnkeyWalletByPrimaryChain, findTurnkeyWalletByTargetChain, findFirstAvailableTurnkeyWallet } from '../../../functions/findTurnkeyWallet/findTurnkeyWallet.js';
|
|
26
26
|
import '@dynamic-labs/multi-wallet';
|
|
27
27
|
import 'react-international-phone';
|
|
28
28
|
import { getUserWalletsFromVerifiedCredentials } from '../../../functions/getUserWalletsFromVerifiedCredentials/getUserWalletsFromVerifiedCredentials.js';
|
|
@@ -401,14 +401,26 @@ const useSecureEnclaveEmbeddedWallet = () => {
|
|
|
401
401
|
]);
|
|
402
402
|
/**
|
|
403
403
|
* Sends a one-time code to the user so they can create a session or add a new passkey
|
|
404
|
+
* @param options - optional parameter to target a specific wallet by chain
|
|
404
405
|
* @returns Promise<'code_sent'>
|
|
405
406
|
*/
|
|
406
|
-
const sendOneTimeCode = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
407
|
-
var _2, _3;
|
|
407
|
+
const sendOneTimeCode = useCallback((options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
408
|
+
var _2, _3, _4, _5, _6;
|
|
408
409
|
if (!user) {
|
|
409
410
|
throw new DynamicError(USER_NOT_LOGGED_IN, 'user_not_logged_in');
|
|
410
411
|
}
|
|
411
|
-
const
|
|
412
|
+
const chainConfigurations = (_2 = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets) === null || _2 === void 0 ? void 0 : _2.chainConfigurations;
|
|
413
|
+
const primaryWalletIsTurnkey = (_3 = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) === null || _3 === void 0 ? void 0 : _3.key.startsWith('turnkey');
|
|
414
|
+
const primaryWalletChain = primaryWalletIsTurnkey
|
|
415
|
+
? primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.chain
|
|
416
|
+
: undefined;
|
|
417
|
+
const primaryConfiguredChain = (_5 = (_4 = chainConfigurations === null || chainConfigurations === void 0 ? void 0 : chainConfigurations.find((chain) => chain.primary)) === null || _4 === void 0 ? void 0 : _4.name) !== null && _5 !== void 0 ? _5 : ChainEnum.Evm;
|
|
418
|
+
const targetChain = (options === null || options === void 0 ? void 0 : options.chainName) || primaryWalletChain || primaryConfiguredChain;
|
|
419
|
+
let targetTurnkeyWallet = findTurnkeyWalletByTargetChain(walletConnectorOptions, targetChain, user.verifiedCredentials);
|
|
420
|
+
if (!(options === null || options === void 0 ? void 0 : options.chainName) &&
|
|
421
|
+
(!targetTurnkeyWallet || !('id' in targetTurnkeyWallet))) {
|
|
422
|
+
targetTurnkeyWallet = findFirstAvailableTurnkeyWallet(walletConnectorOptions, chainConfigurations, user.verifiedCredentials);
|
|
423
|
+
}
|
|
412
424
|
if (!targetTurnkeyWallet || !('id' in targetTurnkeyWallet)) {
|
|
413
425
|
throw new DynamicError('User does not have a valid secure enclave wallet', INVALID_WALLET_DATA);
|
|
414
426
|
}
|
|
@@ -419,7 +431,7 @@ const useSecureEnclaveEmbeddedWallet = () => {
|
|
|
419
431
|
throw new DynamicError('Session is active. No need to create a new one', ACTIVE_SESSION);
|
|
420
432
|
}
|
|
421
433
|
const turnkeyAuthIframeContainerRef = createRootElement(iframeContainerId);
|
|
422
|
-
const publicKey = yield turnkeyAuthenticatorHandler.initRecovery('email', turnkeyAuthIframeContainerRef.current, iframeElementId, getEmbeddedWalletSessionExpiration((
|
|
434
|
+
const publicKey = yield turnkeyAuthenticatorHandler.initRecovery('email', turnkeyAuthIframeContainerRef.current, iframeElementId, getEmbeddedWalletSessionExpiration((_6 = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets) === null || _6 === void 0 ? void 0 : _6.sessionKeyDuration));
|
|
423
435
|
if (!publicKey) {
|
|
424
436
|
throw new DynamicError(ERROR_SENDING_CODE, 'error_sending_code');
|
|
425
437
|
}
|
|
@@ -433,6 +445,7 @@ const useSecureEnclaveEmbeddedWallet = () => {
|
|
|
433
445
|
return CODE_SENT;
|
|
434
446
|
}), [
|
|
435
447
|
createRootElement,
|
|
448
|
+
primaryWallet,
|
|
436
449
|
user,
|
|
437
450
|
environmentId,
|
|
438
451
|
projectSettings,
|