@dynamic-labs/sdk-react-core 1.3.0 → 1.3.1
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 +9 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +11 -11
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.cjs +2 -2
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.js +2 -2
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.cjs +7 -3
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.js +7 -3
- package/src/lib/context/PhantomRedirectContext/PhantomRedirectContext.cjs +6 -1
- package/src/lib/context/PhantomRedirectContext/PhantomRedirectContext.js +6 -1
- package/src/lib/utils/hooks/useEmbeddedWallet/useTurnkey/useTurnkey.cjs +2 -9
- package/src/lib/utils/hooks/useEmbeddedWallet/useTurnkey/useTurnkey.js +2 -9
- package/src/lib/utils/hooks/useIsLoggedIn/useIsLoggedIn.cjs +10 -5
- package/src/lib/utils/hooks/useIsLoggedIn/useIsLoggedIn.js +10 -5
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.cjs +4 -2
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.js +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
|
|
2
|
+
### [1.3.1](https://github.com/dynamic-labs/DynamicAuth/compare/v1.3.0...v1.3.1) (2024-03-08)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* pass account and chain to walletClient ([#4865](https://github.com/dynamic-labs/DynamicAuth/issues/4865)) ([#4905](https://github.com/dynamic-labs/DynamicAuth/issues/4905)) ([0f4e79f](https://github.com/dynamic-labs/DynamicAuth/commit/0f4e79ff36f8a3ef63c59bb9f80429cdefbe7307))
|
|
8
|
+
* update btckit network conversion for signpsbt to use correct network ([#4882](https://github.com/dynamic-labs/DynamicAuth/issues/4882)) ([3c14f55](https://github.com/dynamic-labs/DynamicAuth/commit/3c14f55f6e37718a095752d0e04bfbac45fee75c))
|
|
9
|
+
* better auth state handling when logged in with disabled wallets ([#4862](https://github.com/dynamic-labs/DynamicAuth/issues/4862)) ([8cc2a1c](https://github.com/dynamic-labs/DynamicAuth/commit/8cc2a1c4f31cf6acb61d814a3410c5e77da21c50))
|
|
10
|
+
|
|
2
11
|
## [1.3.0](https://github.com/dynamic-labs/DynamicAuth/compare/v1.2.0...v1.3.0) (2024-03-05)
|
|
3
12
|
|
|
4
13
|
|
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": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -16,16 +16,16 @@
|
|
|
16
16
|
"react-focus-lock": "2.9.2",
|
|
17
17
|
"react-i18next": "^13.2.0",
|
|
18
18
|
"yup": "0.32.11",
|
|
19
|
-
"@dynamic-labs/ethereum": "1.3.
|
|
20
|
-
"@dynamic-labs/iconic": "1.3.
|
|
21
|
-
"@dynamic-labs/logger": "1.3.
|
|
22
|
-
"@dynamic-labs/multi-wallet": "1.3.
|
|
23
|
-
"@dynamic-labs/rpc-providers": "1.3.
|
|
24
|
-
"@dynamic-labs/types": "1.3.
|
|
25
|
-
"@dynamic-labs/utils": "1.3.
|
|
26
|
-
"@dynamic-labs/viem-utils": "1.3.
|
|
27
|
-
"@dynamic-labs/wallet-book": "1.3.
|
|
28
|
-
"@dynamic-labs/wallet-connector-core": "1.3.
|
|
19
|
+
"@dynamic-labs/ethereum": "1.3.1",
|
|
20
|
+
"@dynamic-labs/iconic": "1.3.1",
|
|
21
|
+
"@dynamic-labs/logger": "1.3.1",
|
|
22
|
+
"@dynamic-labs/multi-wallet": "1.3.1",
|
|
23
|
+
"@dynamic-labs/rpc-providers": "1.3.1",
|
|
24
|
+
"@dynamic-labs/types": "1.3.1",
|
|
25
|
+
"@dynamic-labs/utils": "1.3.1",
|
|
26
|
+
"@dynamic-labs/viem-utils": "1.3.1",
|
|
27
|
+
"@dynamic-labs/wallet-book": "1.3.1",
|
|
28
|
+
"@dynamic-labs/wallet-connector-core": "1.3.1",
|
|
29
29
|
"eventemitter3": "5.0.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
@@ -93,8 +93,6 @@ const useHandleLogout = (params) => {
|
|
|
93
93
|
// do not await this async call - just fire and forget
|
|
94
94
|
api.revokeSession({ environmentId: p.environmentId, sessionId: p.user.sessionId }, jwt);
|
|
95
95
|
}
|
|
96
|
-
yield Promise.all(p.walletConnectors.map((connector) => connector.endSession()));
|
|
97
|
-
yield Promise.all(p.connectedWallets.map((connectedWallet) => connectedWallet.connector.endSession()));
|
|
98
96
|
// Necessary when user logs out in user data collection view
|
|
99
97
|
// Dont require flag to be set though
|
|
100
98
|
if (p.isVerificationInProgress)
|
|
@@ -118,6 +116,8 @@ const useHandleLogout = (params) => {
|
|
|
118
116
|
p.removeConnectedNameService();
|
|
119
117
|
dynamicEvents.dynamicEvents.emit('logout');
|
|
120
118
|
p.removeUser();
|
|
119
|
+
yield Promise.all(p.walletConnectors.map((connector) => connector.endSession()));
|
|
120
|
+
yield Promise.all(p.connectedWallets.map((connectedWallet) => connectedWallet.connector.endSession()));
|
|
121
121
|
}), []);
|
|
122
122
|
/** Allows triggering a logout from anywhere in the code */
|
|
123
123
|
useDynamicEvents.useInternalDynamicEvents('triggerLogout', () => logout());
|
|
@@ -89,8 +89,6 @@ const useHandleLogout = (params) => {
|
|
|
89
89
|
// do not await this async call - just fire and forget
|
|
90
90
|
revokeSession({ environmentId: p.environmentId, sessionId: p.user.sessionId }, jwt);
|
|
91
91
|
}
|
|
92
|
-
yield Promise.all(p.walletConnectors.map((connector) => connector.endSession()));
|
|
93
|
-
yield Promise.all(p.connectedWallets.map((connectedWallet) => connectedWallet.connector.endSession()));
|
|
94
92
|
// Necessary when user logs out in user data collection view
|
|
95
93
|
// Dont require flag to be set though
|
|
96
94
|
if (p.isVerificationInProgress)
|
|
@@ -114,6 +112,8 @@ const useHandleLogout = (params) => {
|
|
|
114
112
|
p.removeConnectedNameService();
|
|
115
113
|
dynamicEvents.emit('logout');
|
|
116
114
|
p.removeUser();
|
|
115
|
+
yield Promise.all(p.walletConnectors.map((connector) => connector.endSession()));
|
|
116
|
+
yield Promise.all(p.connectedWallets.map((connectedWallet) => connectedWallet.connector.endSession()));
|
|
117
117
|
}), []);
|
|
118
118
|
/** Allows triggering a logout from anywhere in the code */
|
|
119
119
|
useInternalDynamicEvents('triggerLogout', () => logout());
|
|
@@ -105,9 +105,13 @@ const useCustomerCallbacks = ({ callbacks: { onAuthSuccess, onLinkSuccess, onUse
|
|
|
105
105
|
if (!authToken || (user.isAuthenticatedWithAWallet && !primaryWallet)) {
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
handleNextCallback(callbackQueue[0], authToken, user);
|
|
109
|
+
setCallbackQueue((prev) => {
|
|
110
|
+
const [resolvedCallback, ...updatedQueue] = prev;
|
|
111
|
+
logger.logger.debug('Resolved callback: ', resolvedCallback.callback);
|
|
112
|
+
logger.logger.debug('Callbacks in queue: ', updatedQueue.map((c) => c.callback));
|
|
113
|
+
return updatedQueue;
|
|
114
|
+
});
|
|
111
115
|
}, [callbackQueue, handleNextCallback, primaryWallet, user]);
|
|
112
116
|
const setCallback = (callback, params) => {
|
|
113
117
|
setCallbackQueue((prev) => [...prev, { callback, params }]);
|
|
@@ -101,9 +101,13 @@ const useCustomerCallbacks = ({ callbacks: { onAuthSuccess, onLinkSuccess, onUse
|
|
|
101
101
|
if (!authToken || (user.isAuthenticatedWithAWallet && !primaryWallet)) {
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
handleNextCallback(callbackQueue[0], authToken, user);
|
|
105
|
+
setCallbackQueue((prev) => {
|
|
106
|
+
const [resolvedCallback, ...updatedQueue] = prev;
|
|
107
|
+
logger.debug('Resolved callback: ', resolvedCallback.callback);
|
|
108
|
+
logger.debug('Callbacks in queue: ', updatedQueue.map((c) => c.callback));
|
|
109
|
+
return updatedQueue;
|
|
110
|
+
});
|
|
107
111
|
}, [callbackQueue, handleNextCallback, primaryWallet, user]);
|
|
108
112
|
const setCallback = (callback, params) => {
|
|
109
113
|
setCallbackQueue((prev) => [...prev, { callback, params }]);
|
|
@@ -96,7 +96,12 @@ const PhantomRedirectContextProvider = ({ children, }) => {
|
|
|
96
96
|
handleUserResponse();
|
|
97
97
|
return;
|
|
98
98
|
}
|
|
99
|
-
}, [
|
|
99
|
+
}, [
|
|
100
|
+
handleConnectResponse,
|
|
101
|
+
handleUserResponse,
|
|
102
|
+
phantomRedirectConnector,
|
|
103
|
+
sdkHasLoaded,
|
|
104
|
+
]);
|
|
100
105
|
return (jsxRuntime.jsx(PhantomRedirectContext.Provider, { value: {
|
|
101
106
|
phantomRedirectConnector,
|
|
102
107
|
}, children: children }));
|
|
@@ -92,7 +92,12 @@ const PhantomRedirectContextProvider = ({ children, }) => {
|
|
|
92
92
|
handleUserResponse();
|
|
93
93
|
return;
|
|
94
94
|
}
|
|
95
|
-
}, [
|
|
95
|
+
}, [
|
|
96
|
+
handleConnectResponse,
|
|
97
|
+
handleUserResponse,
|
|
98
|
+
phantomRedirectConnector,
|
|
99
|
+
sdkHasLoaded,
|
|
100
|
+
]);
|
|
96
101
|
return (jsx(PhantomRedirectContext.Provider, { value: {
|
|
97
102
|
phantomRedirectConnector,
|
|
98
103
|
}, children: children }));
|
|
@@ -79,7 +79,7 @@ var useInternalDynamicContext = require('../../../../context/DynamicContext/useD
|
|
|
79
79
|
|
|
80
80
|
// Hook exposed to customers and used internally to trigger embedded wallet creation
|
|
81
81
|
const useTurnkey = () => {
|
|
82
|
-
const { projectSettings, setPrimaryWalletId, walletConnectorOptions, setShowAuthFlow,
|
|
82
|
+
const { projectSettings, setPrimaryWalletId, walletConnectorOptions, setShowAuthFlow, environmentId, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
83
83
|
const { setView } = ViewContext.useViewContext();
|
|
84
84
|
const { createDynamicEmbeddedWalletMutation } = useCreateDynamicEmbeddedWalletMutation.useCreateDynamicEmbeddedWalletMutation();
|
|
85
85
|
const startPregeneratedWalletCreationFlow = React.useCallback((jwt, decodedJwt) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -171,12 +171,7 @@ const useTurnkey = () => {
|
|
|
171
171
|
const embeddedWalletVerifiedCredential = findEmbeddedWalletFromVerifiedCredentials.findEmbeddedWalletFromVerifiedCredentials(jwt, chain);
|
|
172
172
|
// if user logged in with MM for example, just continue the flow
|
|
173
173
|
if (!embeddedWalletVerifiedCredential) {
|
|
174
|
-
|
|
175
|
-
// at this point primary wallet is still undefined and we need to set it
|
|
176
|
-
if (!primaryWallet) {
|
|
177
|
-
setPrimaryWalletId(userWaletsCredentials[0].id);
|
|
178
|
-
}
|
|
179
|
-
return Promise.resolve(primaryWallet);
|
|
174
|
+
throw new Error('Primary wallet is not an embedded wallet');
|
|
180
175
|
}
|
|
181
176
|
// if user already has embedded wallet, returns it
|
|
182
177
|
return returnEmbeddedWallet(jwt, embeddedWalletVerifiedCredential);
|
|
@@ -186,8 +181,6 @@ const useTurnkey = () => {
|
|
|
186
181
|
returnEmbeddedWallet,
|
|
187
182
|
startEmbeddedWalletCreationFlow,
|
|
188
183
|
startPregeneratedWalletCreationFlow,
|
|
189
|
-
primaryWallet,
|
|
190
|
-
setPrimaryWalletId,
|
|
191
184
|
]);
|
|
192
185
|
return {
|
|
193
186
|
createTurnkeyWallet,
|
|
@@ -75,7 +75,7 @@ import { useInternalDynamicContext } from '../../../../context/DynamicContext/us
|
|
|
75
75
|
|
|
76
76
|
// Hook exposed to customers and used internally to trigger embedded wallet creation
|
|
77
77
|
const useTurnkey = () => {
|
|
78
|
-
const { projectSettings, setPrimaryWalletId, walletConnectorOptions, setShowAuthFlow,
|
|
78
|
+
const { projectSettings, setPrimaryWalletId, walletConnectorOptions, setShowAuthFlow, environmentId, } = useInternalDynamicContext();
|
|
79
79
|
const { setView } = useViewContext();
|
|
80
80
|
const { createDynamicEmbeddedWalletMutation } = useCreateDynamicEmbeddedWalletMutation();
|
|
81
81
|
const startPregeneratedWalletCreationFlow = useCallback((jwt, decodedJwt) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -167,12 +167,7 @@ const useTurnkey = () => {
|
|
|
167
167
|
const embeddedWalletVerifiedCredential = findEmbeddedWalletFromVerifiedCredentials(jwt, chain);
|
|
168
168
|
// if user logged in with MM for example, just continue the flow
|
|
169
169
|
if (!embeddedWalletVerifiedCredential) {
|
|
170
|
-
|
|
171
|
-
// at this point primary wallet is still undefined and we need to set it
|
|
172
|
-
if (!primaryWallet) {
|
|
173
|
-
setPrimaryWalletId(userWaletsCredentials[0].id);
|
|
174
|
-
}
|
|
175
|
-
return Promise.resolve(primaryWallet);
|
|
170
|
+
throw new Error('Primary wallet is not an embedded wallet');
|
|
176
171
|
}
|
|
177
172
|
// if user already has embedded wallet, returns it
|
|
178
173
|
return returnEmbeddedWallet(jwt, embeddedWalletVerifiedCredential);
|
|
@@ -182,8 +177,6 @@ const useTurnkey = () => {
|
|
|
182
177
|
returnEmbeddedWallet,
|
|
183
178
|
startEmbeddedWalletCreationFlow,
|
|
184
179
|
startPregeneratedWalletCreationFlow,
|
|
185
|
-
primaryWallet,
|
|
186
|
-
setPrimaryWalletId,
|
|
187
180
|
]);
|
|
188
181
|
return {
|
|
189
182
|
createTurnkeyWallet,
|
|
@@ -73,20 +73,25 @@ require('../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCa
|
|
|
73
73
|
var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
|
|
74
74
|
|
|
75
75
|
const useIsLoggedIn = () => {
|
|
76
|
-
var _a, _b;
|
|
76
|
+
var _a, _b, _c;
|
|
77
77
|
const { user, primaryWallet, authMode, projectSettings } = useInternalDynamicContext.useInternalDynamicContext();
|
|
78
78
|
const isTurnkeyProviderEnabled = isTurnkeyEnabled.isTurnkeyEnabled(projectSettings);
|
|
79
79
|
// a user is set even when on connect-only mode if signing in with social,
|
|
80
80
|
// but it won't have a primaryWallet in this case
|
|
81
81
|
const isLoggedIn = Boolean(user) || (authMode === 'connect-only' && Boolean(primaryWallet));
|
|
82
|
+
const userWaletsCredentials = (_a = user === null || user === void 0 ? void 0 : user.verifiedCredentials) === null || _a === void 0 ? void 0 : _a.filter(({ walletProvider }) => walletProvider);
|
|
83
|
+
const hasEmbeddedWalletVerifiedCredential = Boolean(userWaletsCredentials === null || userWaletsCredentials === void 0 ? void 0 : userWaletsCredentials.find(({ walletProvider }) => walletProvider === 'embeddedWallet'));
|
|
84
|
+
const isTurnkeyPregen = isTurnkeyProviderEnabled &&
|
|
85
|
+
((_c = (_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _b === void 0 ? void 0 : _b.embeddedWallets) === null || _c === void 0 ? void 0 : _c.automaticEmbeddedWalletCreation) &&
|
|
86
|
+
!(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets.forceAuthenticatorAtSignup);
|
|
87
|
+
const shouldHaveTurnkeyWallet = isTurnkeyPregen &&
|
|
88
|
+
// if user doesn't have a branded wallet only
|
|
89
|
+
(!(userWaletsCredentials === null || userWaletsCredentials === void 0 ? void 0 : userWaletsCredentials.length) || hasEmbeddedWalletVerifiedCredential);
|
|
82
90
|
// if turnkey is enabled we need to check if the user that is logged/connected
|
|
83
91
|
// has a primaryWallet to not show the widget without secure
|
|
84
|
-
if (
|
|
85
|
-
((_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.embeddedWallets) === null || _b === void 0 ? void 0 : _b.automaticEmbeddedWalletCreation) &&
|
|
86
|
-
!(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets.forceAuthenticatorAtSignup)) {
|
|
92
|
+
if (shouldHaveTurnkeyWallet) {
|
|
87
93
|
return Boolean(primaryWallet && isLoggedIn);
|
|
88
94
|
}
|
|
89
|
-
// return isLoggedIn;
|
|
90
95
|
return isLoggedIn;
|
|
91
96
|
};
|
|
92
97
|
|
|
@@ -69,20 +69,25 @@ import '../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCar
|
|
|
69
69
|
import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.js';
|
|
70
70
|
|
|
71
71
|
const useIsLoggedIn = () => {
|
|
72
|
-
var _a, _b;
|
|
72
|
+
var _a, _b, _c;
|
|
73
73
|
const { user, primaryWallet, authMode, projectSettings } = useInternalDynamicContext();
|
|
74
74
|
const isTurnkeyProviderEnabled = isTurnkeyEnabled(projectSettings);
|
|
75
75
|
// a user is set even when on connect-only mode if signing in with social,
|
|
76
76
|
// but it won't have a primaryWallet in this case
|
|
77
77
|
const isLoggedIn = Boolean(user) || (authMode === 'connect-only' && Boolean(primaryWallet));
|
|
78
|
+
const userWaletsCredentials = (_a = user === null || user === void 0 ? void 0 : user.verifiedCredentials) === null || _a === void 0 ? void 0 : _a.filter(({ walletProvider }) => walletProvider);
|
|
79
|
+
const hasEmbeddedWalletVerifiedCredential = Boolean(userWaletsCredentials === null || userWaletsCredentials === void 0 ? void 0 : userWaletsCredentials.find(({ walletProvider }) => walletProvider === 'embeddedWallet'));
|
|
80
|
+
const isTurnkeyPregen = isTurnkeyProviderEnabled &&
|
|
81
|
+
((_c = (_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _b === void 0 ? void 0 : _b.embeddedWallets) === null || _c === void 0 ? void 0 : _c.automaticEmbeddedWalletCreation) &&
|
|
82
|
+
!(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets.forceAuthenticatorAtSignup);
|
|
83
|
+
const shouldHaveTurnkeyWallet = isTurnkeyPregen &&
|
|
84
|
+
// if user doesn't have a branded wallet only
|
|
85
|
+
(!(userWaletsCredentials === null || userWaletsCredentials === void 0 ? void 0 : userWaletsCredentials.length) || hasEmbeddedWalletVerifiedCredential);
|
|
78
86
|
// if turnkey is enabled we need to check if the user that is logged/connected
|
|
79
87
|
// has a primaryWallet to not show the widget without secure
|
|
80
|
-
if (
|
|
81
|
-
((_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.embeddedWallets) === null || _b === void 0 ? void 0 : _b.automaticEmbeddedWalletCreation) &&
|
|
82
|
-
!(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets.forceAuthenticatorAtSignup)) {
|
|
88
|
+
if (shouldHaveTurnkeyWallet) {
|
|
83
89
|
return Boolean(primaryWallet && isLoggedIn);
|
|
84
90
|
}
|
|
85
|
-
// return isLoggedIn;
|
|
86
91
|
return isLoggedIn;
|
|
87
92
|
};
|
|
88
93
|
|
|
@@ -4,12 +4,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
6
6
|
var utils = require('@dynamic-labs/utils');
|
|
7
|
+
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
7
8
|
require('react');
|
|
8
9
|
require('../../../context/DynamicContext/DynamicContext.cjs');
|
|
9
10
|
require('@dynamic-labs/sdk-api');
|
|
10
11
|
require('../../../shared/logger.cjs');
|
|
11
12
|
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');
|
|
@@ -155,9 +155,11 @@ const useWalletItemActions = () => {
|
|
|
155
155
|
};
|
|
156
156
|
const handleWalletItemClick = (wallet) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
157
157
|
const { walletConnector, isInstalledOnBrowser } = wallet;
|
|
158
|
+
const shouldEndWalletConnectorSession = walletConnector.connectedChain === 'FLOW' ||
|
|
159
|
+
walletConnectorCore.isPhantomRedirectConnector(walletConnector);
|
|
158
160
|
if (mockedSDK)
|
|
159
161
|
return;
|
|
160
|
-
if (
|
|
162
|
+
if (shouldEndWalletConnectorSession) {
|
|
161
163
|
yield walletConnector.endSession();
|
|
162
164
|
}
|
|
163
165
|
setLegacyIsVerifying(false);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
2
2
|
import { isMobile } from '@dynamic-labs/utils';
|
|
3
|
+
import { isPhantomRedirectConnector } from '@dynamic-labs/wallet-connector-core';
|
|
3
4
|
import 'react';
|
|
4
5
|
import '../../../context/DynamicContext/DynamicContext.js';
|
|
5
6
|
import '@dynamic-labs/sdk-api';
|
|
6
7
|
import '../../../shared/logger.js';
|
|
7
8
|
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';
|
|
@@ -151,9 +151,11 @@ const useWalletItemActions = () => {
|
|
|
151
151
|
};
|
|
152
152
|
const handleWalletItemClick = (wallet) => __awaiter(void 0, void 0, void 0, function* () {
|
|
153
153
|
const { walletConnector, isInstalledOnBrowser } = wallet;
|
|
154
|
+
const shouldEndWalletConnectorSession = walletConnector.connectedChain === 'FLOW' ||
|
|
155
|
+
isPhantomRedirectConnector(walletConnector);
|
|
154
156
|
if (mockedSDK)
|
|
155
157
|
return;
|
|
156
|
-
if (
|
|
158
|
+
if (shouldEndWalletConnectorSession) {
|
|
157
159
|
yield walletConnector.endSession();
|
|
158
160
|
}
|
|
159
161
|
setLegacyIsVerifying(false);
|