@dynamic-labs/sdk-react-core 3.9.2 → 3.9.3

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,12 @@
1
1
 
2
+ ### [3.9.3](https://github.com/dynamic-labs/DynamicAuth/compare/v3.9.2...v3.9.3) (2024-12-18)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * allow re-linking unknown wallet when there's another account of the same wallet provider already linked ([#7627](https://github.com/dynamic-labs/DynamicAuth/issues/7627)) ([d34f07c](https://github.com/dynamic-labs/DynamicAuth/commit/d34f07c0aa645d35192e0939f8c2b4bf35bafc86))
8
+ * temp disable refreshing blockhash for solana transactions ([#7646](https://github.com/dynamic-labs/DynamicAuth/issues/7646)) ([8aeab7c](https://github.com/dynamic-labs/DynamicAuth/commit/8aeab7c798881746e5977e509e7b301475281f03))
9
+
2
10
  ### [3.9.2](https://github.com/dynamic-labs/DynamicAuth/compare/v3.9.1...v3.9.2) (2024-12-11)
3
11
 
4
12
  ### [3.9.1](https://github.com/dynamic-labs/DynamicAuth/compare/v3.9.0...v3.9.1) (2024-12-09)
package/package.cjs CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "3.9.2";
6
+ var version = "3.9.3";
7
7
  var dependencies = {
8
8
  "@dynamic-labs/sdk-api-core": "0.0.570",
9
9
  "@hcaptcha/react-hcaptcha": "1.4.4",
package/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client'
2
- var version = "3.9.2";
2
+ var version = "3.9.3";
3
3
  var dependencies = {
4
4
  "@dynamic-labs/sdk-api-core": "0.0.570",
5
5
  "@hcaptcha/react-hcaptcha": "1.4.4",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/sdk-react-core",
3
- "version": "3.9.2",
3
+ "version": "3.9.3",
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/assert-package-version": "3.9.2",
21
- "@dynamic-labs/iconic": "3.9.2",
22
- "@dynamic-labs/logger": "3.9.2",
23
- "@dynamic-labs/multi-wallet": "3.9.2",
24
- "@dynamic-labs/rpc-providers": "3.9.2",
25
- "@dynamic-labs/store": "3.9.2",
26
- "@dynamic-labs/types": "3.9.2",
27
- "@dynamic-labs/utils": "3.9.2",
28
- "@dynamic-labs/wallet-book": "3.9.2",
29
- "@dynamic-labs/wallet-connector-core": "3.9.2",
20
+ "@dynamic-labs/assert-package-version": "3.9.3",
21
+ "@dynamic-labs/iconic": "3.9.3",
22
+ "@dynamic-labs/logger": "3.9.3",
23
+ "@dynamic-labs/multi-wallet": "3.9.3",
24
+ "@dynamic-labs/rpc-providers": "3.9.3",
25
+ "@dynamic-labs/store": "3.9.3",
26
+ "@dynamic-labs/types": "3.9.3",
27
+ "@dynamic-labs/utils": "3.9.3",
28
+ "@dynamic-labs/wallet-book": "3.9.3",
29
+ "@dynamic-labs/wallet-connector-core": "3.9.3",
30
30
  "bs58": "5.0.0",
31
31
  "eventemitter3": "5.0.1"
32
32
  },
@@ -1,6 +1,7 @@
1
+ import { InternalWalletConnector } from '@dynamic-labs/wallet-connector-core';
1
2
  export type MultiWalletInternalEvents = {
2
3
  triggerComputePrimaryWalletMultiWalletStateFromAccounts: (props: {
3
4
  accounts: string[];
4
5
  }) => void;
5
- triggerConnectAndSign: () => void;
6
+ triggerConnectAndSign: (walletConnector?: InternalWalletConnector) => void;
6
7
  };
@@ -91,18 +91,20 @@ const useVerifyOnAwaitingSignature = () => {
91
91
  // this is to prevent calling runConnectAndSign multiple times
92
92
  // due to changes in legacyIsVerifying
93
93
  const isVerifying = React.useRef(false);
94
- const runConnectAndSign = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
94
+ const runConnectAndSign = React.useCallback((walletConnector) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
95
95
  logger.logger.debug('runConnectAndSign', {
96
96
  selectedWalletConnector,
97
+ walletConnector,
97
98
  });
98
- if (!selectedWalletConnector) {
99
+ const connector = walletConnector !== null && walletConnector !== void 0 ? walletConnector : selectedWalletConnector;
100
+ if (!connector) {
99
101
  return;
100
102
  }
101
103
  isVerifying.current = true;
102
104
  setLegacyIsVerifying(true);
103
105
  try {
104
106
  yield triggerConnectAndSign({
105
- walletConnector: selectedWalletConnector,
107
+ walletConnector: connector,
106
108
  });
107
109
  }
108
110
  catch (e) {
@@ -87,18 +87,20 @@ const useVerifyOnAwaitingSignature = () => {
87
87
  // this is to prevent calling runConnectAndSign multiple times
88
88
  // due to changes in legacyIsVerifying
89
89
  const isVerifying = useRef(false);
90
- const runConnectAndSign = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
90
+ const runConnectAndSign = useCallback((walletConnector) => __awaiter(void 0, void 0, void 0, function* () {
91
91
  logger.debug('runConnectAndSign', {
92
92
  selectedWalletConnector,
93
+ walletConnector,
93
94
  });
94
- if (!selectedWalletConnector) {
95
+ const connector = walletConnector !== null && walletConnector !== void 0 ? walletConnector : selectedWalletConnector;
96
+ if (!connector) {
95
97
  return;
96
98
  }
97
99
  isVerifying.current = true;
98
100
  setLegacyIsVerifying(true);
99
101
  try {
100
102
  yield triggerConnectAndSign({
101
- walletConnector: selectedWalletConnector,
103
+ walletConnector: connector,
102
104
  });
103
105
  }
104
106
  catch (e) {
@@ -19,7 +19,7 @@ require('../../constants/colors.cjs');
19
19
  require('../../constants/values.cjs');
20
20
  require('../../../store/state/loadingAndLifecycle.cjs');
21
21
  require('../../../shared/consts/index.cjs');
22
- require('../../../events/dynamicEvents.cjs');
22
+ var dynamicEvents = require('../../../events/dynamicEvents.cjs');
23
23
  var useConnectAndSign = require('../authenticationHooks/useConnectAndSign/useConnectAndSign.cjs');
24
24
  var ErrorContext = require('../../../context/ErrorContext/ErrorContext.cjs');
25
25
  require('../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
@@ -179,14 +179,20 @@ const useWalletItemActions = () => {
179
179
  activeAccountAlreadyLinked,
180
180
  connectedAccounts,
181
181
  linkedWallets,
182
+ walletConnectorKey: walletConnector.key,
182
183
  });
183
- if (activeAccountAlreadyLinked) {
184
- setMultiWalletWidgetState('awaiting_account_switch', 'linking_new_wallet');
185
- }
186
- else {
184
+ setSelectedWalletConnectorKey(walletConnector.key);
185
+ if (!activeAccountAlreadyLinked) {
187
186
  setMultiWalletWidgetState('awaiting_signature', undefined, 'linking_new_wallet');
187
+ return;
188
188
  }
189
- setSelectedWalletConnectorKey(walletConnector.key);
189
+ const isTryingToUpdateUnkownWallet = activeAccountAlreadyLinked.connector.key === 'unknown';
190
+ if (isTryingToUpdateUnkownWallet) {
191
+ //prompt the user to connect and sign with the wallet
192
+ dynamicEvents.dynamicEvents.emit('triggerConnectAndSign', walletConnector);
193
+ return;
194
+ }
195
+ setMultiWalletWidgetState('awaiting_account_switch', 'linking_new_wallet');
190
196
  });
191
197
  const openWallet = (walletKey, handlers) => {
192
198
  var _a;
@@ -15,7 +15,7 @@ import '../../constants/colors.js';
15
15
  import '../../constants/values.js';
16
16
  import '../../../store/state/loadingAndLifecycle.js';
17
17
  import '../../../shared/consts/index.js';
18
- import '../../../events/dynamicEvents.js';
18
+ import { dynamicEvents } from '../../../events/dynamicEvents.js';
19
19
  import { useConnectAndSign } from '../authenticationHooks/useConnectAndSign/useConnectAndSign.js';
20
20
  import { useErrorContext } from '../../../context/ErrorContext/ErrorContext.js';
21
21
  import '../../../context/AccessDeniedContext/AccessDeniedContext.js';
@@ -175,14 +175,20 @@ const useWalletItemActions = () => {
175
175
  activeAccountAlreadyLinked,
176
176
  connectedAccounts,
177
177
  linkedWallets,
178
+ walletConnectorKey: walletConnector.key,
178
179
  });
179
- if (activeAccountAlreadyLinked) {
180
- setMultiWalletWidgetState('awaiting_account_switch', 'linking_new_wallet');
181
- }
182
- else {
180
+ setSelectedWalletConnectorKey(walletConnector.key);
181
+ if (!activeAccountAlreadyLinked) {
183
182
  setMultiWalletWidgetState('awaiting_signature', undefined, 'linking_new_wallet');
183
+ return;
184
184
  }
185
- setSelectedWalletConnectorKey(walletConnector.key);
185
+ const isTryingToUpdateUnkownWallet = activeAccountAlreadyLinked.connector.key === 'unknown';
186
+ if (isTryingToUpdateUnkownWallet) {
187
+ //prompt the user to connect and sign with the wallet
188
+ dynamicEvents.emit('triggerConnectAndSign', walletConnector);
189
+ return;
190
+ }
191
+ setMultiWalletWidgetState('awaiting_account_switch', 'linking_new_wallet');
186
192
  });
187
193
  const openWallet = (walletKey, handlers) => {
188
194
  var _a;