@dynamic-labs/sdk-react-core 4.76.0 → 4.77.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,4 +1,21 @@
1
1
 
2
+ ## [4.77.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.76.0...v4.77.0) (2026-04-10)
3
+
4
+
5
+ ### Features
6
+
7
+ * **midnight:** add types and chain constants ([#10851](https://github.com/dynamic-labs/dynamic-auth/issues/10851)) ([91620d2](https://github.com/dynamic-labs/dynamic-auth/commit/91620d21596c525d8d51ddb0c0ba7df456e3eb64))
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * issue when linking new wallet via qr code when there's no active session ([#10878](https://github.com/dynamic-labs/dynamic-auth/issues/10878)) ([53cbae0](https://github.com/dynamic-labs/dynamic-auth/commit/53cbae0806665371e9214663e72e2f1fb7e1ac3f))
13
+ * **lint-staged:** exclude Playwright specs from jest pre-commit hook [DYNT-496] ([#10880](https://github.com/dynamic-labs/dynamic-auth/issues/10880)) ([d3c8a9a](https://github.com/dynamic-labs/dynamic-auth/commit/d3c8a9a59c855bb834dcedf2e18a2bd0eabcb420))
14
+ * **react-core:** exclude password setup cancellations from wallet creation failure metrics ([#10868](https://github.com/dynamic-labs/dynamic-auth/issues/10868)) ([685de16](https://github.com/dynamic-labs/dynamic-auth/commit/685de16f004f282e1b24114c3a18d8c02b7e48aa))
15
+ * **react-native:** adds eip7702 authorization ([#10904](https://github.com/dynamic-labs/dynamic-auth/issues/10904)) ([fa3e41f](https://github.com/dynamic-labs/dynamic-auth/commit/fa3e41f18aeca309c199003781e569bb425dda5d))
16
+ * **react-native:** remove crypto dependency ([#10871](https://github.com/dynamic-labs/dynamic-auth/issues/10871)) ([de4faa5](https://github.com/dynamic-labs/dynamic-auth/commit/de4faa5bd8bbb8fc321ed65f8b6ccfbaff1d00d3))
17
+ * **react-native:** unify session storage ([#10870](https://github.com/dynamic-labs/dynamic-auth/issues/10870)) ([0536ea0](https://github.com/dynamic-labs/dynamic-auth/commit/0536ea0a78f69b9952b21eec38b4868276215b46))
18
+
2
19
  ## [4.76.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.75.0...v4.76.0) (2026-04-06)
3
20
 
4
21
 
package/package.cjs CHANGED
@@ -3,10 +3,10 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.76.0";
6
+ var version = "4.77.0";
7
7
  var dependencies = {
8
- "@dynamic-labs/sdk-api-core": "0.0.923",
9
- "@dynamic-labs-sdk/client": "0.23.2",
8
+ "@dynamic-labs/sdk-api-core": "0.0.927",
9
+ "@dynamic-labs-sdk/client": "0.24.0",
10
10
  "@dynamic-labs-wallet/browser-wallet-client": "0.0.314",
11
11
  "@hcaptcha/react-hcaptcha": "1.4.4",
12
12
  "@thumbmarkjs/thumbmarkjs": "0.16.0",
package/package.js CHANGED
@@ -1,8 +1,8 @@
1
1
  'use client'
2
- var version = "4.76.0";
2
+ var version = "4.77.0";
3
3
  var dependencies = {
4
- "@dynamic-labs/sdk-api-core": "0.0.923",
5
- "@dynamic-labs-sdk/client": "0.23.2",
4
+ "@dynamic-labs/sdk-api-core": "0.0.927",
5
+ "@dynamic-labs-sdk/client": "0.24.0",
6
6
  "@dynamic-labs-wallet/browser-wallet-client": "0.0.314",
7
7
  "@hcaptcha/react-hcaptcha": "1.4.4",
8
8
  "@thumbmarkjs/thumbmarkjs": "0.16.0",
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@dynamic-labs/sdk-react-core",
3
- "version": "4.76.0",
3
+ "version": "4.77.0",
4
4
  "dependencies": {
5
- "@dynamic-labs/sdk-api-core": "0.0.923",
6
- "@dynamic-labs-sdk/client": "0.23.2",
5
+ "@dynamic-labs/sdk-api-core": "0.0.927",
6
+ "@dynamic-labs-sdk/client": "0.24.0",
7
7
  "@dynamic-labs-wallet/browser-wallet-client": "0.0.314",
8
8
  "@hcaptcha/react-hcaptcha": "1.4.4",
9
9
  "@thumbmarkjs/thumbmarkjs": "0.16.0",
@@ -16,17 +16,17 @@
16
16
  "yup": "0.32.11",
17
17
  "react-international-phone": "4.5.0",
18
18
  "bs58": "5.0.0",
19
- "@dynamic-labs/assert-package-version": "4.76.0",
20
- "@dynamic-labs/iconic": "4.76.0",
21
- "@dynamic-labs/locale": "4.76.0",
22
- "@dynamic-labs/logger": "4.76.0",
23
- "@dynamic-labs/multi-wallet": "4.76.0",
24
- "@dynamic-labs/rpc-providers": "4.76.0",
25
- "@dynamic-labs/store": "4.76.0",
26
- "@dynamic-labs/types": "4.76.0",
27
- "@dynamic-labs/utils": "4.76.0",
28
- "@dynamic-labs/wallet-book": "4.76.0",
29
- "@dynamic-labs/wallet-connector-core": "4.76.0",
19
+ "@dynamic-labs/assert-package-version": "4.77.0",
20
+ "@dynamic-labs/iconic": "4.77.0",
21
+ "@dynamic-labs/locale": "4.77.0",
22
+ "@dynamic-labs/logger": "4.77.0",
23
+ "@dynamic-labs/multi-wallet": "4.77.0",
24
+ "@dynamic-labs/rpc-providers": "4.77.0",
25
+ "@dynamic-labs/store": "4.77.0",
26
+ "@dynamic-labs/types": "4.77.0",
27
+ "@dynamic-labs/utils": "4.77.0",
28
+ "@dynamic-labs/wallet-book": "4.77.0",
29
+ "@dynamic-labs/wallet-connector-core": "4.77.0",
30
30
  "eventemitter3": "5.0.1"
31
31
  },
32
32
  "devDependencies": {
@@ -18,6 +18,7 @@ const ChainEnumToVerifiedCredentialName = {
18
18
  ETH: 'eip155',
19
19
  EVM: 'eip155',
20
20
  FLOW: 'flow',
21
+ MIDNIGHT: 'midnight',
21
22
  SOL: 'solana',
22
23
  STARK: 'starknet',
23
24
  STELLAR: 'stellar',
@@ -34,6 +35,7 @@ const VerifiedCredentialNameToChainEnum = {
34
35
  cosmos: sdkApiCore.ChainEnum.Cosmos,
35
36
  eip155: sdkApiCore.ChainEnum.Evm,
36
37
  flow: sdkApiCore.ChainEnum.Flow,
38
+ midnight: sdkApiCore.ChainEnum.Midnight,
37
39
  solana: sdkApiCore.ChainEnum.Sol,
38
40
  starknet: sdkApiCore.ChainEnum.Stark,
39
41
  stellar: sdkApiCore.ChainEnum.Stellar,
@@ -14,6 +14,7 @@ const ChainEnumToVerifiedCredentialName = {
14
14
  ETH: 'eip155',
15
15
  EVM: 'eip155',
16
16
  FLOW: 'flow',
17
+ MIDNIGHT: 'midnight',
17
18
  SOL: 'solana',
18
19
  STARK: 'starknet',
19
20
  STELLAR: 'stellar',
@@ -30,6 +31,7 @@ const VerifiedCredentialNameToChainEnum = {
30
31
  cosmos: ChainEnum.Cosmos,
31
32
  eip155: ChainEnum.Evm,
32
33
  flow: ChainEnum.Flow,
34
+ midnight: ChainEnum.Midnight,
33
35
  solana: ChainEnum.Sol,
34
36
  starknet: ChainEnum.Stark,
35
37
  stellar: ChainEnum.Stellar,
@@ -31,6 +31,7 @@ require('@dynamic-labs-sdk/client/core');
31
31
  require('../../../../client/client.cjs');
32
32
  require('@dynamic-labs-sdk/client');
33
33
  require('../../../../config/ApiEndpoint.cjs');
34
+ var getUserProfile = require('../../../../client/extension/user/getUserProfile/getUserProfile.cjs');
34
35
  require('@dynamic-labs/locale');
35
36
  require('../../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
36
37
  require('../../../../store/state/primaryWalletId/primaryWalletId.cjs');
@@ -213,6 +214,10 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
213
214
  return;
214
215
  }
215
216
  const { address } = connectionResult;
217
+ logger.logger.logVerboseTroubleshootingMessage('[useConnectAndSign] connection result', {
218
+ address,
219
+ walletConnectorKey: walletConnector.key,
220
+ });
216
221
  const walletNetwork = yield walletConnector.getNetwork(true);
217
222
  const usesSupportedNetwork = isSupportedNetwork.isSupportedNetwork({
218
223
  network: walletNetwork,
@@ -226,6 +231,23 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
226
231
  }
227
232
  return pushView('network-not-supported');
228
233
  }
234
+ const user = getUserProfile.getUserProfile();
235
+ const isAlreadyVerified = Boolean(user === null || user === void 0 ? void 0 : user.verifiedCredentials.find((vc) => vc.walletProvider === walletConnectorCore.getWalletProvider(walletConnector) &&
236
+ vc.walletName === walletConnector.key &&
237
+ vc.address &&
238
+ walletConnectorCore.isSameAddress(vc.address, address, walletConnector.connectedChain)));
239
+ logger.logger.logVerboseTroubleshootingMessage('[useConnectAndSign] isAlreadyVerified', {
240
+ isAlreadyVerified,
241
+ userVerifiedCredentials: user === null || user === void 0 ? void 0 : user.verifiedCredentials,
242
+ });
243
+ // this is in case the user is trying to link a wallet that is already verified/linked
244
+ // this flow mainly happens when trying to link a WalletConnect or MM wallet through qr code
245
+ // skip this check when requestedScopes is present, as that indicates a step-up auth flow
246
+ // where the user must re-sign with an already-verified wallet to authorize a sensitive action
247
+ if (isAlreadyVerified && !(requestedScopes === null || requestedScopes === void 0 ? void 0 : requestedScopes.length)) {
248
+ setShowAuthFlow(false);
249
+ return;
250
+ }
229
251
  if (isConnectOnly.isConnectOnly()) {
230
252
  utils.StorageService.setItem(localStorage.LAST_USED_WALLET, walletConnector.key);
231
253
  if (shouldUpdateWallets) {
@@ -1,7 +1,7 @@
1
1
  'use client'
2
2
  import { __awaiter } from '../../../../../../_virtual/_tslib.js';
3
3
  import { DeferredPromise, StorageService, CustomError, GetAddressCancelledError } from '@dynamic-labs/utils';
4
- import { isEmailWalletConnector, isEmailOTPWalletConnector, isBloctoConnector } from '@dynamic-labs/wallet-connector-core';
4
+ import { isEmailWalletConnector, isEmailOTPWalletConnector, isBloctoConnector, getWalletProvider, isSameAddress } from '@dynamic-labs/wallet-connector-core';
5
5
  import { useCaptchaContext } from '../../../../context/CaptchaContext/CaptchaContext.js';
6
6
  import 'react';
7
7
  import '../../../../context/DynamicContext/DynamicContext.js';
@@ -27,6 +27,7 @@ import '@dynamic-labs-sdk/client/core';
27
27
  import '../../../../client/client.js';
28
28
  import '@dynamic-labs-sdk/client';
29
29
  import '../../../../config/ApiEndpoint.js';
30
+ import { getUserProfile } from '../../../../client/extension/user/getUserProfile/getUserProfile.js';
30
31
  import '@dynamic-labs/locale';
31
32
  import '../../../../store/state/dynamicContextProps/dynamicContextProps.js';
32
33
  import '../../../../store/state/primaryWalletId/primaryWalletId.js';
@@ -209,6 +210,10 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
209
210
  return;
210
211
  }
211
212
  const { address } = connectionResult;
213
+ logger.logVerboseTroubleshootingMessage('[useConnectAndSign] connection result', {
214
+ address,
215
+ walletConnectorKey: walletConnector.key,
216
+ });
212
217
  const walletNetwork = yield walletConnector.getNetwork(true);
213
218
  const usesSupportedNetwork = isSupportedNetwork({
214
219
  network: walletNetwork,
@@ -222,6 +227,23 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
222
227
  }
223
228
  return pushView('network-not-supported');
224
229
  }
230
+ const user = getUserProfile();
231
+ const isAlreadyVerified = Boolean(user === null || user === void 0 ? void 0 : user.verifiedCredentials.find((vc) => vc.walletProvider === getWalletProvider(walletConnector) &&
232
+ vc.walletName === walletConnector.key &&
233
+ vc.address &&
234
+ isSameAddress(vc.address, address, walletConnector.connectedChain)));
235
+ logger.logVerboseTroubleshootingMessage('[useConnectAndSign] isAlreadyVerified', {
236
+ isAlreadyVerified,
237
+ userVerifiedCredentials: user === null || user === void 0 ? void 0 : user.verifiedCredentials,
238
+ });
239
+ // this is in case the user is trying to link a wallet that is already verified/linked
240
+ // this flow mainly happens when trying to link a WalletConnect or MM wallet through qr code
241
+ // skip this check when requestedScopes is present, as that indicates a step-up auth flow
242
+ // where the user must re-sign with an already-verified wallet to authorize a sensitive action
243
+ if (isAlreadyVerified && !(requestedScopes === null || requestedScopes === void 0 ? void 0 : requestedScopes.length)) {
244
+ setShowAuthFlow(false);
245
+ return;
246
+ }
225
247
  if (isConnectOnly()) {
226
248
  StorageService.setItem(LAST_USED_WALLET, walletConnector.key);
227
249
  if (shouldUpdateWallets) {
@@ -179,15 +179,21 @@ const useWalletCreation = () => {
179
179
  }
180
180
  catch (error) {
181
181
  const duration = Date.now() - startTime;
182
- logger.logger.instrument('Auto wallet creation failed', {
183
- chainCount: requirements.length,
184
- chains: chainsString,
185
- environmentId,
186
- error: error instanceof Error ? error.message : 'Unknown error',
187
- key: 'auto_wallet_creation_failed',
188
- time: duration,
189
- userId: user === null || user === void 0 ? void 0 : user.id,
190
- });
182
+ // Don't count password setup cancellations as failures — they're intentional
183
+ // user actions, not errors. The onFailure handler already suppresses the error
184
+ // UI for this case; the metric should be consistent with that intent.
185
+ if (!(error instanceof Error &&
186
+ error.message === useSetupPassword.PASSWORD_SETUP_CANCELLED_ERROR)) {
187
+ logger.logger.instrument('Auto wallet creation failed', {
188
+ chainCount: requirements.length,
189
+ chains: chainsString,
190
+ environmentId,
191
+ error: error instanceof Error ? error.message : 'Unknown error',
192
+ key: 'auto_wallet_creation_failed',
193
+ time: duration,
194
+ userId: user === null || user === void 0 ? void 0 : user.id,
195
+ });
196
+ }
191
197
  throw error;
192
198
  }
193
199
  }), {
@@ -175,15 +175,21 @@ const useWalletCreation = () => {
175
175
  }
176
176
  catch (error) {
177
177
  const duration = Date.now() - startTime;
178
- logger.instrument('Auto wallet creation failed', {
179
- chainCount: requirements.length,
180
- chains: chainsString,
181
- environmentId,
182
- error: error instanceof Error ? error.message : 'Unknown error',
183
- key: 'auto_wallet_creation_failed',
184
- time: duration,
185
- userId: user === null || user === void 0 ? void 0 : user.id,
186
- });
178
+ // Don't count password setup cancellations as failures — they're intentional
179
+ // user actions, not errors. The onFailure handler already suppresses the error
180
+ // UI for this case; the metric should be consistent with that intent.
181
+ if (!(error instanceof Error &&
182
+ error.message === PASSWORD_SETUP_CANCELLED_ERROR)) {
183
+ logger.instrument('Auto wallet creation failed', {
184
+ chainCount: requirements.length,
185
+ chains: chainsString,
186
+ environmentId,
187
+ error: error instanceof Error ? error.message : 'Unknown error',
188
+ key: 'auto_wallet_creation_failed',
189
+ time: duration,
190
+ userId: user === null || user === void 0 ? void 0 : user.id,
191
+ });
192
+ }
187
193
  throw error;
188
194
  }
189
195
  }), {
@@ -289,11 +289,18 @@ const useHandleWalletItem = ({ allowAlreadyConnectedWallet, onQrCodeConnect, onC
289
289
  }
290
290
  }
291
291
  const supportsMultiAccount = walletConnectorCore.connectorRequiresDisconnectionForNewConnection(walletConnector);
292
+ const isNotInstalledWithQrCodeSupport = walletConnector.isWalletConnect ||
293
+ (!walletConnector.isInstalledOnBrowser() &&
294
+ walletConnector.canConnectViaQrCode);
295
+ logger.logger.logVerboseTroubleshootingMessage('[handleWalletItemClick] isNotInstalledWithQrCodeSupport', {
296
+ isNotInstalledWithQrCodeSupport,
297
+ walletConnectorKey: walletConnector.key,
298
+ });
292
299
  if (!allowAlreadyConnectedWallet &&
293
300
  isSelectedWalletAlreadyConnected.isSelectedWalletAlreadyConnected(linkedWallets, walletConnector, user) &&
294
301
  walletConnector.connectedChain !== 'FLOW' &&
295
- !walletConnector.isWalletConnect &&
296
- !supportsMultiAccount) {
302
+ !supportsMultiAccount &&
303
+ !isNotInstalledWithQrCodeSupport) {
297
304
  handleAlreadyConnectedWallet(walletConnector);
298
305
  }
299
306
  else if (walletConnector.canConnectViaCustodialService) {
@@ -285,11 +285,18 @@ const useHandleWalletItem = ({ allowAlreadyConnectedWallet, onQrCodeConnect, onC
285
285
  }
286
286
  }
287
287
  const supportsMultiAccount = connectorRequiresDisconnectionForNewConnection(walletConnector);
288
+ const isNotInstalledWithQrCodeSupport = walletConnector.isWalletConnect ||
289
+ (!walletConnector.isInstalledOnBrowser() &&
290
+ walletConnector.canConnectViaQrCode);
291
+ logger.logVerboseTroubleshootingMessage('[handleWalletItemClick] isNotInstalledWithQrCodeSupport', {
292
+ isNotInstalledWithQrCodeSupport,
293
+ walletConnectorKey: walletConnector.key,
294
+ });
288
295
  if (!allowAlreadyConnectedWallet &&
289
296
  isSelectedWalletAlreadyConnected(linkedWallets, walletConnector, user) &&
290
297
  walletConnector.connectedChain !== 'FLOW' &&
291
- !walletConnector.isWalletConnect &&
292
- !supportsMultiAccount) {
298
+ !supportsMultiAccount &&
299
+ !isNotInstalledWithQrCodeSupport) {
293
300
  handleAlreadyConnectedWallet(walletConnector);
294
301
  }
295
302
  else if (walletConnector.canConnectViaCustodialService) {