@dynamic-labs/sdk-react-core 3.0.0 → 3.0.2
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 +15 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +11 -11
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.cjs +9 -10
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.js +10 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
|
|
2
|
+
### [3.0.2](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.1...v3.0.2) (2024-09-13)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* solana and cosmos signers not working properly ([#6897](https://github.com/dynamic-labs/DynamicAuth/issues/6897)) ([6e27c08](https://github.com/dynamic-labs/DynamicAuth/commit/6e27c0817f8f0a454eaa14ff56a430072f9730e3))
|
|
8
|
+
|
|
9
|
+
### [3.0.1](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0...v3.0.1) (2024-09-13)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* create v2 embedded wallet experience in manual mode ([#6887](https://github.com/dynamic-labs/DynamicAuth/issues/6887)) ([#6891](https://github.com/dynamic-labs/DynamicAuth/issues/6891)) ([64d027b](https://github.com/dynamic-labs/DynamicAuth/commit/64d027b4b5d877845551eae23c666d7863f7109d))
|
|
15
|
+
* solana pk export format ([#6888](https://github.com/dynamic-labs/DynamicAuth/issues/6888)) ([#6890](https://github.com/dynamic-labs/DynamicAuth/issues/6890)) ([cb68997](https://github.com/dynamic-labs/DynamicAuth/commit/cb68997970ccf53734b7d296153185b4866c7f94))
|
|
16
|
+
|
|
2
17
|
## [3.0.0](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.68...v3.0.0) (2024-09-13)
|
|
3
18
|
|
|
4
19
|
## [3.0.0-alpha.68](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.67...v3.0.0-alpha.68) (2024-09-12)
|
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": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
|
|
@@ -17,16 +17,16 @@
|
|
|
17
17
|
"react-i18next": "13.5.0",
|
|
18
18
|
"yup": "0.32.11",
|
|
19
19
|
"react-international-phone": "4.2.5",
|
|
20
|
-
"@dynamic-labs/iconic": "3.0.
|
|
21
|
-
"@dynamic-labs/logger": "3.0.
|
|
22
|
-
"@dynamic-labs/message-transport": "3.0.
|
|
23
|
-
"@dynamic-labs/multi-wallet": "3.0.
|
|
24
|
-
"@dynamic-labs/rpc-providers": "3.0.
|
|
25
|
-
"@dynamic-labs/store": "3.0.
|
|
26
|
-
"@dynamic-labs/types": "3.0.
|
|
27
|
-
"@dynamic-labs/utils": "3.0.
|
|
28
|
-
"@dynamic-labs/wallet-book": "3.0.
|
|
29
|
-
"@dynamic-labs/wallet-connector-core": "3.0.
|
|
20
|
+
"@dynamic-labs/iconic": "3.0.2",
|
|
21
|
+
"@dynamic-labs/logger": "3.0.2",
|
|
22
|
+
"@dynamic-labs/message-transport": "3.0.2",
|
|
23
|
+
"@dynamic-labs/multi-wallet": "3.0.2",
|
|
24
|
+
"@dynamic-labs/rpc-providers": "3.0.2",
|
|
25
|
+
"@dynamic-labs/store": "3.0.2",
|
|
26
|
+
"@dynamic-labs/types": "3.0.2",
|
|
27
|
+
"@dynamic-labs/utils": "3.0.2",
|
|
28
|
+
"@dynamic-labs/wallet-book": "3.0.2",
|
|
29
|
+
"@dynamic-labs/wallet-connector-core": "3.0.2",
|
|
30
30
|
"eventemitter3": "5.0.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
@@ -6,10 +6,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var _tslib = require('../../../../../../../_virtual/_tslib.cjs');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
9
|
-
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
10
9
|
require('../../../../../context/DynamicContext/DynamicContext.cjs');
|
|
11
10
|
var logger = require('../../../../../shared/logger.cjs');
|
|
12
11
|
require('@dynamic-labs/iconic');
|
|
12
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
13
13
|
require('react/jsx-runtime');
|
|
14
14
|
var ViewContext = require('../../../../../context/ViewContext/ViewContext.cjs');
|
|
15
15
|
require('@dynamic-labs/wallet-book');
|
|
@@ -187,14 +187,13 @@ const useTurnkey = () => {
|
|
|
187
187
|
return Promise.resolve(passkeyWallet);
|
|
188
188
|
}), [setPrimaryWalletId, walletConnectorOptions, user]);
|
|
189
189
|
const createTurnkeyWallet = React.useCallback((chains, options) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
190
|
-
var _c, _d, _e, _f, _g;
|
|
190
|
+
var _c, _d, _e, _f, _g, _h;
|
|
191
191
|
if (!user) {
|
|
192
192
|
throw new Error(errors.USER_NOT_LOGGED_IN);
|
|
193
193
|
}
|
|
194
194
|
const isManualMode = ((_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets) === null || _c === void 0 ? void 0 : _c.automaticEmbeddedWalletCreation) === false;
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
(eoaWallet && walletConnectorCore.isSessionKeyCompatibleWallet(eoaWallet));
|
|
195
|
+
const shouldCreateV2WalletsByDefault = ((_d = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets) === null || _d === void 0 ? void 0 : _d.defaultWalletVersion) ===
|
|
196
|
+
sdkApiCore.EmbeddedWalletVersionEnum.V2;
|
|
198
197
|
const embeddedWalletVerifiedCredential = findEmbeddedWalletFromVerifiedCredentials.findEmbeddedWalletFromVerifiedCredentials(user, chains);
|
|
199
198
|
const userWalletsCredentials = getUserWalletsFromVerifiedCredentials.getUserWalletsFromVerifiedCredentials(user);
|
|
200
199
|
// If the user doesn't have a wallet, or if the customer is in Manual
|
|
@@ -204,10 +203,10 @@ const useTurnkey = () => {
|
|
|
204
203
|
if (!(userWalletsCredentials === null || userWalletsCredentials === void 0 ? void 0 : userWalletsCredentials.length) ||
|
|
205
204
|
(!embeddedWalletVerifiedCredential && isManualMode)) {
|
|
206
205
|
const hasEmailVC = getUserVerifiedCredentialType.getUserVerifiedCredentialType(user, sdkApiCore.JwtVerifiedCredentialFormatEnum.Email);
|
|
207
|
-
if ((!((
|
|
206
|
+
if ((!((_e = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets) === null || _e === void 0 ? void 0 : _e.forceAuthenticatorAtSignup) &&
|
|
208
207
|
hasEmailVC) ||
|
|
209
208
|
(options === null || options === void 0 ? void 0 : options.webAuthnAttestation) ||
|
|
210
|
-
|
|
209
|
+
shouldCreateV2WalletsByDefault) {
|
|
211
210
|
// create embedded wallet fully headless
|
|
212
211
|
return startHeadlessEmbeddedWalletCreationFlow(chains, options);
|
|
213
212
|
}
|
|
@@ -221,7 +220,7 @@ const useTurnkey = () => {
|
|
|
221
220
|
// backend if this called as part of a new user sign up.
|
|
222
221
|
if (embeddedWalletVerifiedCredential &&
|
|
223
222
|
user.newUser &&
|
|
224
|
-
((
|
|
223
|
+
((_f = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets) === null || _f === void 0 ? void 0 : _f.automaticEmbeddedWalletCreation)) {
|
|
225
224
|
const walletConnector = findPasskeyEmailWalletConnector.findPasskeyEmailWalletConnector(walletConnectorOptions, findPrimaryEmbeddedChain.findPrimaryEmbeddedChain(projectSettings));
|
|
226
225
|
if (!walletConnector) {
|
|
227
226
|
throw new Error('Could not find the embedded wallet connector');
|
|
@@ -231,8 +230,8 @@ const useTurnkey = () => {
|
|
|
231
230
|
chain: walletConnector.connectedChain,
|
|
232
231
|
connector: walletConnector,
|
|
233
232
|
id: embeddedWalletVerifiedCredential.id,
|
|
234
|
-
isAuthenticated: Boolean((
|
|
235
|
-
key: (
|
|
233
|
+
isAuthenticated: Boolean((_g = embeddedWalletVerifiedCredential === null || embeddedWalletVerifiedCredential === void 0 ? void 0 : embeddedWalletVerifiedCredential.walletProperties) === null || _g === void 0 ? void 0 : _g.isAuthenticatorAttached),
|
|
234
|
+
key: (_h = embeddedWalletVerifiedCredential.walletName) !== null && _h !== void 0 ? _h : walletConnector.key,
|
|
236
235
|
});
|
|
237
236
|
setPrimaryWalletId(embeddedWalletVerifiedCredential.id);
|
|
238
237
|
dynamicEvents.dynamicEvents.emit('embeddedWalletCreated', wallet, embeddedWalletVerifiedCredential, user);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../../../_virtual/_tslib.js';
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
|
-
import { JwtVerifiedCredentialFormatEnum } from '@dynamic-labs/sdk-api-core';
|
|
5
|
-
import { isSessionKeyCompatibleWallet } from '@dynamic-labs/wallet-connector-core';
|
|
4
|
+
import { EmbeddedWalletVersionEnum, JwtVerifiedCredentialFormatEnum } from '@dynamic-labs/sdk-api-core';
|
|
6
5
|
import '../../../../../context/DynamicContext/DynamicContext.js';
|
|
7
6
|
import { logger } from '../../../../../shared/logger.js';
|
|
8
7
|
import '@dynamic-labs/iconic';
|
|
8
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
9
9
|
import 'react/jsx-runtime';
|
|
10
10
|
import { useViewContext } from '../../../../../context/ViewContext/ViewContext.js';
|
|
11
11
|
import '@dynamic-labs/wallet-book';
|
|
@@ -183,14 +183,13 @@ const useTurnkey = () => {
|
|
|
183
183
|
return Promise.resolve(passkeyWallet);
|
|
184
184
|
}), [setPrimaryWalletId, walletConnectorOptions, user]);
|
|
185
185
|
const createTurnkeyWallet = useCallback((chains, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
186
|
-
var _c, _d, _e, _f, _g;
|
|
186
|
+
var _c, _d, _e, _f, _g, _h;
|
|
187
187
|
if (!user) {
|
|
188
188
|
throw new Error(USER_NOT_LOGGED_IN);
|
|
189
189
|
}
|
|
190
190
|
const isManualMode = ((_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets) === null || _c === void 0 ? void 0 : _c.automaticEmbeddedWalletCreation) === false;
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
(eoaWallet && isSessionKeyCompatibleWallet(eoaWallet));
|
|
191
|
+
const shouldCreateV2WalletsByDefault = ((_d = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets) === null || _d === void 0 ? void 0 : _d.defaultWalletVersion) ===
|
|
192
|
+
EmbeddedWalletVersionEnum.V2;
|
|
194
193
|
const embeddedWalletVerifiedCredential = findEmbeddedWalletFromVerifiedCredentials(user, chains);
|
|
195
194
|
const userWalletsCredentials = getUserWalletsFromVerifiedCredentials(user);
|
|
196
195
|
// If the user doesn't have a wallet, or if the customer is in Manual
|
|
@@ -200,10 +199,10 @@ const useTurnkey = () => {
|
|
|
200
199
|
if (!(userWalletsCredentials === null || userWalletsCredentials === void 0 ? void 0 : userWalletsCredentials.length) ||
|
|
201
200
|
(!embeddedWalletVerifiedCredential && isManualMode)) {
|
|
202
201
|
const hasEmailVC = getUserVerifiedCredentialType(user, JwtVerifiedCredentialFormatEnum.Email);
|
|
203
|
-
if ((!((
|
|
202
|
+
if ((!((_e = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets) === null || _e === void 0 ? void 0 : _e.forceAuthenticatorAtSignup) &&
|
|
204
203
|
hasEmailVC) ||
|
|
205
204
|
(options === null || options === void 0 ? void 0 : options.webAuthnAttestation) ||
|
|
206
|
-
|
|
205
|
+
shouldCreateV2WalletsByDefault) {
|
|
207
206
|
// create embedded wallet fully headless
|
|
208
207
|
return startHeadlessEmbeddedWalletCreationFlow(chains, options);
|
|
209
208
|
}
|
|
@@ -217,7 +216,7 @@ const useTurnkey = () => {
|
|
|
217
216
|
// backend if this called as part of a new user sign up.
|
|
218
217
|
if (embeddedWalletVerifiedCredential &&
|
|
219
218
|
user.newUser &&
|
|
220
|
-
((
|
|
219
|
+
((_f = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets) === null || _f === void 0 ? void 0 : _f.automaticEmbeddedWalletCreation)) {
|
|
221
220
|
const walletConnector = findPasskeyEmailWalletConnector(walletConnectorOptions, findPrimaryEmbeddedChain(projectSettings));
|
|
222
221
|
if (!walletConnector) {
|
|
223
222
|
throw new Error('Could not find the embedded wallet connector');
|
|
@@ -227,8 +226,8 @@ const useTurnkey = () => {
|
|
|
227
226
|
chain: walletConnector.connectedChain,
|
|
228
227
|
connector: walletConnector,
|
|
229
228
|
id: embeddedWalletVerifiedCredential.id,
|
|
230
|
-
isAuthenticated: Boolean((
|
|
231
|
-
key: (
|
|
229
|
+
isAuthenticated: Boolean((_g = embeddedWalletVerifiedCredential === null || embeddedWalletVerifiedCredential === void 0 ? void 0 : embeddedWalletVerifiedCredential.walletProperties) === null || _g === void 0 ? void 0 : _g.isAuthenticatorAttached),
|
|
230
|
+
key: (_h = embeddedWalletVerifiedCredential.walletName) !== null && _h !== void 0 ? _h : walletConnector.key,
|
|
232
231
|
});
|
|
233
232
|
setPrimaryWalletId(embeddedWalletVerifiedCredential.id);
|
|
234
233
|
dynamicEvents.emit('embeddedWalletCreated', wallet, embeddedWalletVerifiedCredential, user);
|