@dynamic-labs/sdk-react-core 0.19.0-alpha.16 → 0.19.0-alpha.18
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 +19 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +9 -9
- package/src/lib/components/SyncPasskeyFlow/SyncPasskeyFlow.cjs +4 -3
- package/src/lib/components/SyncPasskeyFlow/SyncPasskeyFlow.js +4 -3
- package/src/lib/context/DynamicContext/DynamicContext.cjs +2 -2
- package/src/lib/context/DynamicContext/DynamicContext.js +2 -2
- package/src/lib/context/DynamicContext/handleDisconnectWallet/handleDisconnectWallet.cjs +13 -0
- package/src/lib/context/DynamicContext/handleDisconnectWallet/handleDisconnectWallet.d.ts +1 -1
- package/src/lib/context/DynamicContext/handleDisconnectWallet/handleDisconnectWallet.js +13 -0
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.cjs +31 -7
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.js +31 -7
- package/src/lib/utils/functions/index.d.ts +1 -1
- package/src/lib/utils/functions/isTurnkeyEnabled/index.d.ts +1 -0
- package/src/lib/utils/functions/isTurnkeyEnabled/isTurnkeyEnabled.cjs +10 -0
- package/src/lib/utils/functions/isTurnkeyEnabled/isTurnkeyEnabled.d.ts +2 -0
- package/src/lib/utils/functions/isTurnkeyEnabled/isTurnkeyEnabled.js +6 -0
- package/src/lib/utils/functions/walletListBuilder/utils/groupWalletOptions/groupWalletOptions.cjs +6 -2
- package/src/lib/utils/functions/walletListBuilder/utils/groupWalletOptions/groupWalletOptions.js +6 -2
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +43 -25
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.d.ts +3 -2
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +43 -25
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.cjs +13 -5
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.js +13 -5
- package/src/lib/utils/hooks/useIsLoggedIn/useIsLoggedIn.cjs +2 -4
- package/src/lib/utils/hooks/useIsLoggedIn/useIsLoggedIn.js +2 -4
- package/src/lib/utils/hooks/usePrimaryWalletId/usePrimaryWalletId.cjs +2 -2
- package/src/lib/utils/hooks/usePrimaryWalletId/usePrimaryWalletId.js +2 -2
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +1 -1
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +1 -1
- package/src/lib/views/EmailVerification/EmailVerification.cjs +9 -3
- package/src/lib/views/EmailVerification/EmailVerification.js +9 -3
- package/src/lib/views/LoginView/sections/EmailSignInSection/LoginEmailForm.cjs +2 -3
- package/src/lib/views/LoginView/sections/EmailSignInSection/LoginEmailForm.js +2 -3
- package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSimpleSignIn/WalletSimpleSignIn.cjs +1 -4
- package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSimpleSignIn/WalletSimpleSignIn.js +1 -4
- package/src/lib/views/LoginView/useLoginView.cjs +11 -3
- package/src/lib/views/LoginView/useLoginView.js +11 -3
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +1 -1
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +1 -1
- package/src/lib/views/WalletGroupView/WalletGroupView.cjs +1 -1
- package/src/lib/views/WalletGroupView/WalletGroupView.js +1 -1
- package/src/lib/views/WalletList/WalletList.cjs +1 -1
- package/src/lib/views/WalletList/WalletList.js +1 -1
- package/src/lib/utils/functions/isPasskeyEmbeddedWalletEnabled/index.d.ts +0 -1
- package/src/lib/utils/functions/isPasskeyEmbeddedWalletEnabled/isPasskeyEmbeddedWalletEnabled.cjs +0 -7
- package/src/lib/utils/functions/isPasskeyEmbeddedWalletEnabled/isPasskeyEmbeddedWalletEnabled.d.ts +0 -2
- package/src/lib/utils/functions/isPasskeyEmbeddedWalletEnabled/isPasskeyEmbeddedWalletEnabled.js +0 -3
|
@@ -19,9 +19,35 @@ import { createVisit } from '../../../data/api.js';
|
|
|
19
19
|
import '@dynamic-labs/multi-wallet';
|
|
20
20
|
import { shouldManuallyReconnectOnRefresh } from '../../functions/shouldManuallyReconnectOnRefresh/shouldManuallyReconnectOnRefresh.js';
|
|
21
21
|
|
|
22
|
-
const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingOnConnectOnly, environmentId, primaryWalletId, setPrimaryWalletId, wallets, onUnlink, onBeforeConnectSuccessConfirmation, setShowAuthFlow, }) => {
|
|
22
|
+
const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingOnConnectOnly, environmentId, primaryWalletId, setPrimaryWalletId, wallets, onUnlink, onBeforeConnectSuccessConfirmation, setShowAuthFlow, isBridgeFlow, }) => {
|
|
23
23
|
const [connectedWalletsInfo, setConnectedWalletsInfo, removeConnectedWalletsInfo,] = useLocalStorage(CONNECTED_WALLETS_INFO, []);
|
|
24
24
|
const [connectedWallets, setConnectedWallets] = useState([]);
|
|
25
|
+
const unlinkConnectedWallet = useCallback((walletId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
26
|
+
const walletToDisconnect = connectedWallets.find((wallet) => wallet.id === walletId);
|
|
27
|
+
yield (walletToDisconnect === null || walletToDisconnect === void 0 ? void 0 : walletToDisconnect.connector.endSession());
|
|
28
|
+
const updatedConnectedWalletsInfo = connectedWalletsInfo.filter((wallet) => wallet.id !== walletId);
|
|
29
|
+
setConnectedWalletsInfo(updatedConnectedWalletsInfo);
|
|
30
|
+
onUnlink(updatedConnectedWalletsInfo, walletToDisconnect);
|
|
31
|
+
if (walletId !== primaryWalletId) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const hasConnectedWallet = updatedConnectedWalletsInfo.length > 0;
|
|
35
|
+
if (isBridgeFlow || !hasConnectedWallet) {
|
|
36
|
+
clearPrimaryWalletId();
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
setPrimaryWalletId(updatedConnectedWalletsInfo[0].id);
|
|
40
|
+
}
|
|
41
|
+
}), [
|
|
42
|
+
clearPrimaryWalletId,
|
|
43
|
+
connectedWallets,
|
|
44
|
+
connectedWalletsInfo,
|
|
45
|
+
isBridgeFlow,
|
|
46
|
+
onUnlink,
|
|
47
|
+
primaryWalletId,
|
|
48
|
+
setConnectedWalletsInfo,
|
|
49
|
+
setPrimaryWalletId,
|
|
50
|
+
]);
|
|
25
51
|
// The function to update and define the connectedWallets list.
|
|
26
52
|
// It uses walletConnector to get the current wallet address and network
|
|
27
53
|
// The address and network in the runtime are updated by the event listeners
|
|
@@ -32,14 +58,19 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
|
|
|
32
58
|
if (!walletConnectors.length) {
|
|
33
59
|
return;
|
|
34
60
|
}
|
|
35
|
-
const
|
|
61
|
+
const updatedConnectedWallets = (yield Promise.all(connectedWalletsInfo.map((storedConnectedWalletInfo) => __awaiter(void 0, void 0, void 0, function* () {
|
|
36
62
|
const walletConnector = getWalletConnectorByKey(walletConnectors, storedConnectedWalletInfo.walletConnectorKey);
|
|
37
63
|
if (!walletConnector) {
|
|
38
64
|
logger.error('Could not find walletConnector: ' +
|
|
39
65
|
storedConnectedWalletInfo.walletConnectorKey);
|
|
40
|
-
|
|
66
|
+
yield unlinkConnectedWallet(storedConnectedWalletInfo.id);
|
|
67
|
+
return null;
|
|
41
68
|
}
|
|
42
69
|
const [walletAddress] = yield walletConnector.getConnectedAccounts();
|
|
70
|
+
if (!walletAddress) {
|
|
71
|
+
yield unlinkConnectedWallet(storedConnectedWalletInfo.id);
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
43
74
|
const walletNetwork = yield walletConnector.getNetwork();
|
|
44
75
|
const walletChain = walletConnector.connectedChain;
|
|
45
76
|
const walletObject = {
|
|
@@ -50,14 +81,15 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
|
|
|
50
81
|
id: storedConnectedWalletInfo.id,
|
|
51
82
|
network: walletNetwork,
|
|
52
83
|
};
|
|
53
|
-
return
|
|
84
|
+
return walletObject;
|
|
54
85
|
})))).filter((wallet) => Boolean(wallet));
|
|
55
|
-
setConnectedWallets(
|
|
56
|
-
}), [connectedWalletsInfo, wallets]);
|
|
86
|
+
setConnectedWallets(updatedConnectedWallets);
|
|
87
|
+
}), [connectedWalletsInfo, unlinkConnectedWallet, wallets]);
|
|
57
88
|
// Generate the connectedWallets list when connectedWalletsInfo (localStorage) or memoized wallet connector updates
|
|
58
89
|
useEffect(() => {
|
|
59
90
|
updateConnectedWalletsList();
|
|
60
|
-
|
|
91
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
92
|
+
}, [connectedWalletsInfo, wallets]);
|
|
61
93
|
const getNextIdAvailable = useCallback((currentWallets) => {
|
|
62
94
|
const existingIds = currentWallets.map(({ id }) => id);
|
|
63
95
|
const sortedIds = existingIds
|
|
@@ -81,15 +113,14 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
|
|
|
81
113
|
const connectedWallet = connectedWallets[0] || null;
|
|
82
114
|
// Keeps connected wallet data inside localStorage
|
|
83
115
|
const applyConnectedWalletToStore = ({ walletId, walletConnectorKey, walletChain, provider, }) => {
|
|
84
|
-
const
|
|
85
|
-
|
|
116
|
+
const updatedConnectedWalletsInfo = [...connectedWalletsInfo];
|
|
117
|
+
updatedConnectedWalletsInfo.push({
|
|
86
118
|
id: walletId,
|
|
87
119
|
provider,
|
|
88
120
|
walletChain,
|
|
89
121
|
walletConnectorKey,
|
|
90
122
|
});
|
|
91
|
-
setConnectedWalletsInfo(
|
|
92
|
-
return Promise.resolve();
|
|
123
|
+
setConnectedWalletsInfo(updatedConnectedWalletsInfo);
|
|
93
124
|
};
|
|
94
125
|
// Updates connected wallet (network and address) and verifies connected wallet connection
|
|
95
126
|
const refreshConnectedWallet = (walletId, walletConnector) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -167,20 +198,7 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
|
|
|
167
198
|
});
|
|
168
199
|
}
|
|
169
200
|
}
|
|
170
|
-
return
|
|
171
|
-
});
|
|
172
|
-
const unlinkConnectedWallet = (walletId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
173
|
-
const connectedWalletToUnlink = connectedWallets.find((wallet) => wallet.id === walletId);
|
|
174
|
-
if (!connectedWalletToUnlink) {
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
yield connectedWalletToUnlink.connector.endSession();
|
|
178
|
-
const filteredWallets = connectedWalletsInfo.filter((wallet) => wallet.id !== walletId);
|
|
179
|
-
if (walletId === primaryWalletId) {
|
|
180
|
-
clearPrimaryWalletId();
|
|
181
|
-
}
|
|
182
|
-
setConnectedWalletsInfo(filteredWallets);
|
|
183
|
-
onUnlink(connectedWalletToUnlink, filteredWallets);
|
|
201
|
+
return publicWalletAddress;
|
|
184
202
|
});
|
|
185
203
|
const getConnectedWalletById = useCallback((walletId) => connectedWallets.find((wallet) => wallet.id === walletId), [connectedWallets]);
|
|
186
204
|
return {
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
6
|
+
var React = require('react');
|
|
6
7
|
var useInternalDynamicContext = require('../../../context/DynamicContext/useInternalDynamicContext.cjs');
|
|
7
8
|
var ViewContext = require('../../../context/ViewContext/ViewContext.cjs');
|
|
8
9
|
var decodeJwt = require('../../../shared/utils/functions/decodeJwt/decodeJwt.cjs');
|
|
9
10
|
require('@dynamic-labs/iconic');
|
|
10
11
|
require('@dynamic-labs/wallet-connector-core');
|
|
11
12
|
require('react/jsx-runtime');
|
|
12
|
-
require('react');
|
|
13
13
|
require('../../../shared/logger.cjs');
|
|
14
14
|
require('@dynamic-labs/wallet-book');
|
|
15
15
|
require('@dynamic-labs/utils');
|
|
@@ -20,7 +20,7 @@ require('../../../shared/consts/index.cjs');
|
|
|
20
20
|
require('@dynamic-labs/multi-wallet');
|
|
21
21
|
var getAuthToken = require('../../functions/getAuthToken/getAuthToken.cjs');
|
|
22
22
|
require('@dynamic-labs/sdk-api');
|
|
23
|
-
var
|
|
23
|
+
var isTurnkeyEnabled = require('../../functions/isTurnkeyEnabled/isTurnkeyEnabled.cjs');
|
|
24
24
|
var isEmbeddedWalletPresent = require('../../functions/isEmbeddedWalletPresent/isEmbeddedWalletPresent.cjs');
|
|
25
25
|
var findEmbeddedWalletFromVerifiedCredentials = require('../../functions/findEmbeddedWalletFromVerifiedCredentials/findEmbeddedWalletFromVerifiedCredentials.cjs');
|
|
26
26
|
var findTurnkeyWallet = require('../../functions/findTurnkeyWallet/findTurnkeyWallet.cjs');
|
|
@@ -37,13 +37,13 @@ const useEmbeddedWallet = () => {
|
|
|
37
37
|
}
|
|
38
38
|
return isEmbeddedWalletPresent.isEmbeddedWalletPresent(jwt);
|
|
39
39
|
};
|
|
40
|
-
const createEmbeddedWallet = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
40
|
+
const createEmbeddedWallet = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
41
41
|
var _a, _b, _c, _d;
|
|
42
42
|
const jwt = (_a = getAuthToken.getAuthToken()) !== null && _a !== void 0 ? _a : onboardingOnlyJwt;
|
|
43
43
|
if (!jwt) {
|
|
44
44
|
throw new Error('User is not logged in');
|
|
45
45
|
}
|
|
46
|
-
if (!
|
|
46
|
+
if (!isTurnkeyEnabled.isTurnkeyEnabled(projectSettings)) {
|
|
47
47
|
throw new Error('Passkey embedded wallet is not enabled');
|
|
48
48
|
}
|
|
49
49
|
const embeddedWalletVerifiedCredential = findEmbeddedWalletFromVerifiedCredentials.findEmbeddedWalletFromVerifiedCredentials(jwt);
|
|
@@ -72,7 +72,15 @@ const useEmbeddedWallet = () => {
|
|
|
72
72
|
id: embeddedWalletVerifiedCredential.id,
|
|
73
73
|
};
|
|
74
74
|
return Promise.resolve(passkeyWallet);
|
|
75
|
-
})
|
|
75
|
+
}), [
|
|
76
|
+
internalEvents,
|
|
77
|
+
internalSetShowAuthFlow,
|
|
78
|
+
onboardingOnlyJwt,
|
|
79
|
+
projectSettings,
|
|
80
|
+
setPrimaryWalletId,
|
|
81
|
+
setView,
|
|
82
|
+
wallets,
|
|
83
|
+
]);
|
|
76
84
|
return {
|
|
77
85
|
createEmbeddedWallet,
|
|
78
86
|
userHasEmbeddedWallet,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
2
|
+
import { useCallback } from 'react';
|
|
2
3
|
import { useInternalDynamicContext } from '../../../context/DynamicContext/useInternalDynamicContext.js';
|
|
3
4
|
import { useViewContext } from '../../../context/ViewContext/ViewContext.js';
|
|
4
5
|
import { decodeJwt } from '../../../shared/utils/functions/decodeJwt/decodeJwt.js';
|
|
5
6
|
import '@dynamic-labs/iconic';
|
|
6
7
|
import '@dynamic-labs/wallet-connector-core';
|
|
7
8
|
import 'react/jsx-runtime';
|
|
8
|
-
import 'react';
|
|
9
9
|
import '../../../shared/logger.js';
|
|
10
10
|
import '@dynamic-labs/wallet-book';
|
|
11
11
|
import '@dynamic-labs/utils';
|
|
@@ -16,7 +16,7 @@ import '../../../shared/consts/index.js';
|
|
|
16
16
|
import '@dynamic-labs/multi-wallet';
|
|
17
17
|
import { getAuthToken } from '../../functions/getAuthToken/getAuthToken.js';
|
|
18
18
|
import '@dynamic-labs/sdk-api';
|
|
19
|
-
import {
|
|
19
|
+
import { isTurnkeyEnabled } from '../../functions/isTurnkeyEnabled/isTurnkeyEnabled.js';
|
|
20
20
|
import { isEmbeddedWalletPresent } from '../../functions/isEmbeddedWalletPresent/isEmbeddedWalletPresent.js';
|
|
21
21
|
import { findEmbeddedWalletFromVerifiedCredentials } from '../../functions/findEmbeddedWalletFromVerifiedCredentials/findEmbeddedWalletFromVerifiedCredentials.js';
|
|
22
22
|
import { findTurnkeyWallet } from '../../functions/findTurnkeyWallet/findTurnkeyWallet.js';
|
|
@@ -33,13 +33,13 @@ const useEmbeddedWallet = () => {
|
|
|
33
33
|
}
|
|
34
34
|
return isEmbeddedWalletPresent(jwt);
|
|
35
35
|
};
|
|
36
|
-
const createEmbeddedWallet = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
36
|
+
const createEmbeddedWallet = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
37
37
|
var _a, _b, _c, _d;
|
|
38
38
|
const jwt = (_a = getAuthToken()) !== null && _a !== void 0 ? _a : onboardingOnlyJwt;
|
|
39
39
|
if (!jwt) {
|
|
40
40
|
throw new Error('User is not logged in');
|
|
41
41
|
}
|
|
42
|
-
if (!
|
|
42
|
+
if (!isTurnkeyEnabled(projectSettings)) {
|
|
43
43
|
throw new Error('Passkey embedded wallet is not enabled');
|
|
44
44
|
}
|
|
45
45
|
const embeddedWalletVerifiedCredential = findEmbeddedWalletFromVerifiedCredentials(jwt);
|
|
@@ -68,7 +68,15 @@ const useEmbeddedWallet = () => {
|
|
|
68
68
|
id: embeddedWalletVerifiedCredential.id,
|
|
69
69
|
};
|
|
70
70
|
return Promise.resolve(passkeyWallet);
|
|
71
|
-
})
|
|
71
|
+
}), [
|
|
72
|
+
internalEvents,
|
|
73
|
+
internalSetShowAuthFlow,
|
|
74
|
+
onboardingOnlyJwt,
|
|
75
|
+
projectSettings,
|
|
76
|
+
setPrimaryWalletId,
|
|
77
|
+
setView,
|
|
78
|
+
wallets,
|
|
79
|
+
]);
|
|
72
80
|
return {
|
|
73
81
|
createEmbeddedWallet,
|
|
74
82
|
userHasEmbeddedWallet,
|
|
@@ -5,10 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var useInternalDynamicContext = require('../../../context/DynamicContext/useInternalDynamicContext.cjs');
|
|
6
6
|
|
|
7
7
|
const useIsLoggedIn = () => {
|
|
8
|
-
const {
|
|
9
|
-
|
|
10
|
-
return Boolean(user);
|
|
11
|
-
return Boolean(primaryWallet);
|
|
8
|
+
const { user, primaryWallet } = useInternalDynamicContext.useInternalDynamicContext();
|
|
9
|
+
return Boolean(user || primaryWallet);
|
|
12
10
|
};
|
|
13
11
|
|
|
14
12
|
exports.useIsLoggedIn = useIsLoggedIn;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { useInternalDynamicContext } from '../../../context/DynamicContext/useInternalDynamicContext.js';
|
|
2
2
|
|
|
3
3
|
const useIsLoggedIn = () => {
|
|
4
|
-
const {
|
|
5
|
-
|
|
6
|
-
return Boolean(user);
|
|
7
|
-
return Boolean(primaryWallet);
|
|
4
|
+
const { user, primaryWallet } = useInternalDynamicContext();
|
|
5
|
+
return Boolean(user || primaryWallet);
|
|
8
6
|
};
|
|
9
7
|
|
|
10
8
|
export { useIsLoggedIn };
|
|
@@ -25,10 +25,10 @@ const usePrimaryWalletId = (internalEvents) => {
|
|
|
25
25
|
const setPrimaryWalletId = React.useCallback((walletId) => {
|
|
26
26
|
setPrimaryWalletIdState(walletId);
|
|
27
27
|
}, [setPrimaryWalletIdState]);
|
|
28
|
-
const clearPrimaryWalletId = () => {
|
|
28
|
+
const clearPrimaryWalletId = React.useCallback(() => {
|
|
29
29
|
clearPrimaryWalletIdStorage();
|
|
30
30
|
internalEvents.emit('clearPrimaryWallet');
|
|
31
|
-
};
|
|
31
|
+
}, [clearPrimaryWalletIdStorage, internalEvents]);
|
|
32
32
|
return {
|
|
33
33
|
clearPrimaryWalletId,
|
|
34
34
|
primaryWalletId,
|
|
@@ -21,10 +21,10 @@ const usePrimaryWalletId = (internalEvents) => {
|
|
|
21
21
|
const setPrimaryWalletId = useCallback((walletId) => {
|
|
22
22
|
setPrimaryWalletIdState(walletId);
|
|
23
23
|
}, [setPrimaryWalletIdState]);
|
|
24
|
-
const clearPrimaryWalletId = () => {
|
|
24
|
+
const clearPrimaryWalletId = useCallback(() => {
|
|
25
25
|
clearPrimaryWalletIdStorage();
|
|
26
26
|
internalEvents.emit('clearPrimaryWallet');
|
|
27
|
-
};
|
|
27
|
+
}, [clearPrimaryWalletIdStorage, internalEvents]);
|
|
28
28
|
return {
|
|
29
29
|
clearPrimaryWalletId,
|
|
30
30
|
primaryWalletId,
|
|
@@ -147,7 +147,7 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
147
147
|
try {
|
|
148
148
|
// this function will check turnkey wallet enabled and create wallet if needed
|
|
149
149
|
// if not enabled, it will throw an error.
|
|
150
|
-
createEmbeddedWallet();
|
|
150
|
+
yield createEmbeddedWallet();
|
|
151
151
|
onSettled === null || onSettled === void 0 ? void 0 : onSettled();
|
|
152
152
|
}
|
|
153
153
|
catch (e) {
|
|
@@ -143,7 +143,7 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
143
143
|
try {
|
|
144
144
|
// this function will check turnkey wallet enabled and create wallet if needed
|
|
145
145
|
// if not enabled, it will throw an error.
|
|
146
|
-
createEmbeddedWallet();
|
|
146
|
+
yield createEmbeddedWallet();
|
|
147
147
|
onSettled === null || onSettled === void 0 ? void 0 : onSettled();
|
|
148
148
|
}
|
|
149
149
|
catch (e) {
|
|
@@ -95,7 +95,7 @@ const EmailVerification = () => {
|
|
|
95
95
|
const { view, setView, goToInitialView } = ViewContext.useViewContext();
|
|
96
96
|
const { error, setError, setErrorMessage } = ErrorContext.useErrorContext();
|
|
97
97
|
const { setExistentAccountData } = AccountExistsContext.useAccountExistsContext();
|
|
98
|
-
const { environmentId, onboardingOnlyJwt, handleLogOut, authToken, setOnboardingOnlyJwt, setShowAuthFlow, setCallback, setIsVerificationInProgress, isVerificationInProgress, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
98
|
+
const { environmentId, onboardingOnlyJwt, handleLogOut, authToken, setOnboardingOnlyJwt, setShowAuthFlow, setCallback, setIsVerificationInProgress, isVerificationInProgress, projectSettings, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
99
99
|
const { email, verificationUUID, setVerificationUUID } = EmailVerificationContext.useEmailVerificationContext();
|
|
100
100
|
const { loading, setLoading } = LoadingContext.useLoadingContext();
|
|
101
101
|
const { createEmbeddedWallet } = useEmbeddedWallet.useEmbeddedWallet();
|
|
@@ -127,6 +127,7 @@ const EmailVerification = () => {
|
|
|
127
127
|
setIsVerificationInProgress(false);
|
|
128
128
|
};
|
|
129
129
|
const handleComplete = React.useCallback((verificationToken) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
130
|
+
var _a;
|
|
130
131
|
setError(undefined);
|
|
131
132
|
setLoading(true);
|
|
132
133
|
if (!verificationUUID || (!authToken && !onboardingOnlyJwt)) {
|
|
@@ -147,7 +148,9 @@ const EmailVerification = () => {
|
|
|
147
148
|
try {
|
|
148
149
|
// this function will check turnkey wallet enabled and create wallet if needed
|
|
149
150
|
// if not enabled, it will throw an error.
|
|
150
|
-
|
|
151
|
+
if ((_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.automaticEmbeddedWalletCreation) {
|
|
152
|
+
yield createEmbeddedWallet();
|
|
153
|
+
}
|
|
151
154
|
}
|
|
152
155
|
catch (e) {
|
|
153
156
|
setShowAuthFlow(false);
|
|
@@ -182,6 +185,7 @@ const EmailVerification = () => {
|
|
|
182
185
|
setView,
|
|
183
186
|
]);
|
|
184
187
|
const handleEmailLogin = React.useCallback((verificationToken) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
188
|
+
var _b;
|
|
185
189
|
setError(undefined);
|
|
186
190
|
setLoading(true);
|
|
187
191
|
if (!verificationUUID) {
|
|
@@ -215,7 +219,9 @@ const EmailVerification = () => {
|
|
|
215
219
|
try {
|
|
216
220
|
// this function will check turnkey wallet enabled and create wallet if needed
|
|
217
221
|
// if not enabled, it will throw an error.
|
|
218
|
-
|
|
222
|
+
if ((_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _b === void 0 ? void 0 : _b.automaticEmbeddedWalletCreation) {
|
|
223
|
+
yield createEmbeddedWallet();
|
|
224
|
+
}
|
|
219
225
|
}
|
|
220
226
|
catch (e) {
|
|
221
227
|
setShowAuthFlow(false);
|
|
@@ -91,7 +91,7 @@ const EmailVerification = () => {
|
|
|
91
91
|
const { view, setView, goToInitialView } = useViewContext();
|
|
92
92
|
const { error, setError, setErrorMessage } = useErrorContext();
|
|
93
93
|
const { setExistentAccountData } = useAccountExistsContext();
|
|
94
|
-
const { environmentId, onboardingOnlyJwt, handleLogOut, authToken, setOnboardingOnlyJwt, setShowAuthFlow, setCallback, setIsVerificationInProgress, isVerificationInProgress, } = useInternalDynamicContext();
|
|
94
|
+
const { environmentId, onboardingOnlyJwt, handleLogOut, authToken, setOnboardingOnlyJwt, setShowAuthFlow, setCallback, setIsVerificationInProgress, isVerificationInProgress, projectSettings, } = useInternalDynamicContext();
|
|
95
95
|
const { email, verificationUUID, setVerificationUUID } = useEmailVerificationContext();
|
|
96
96
|
const { loading, setLoading } = useLoadingContext();
|
|
97
97
|
const { createEmbeddedWallet } = useEmbeddedWallet();
|
|
@@ -123,6 +123,7 @@ const EmailVerification = () => {
|
|
|
123
123
|
setIsVerificationInProgress(false);
|
|
124
124
|
};
|
|
125
125
|
const handleComplete = useCallback((verificationToken) => __awaiter(void 0, void 0, void 0, function* () {
|
|
126
|
+
var _a;
|
|
126
127
|
setError(undefined);
|
|
127
128
|
setLoading(true);
|
|
128
129
|
if (!verificationUUID || (!authToken && !onboardingOnlyJwt)) {
|
|
@@ -143,7 +144,9 @@ const EmailVerification = () => {
|
|
|
143
144
|
try {
|
|
144
145
|
// this function will check turnkey wallet enabled and create wallet if needed
|
|
145
146
|
// if not enabled, it will throw an error.
|
|
146
|
-
|
|
147
|
+
if ((_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.automaticEmbeddedWalletCreation) {
|
|
148
|
+
yield createEmbeddedWallet();
|
|
149
|
+
}
|
|
147
150
|
}
|
|
148
151
|
catch (e) {
|
|
149
152
|
setShowAuthFlow(false);
|
|
@@ -178,6 +181,7 @@ const EmailVerification = () => {
|
|
|
178
181
|
setView,
|
|
179
182
|
]);
|
|
180
183
|
const handleEmailLogin = useCallback((verificationToken) => __awaiter(void 0, void 0, void 0, function* () {
|
|
184
|
+
var _b;
|
|
181
185
|
setError(undefined);
|
|
182
186
|
setLoading(true);
|
|
183
187
|
if (!verificationUUID) {
|
|
@@ -211,7 +215,9 @@ const EmailVerification = () => {
|
|
|
211
215
|
try {
|
|
212
216
|
// this function will check turnkey wallet enabled and create wallet if needed
|
|
213
217
|
// if not enabled, it will throw an error.
|
|
214
|
-
|
|
218
|
+
if ((_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _b === void 0 ? void 0 : _b.automaticEmbeddedWalletCreation) {
|
|
219
|
+
yield createEmbeddedWallet();
|
|
220
|
+
}
|
|
215
221
|
}
|
|
216
222
|
catch (e) {
|
|
217
223
|
setShowAuthFlow(false);
|
|
@@ -20,7 +20,7 @@ require('viem');
|
|
|
20
20
|
require('../../../../shared/consts/index.cjs');
|
|
21
21
|
var useInternalDynamicContext = require('../../../../context/DynamicContext/useInternalDynamicContext.cjs');
|
|
22
22
|
require('@dynamic-labs/multi-wallet');
|
|
23
|
-
var
|
|
23
|
+
var isTurnkeyEnabled = require('../../../../utils/functions/isTurnkeyEnabled/isTurnkeyEnabled.cjs');
|
|
24
24
|
require('../../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
25
25
|
require('../../../../context/ThemeContext/ThemeContext.cjs');
|
|
26
26
|
var Input = require('../../../../components/Input/Input.cjs');
|
|
@@ -91,8 +91,7 @@ const LoginEmailForm = ({ isLoading: isExternalLoading, onSubmit, onSubmitError,
|
|
|
91
91
|
}
|
|
92
92
|
try {
|
|
93
93
|
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit();
|
|
94
|
-
if ((isEmailWalletProviderEnabled ||
|
|
95
|
-
isPasskeyEmbeddedWalletEnabled.isPasskeyEmbeddedWalletEnabled(projectSettings)) &&
|
|
94
|
+
if ((isEmailWalletProviderEnabled || isTurnkeyEnabled.isTurnkeyEnabled(projectSettings)) &&
|
|
96
95
|
(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.confirmEmailProviderForVerify)) {
|
|
97
96
|
// see: https://linear.app/dynamic-labs/issue/DYN-2517
|
|
98
97
|
// if confirmWalletTransfers setting is true, check api first to confirm emailProvider
|
|
@@ -16,7 +16,7 @@ import 'viem';
|
|
|
16
16
|
import '../../../../shared/consts/index.js';
|
|
17
17
|
import { useInternalDynamicContext } from '../../../../context/DynamicContext/useInternalDynamicContext.js';
|
|
18
18
|
import '@dynamic-labs/multi-wallet';
|
|
19
|
-
import {
|
|
19
|
+
import { isTurnkeyEnabled } from '../../../../utils/functions/isTurnkeyEnabled/isTurnkeyEnabled.js';
|
|
20
20
|
import '../../../../components/ShadowDOM/ShadowDOM.js';
|
|
21
21
|
import '../../../../context/ThemeContext/ThemeContext.js';
|
|
22
22
|
import { Input } from '../../../../components/Input/Input.js';
|
|
@@ -87,8 +87,7 @@ const LoginEmailForm = ({ isLoading: isExternalLoading, onSubmit, onSubmitError,
|
|
|
87
87
|
}
|
|
88
88
|
try {
|
|
89
89
|
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit();
|
|
90
|
-
if ((isEmailWalletProviderEnabled ||
|
|
91
|
-
isPasskeyEmbeddedWalletEnabled(projectSettings)) &&
|
|
90
|
+
if ((isEmailWalletProviderEnabled || isTurnkeyEnabled(projectSettings)) &&
|
|
92
91
|
(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.confirmEmailProviderForVerify)) {
|
|
93
92
|
// see: https://linear.app/dynamic-labs/issue/DYN-2517
|
|
94
93
|
// if confirmWalletTransfers setting is true, check api first to confirm emailProvider
|
|
@@ -43,10 +43,7 @@ const WalletSimpleSignIn = ({ previewWalletsNumber, disabled = false, onshowAllW
|
|
|
43
43
|
walletsFilter,
|
|
44
44
|
});
|
|
45
45
|
const isUsingMultiWallet = Boolean(localStorage.LocalStorage.getFromLS(localStorage$1.AUTH_USER));
|
|
46
|
-
return !projectSettings ? (jsxRuntime.jsx(Skeleton.Skeleton, { count: previewWalletsNumber + 1, className: 'login-with-email-wallet-list__skeleton' })) : (jsxRuntime.jsxs("div", { className: 'login-with-email-wallet-list__container', "data-testid": 'top-wallets-list', children: [walletsList.map((wallet) => {
|
|
47
|
-
var _a;
|
|
48
|
-
return (jsxRuntime.jsx(WalletListItem.WalletListItem, { wallet: wallet, usingMultiWallet: isUsingMultiWallet, disabled: disabled }, wallet.key + ((_a = wallet.groupedWallets) === null || _a === void 0 ? void 0 : _a.length)));
|
|
49
|
-
}), jsxRuntime.jsx(ListItemButton.ListItemButton, { text: t('dyn_wallet_list.view_all'), onClick: onshowAllWallets, numberOfWallets: numberOfWallets, disabled: disabled })] }));
|
|
46
|
+
return !projectSettings ? (jsxRuntime.jsx(Skeleton.Skeleton, { count: previewWalletsNumber + 1, className: 'login-with-email-wallet-list__skeleton' })) : (jsxRuntime.jsxs("div", { className: 'login-with-email-wallet-list__container', "data-testid": 'top-wallets-list', children: [walletsList.map((wallet, index) => (jsxRuntime.jsx(WalletListItem.WalletListItem, { wallet: wallet, usingMultiWallet: isUsingMultiWallet, disabled: disabled }, `${wallet.key}_${index}`))), jsxRuntime.jsx(ListItemButton.ListItemButton, { text: t('dyn_wallet_list.view_all'), onClick: onshowAllWallets, numberOfWallets: numberOfWallets, disabled: disabled })] }));
|
|
50
47
|
};
|
|
51
48
|
|
|
52
49
|
exports.WalletSimpleSignIn = WalletSimpleSignIn;
|
|
@@ -39,10 +39,7 @@ const WalletSimpleSignIn = ({ previewWalletsNumber, disabled = false, onshowAllW
|
|
|
39
39
|
walletsFilter,
|
|
40
40
|
});
|
|
41
41
|
const isUsingMultiWallet = Boolean(LocalStorage.getFromLS(AUTH_USER));
|
|
42
|
-
return !projectSettings ? (jsx(Skeleton, { count: previewWalletsNumber + 1, className: 'login-with-email-wallet-list__skeleton' })) : (jsxs("div", { className: 'login-with-email-wallet-list__container', "data-testid": 'top-wallets-list', children: [walletsList.map((wallet) => {
|
|
43
|
-
var _a;
|
|
44
|
-
return (jsx(WalletListItem, { wallet: wallet, usingMultiWallet: isUsingMultiWallet, disabled: disabled }, wallet.key + ((_a = wallet.groupedWallets) === null || _a === void 0 ? void 0 : _a.length)));
|
|
45
|
-
}), jsx(ListItemButton, { text: t('dyn_wallet_list.view_all'), onClick: onshowAllWallets, numberOfWallets: numberOfWallets, disabled: disabled })] }));
|
|
42
|
+
return !projectSettings ? (jsx(Skeleton, { count: previewWalletsNumber + 1, className: 'login-with-email-wallet-list__skeleton' })) : (jsxs("div", { className: 'login-with-email-wallet-list__container', "data-testid": 'top-wallets-list', children: [walletsList.map((wallet, index) => (jsx(WalletListItem, { wallet: wallet, usingMultiWallet: isUsingMultiWallet, disabled: disabled }, `${wallet.key}_${index}`))), jsx(ListItemButton, { text: t('dyn_wallet_list.view_all'), onClick: onshowAllWallets, numberOfWallets: numberOfWallets, disabled: disabled })] }));
|
|
46
43
|
};
|
|
47
44
|
|
|
48
45
|
export { WalletSimpleSignIn };
|
|
@@ -21,9 +21,17 @@ require('@dynamic-labs/multi-wallet');
|
|
|
21
21
|
var isEmailProviderEnabled = require('../../utils/functions/isEmailProviderEnabled/isEmailProviderEnabled.cjs');
|
|
22
22
|
var index = require('../../utils/functions/getEnabledProviders/index.cjs');
|
|
23
23
|
|
|
24
|
+
/* eslint-disable multiline-comment-style */
|
|
24
25
|
const NUMBER_OF_WALLETS = 3;
|
|
25
26
|
const useLoginView = () => {
|
|
26
27
|
const { projectSettings, authorizationViewDisplayOrder, loginWithEmail, wallets, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
28
|
+
/** Takes from wallets only those that can be selected in the wallet list by the user.
|
|
29
|
+
* Should filter out embedded wallets
|
|
30
|
+
* WHY: when we decide whether to show wallets or not, we need to know how many wallets
|
|
31
|
+
* will actually be rendered. It would be especially bad to only have for ex "turnkey" in
|
|
32
|
+
* wallets and then display an empty wallet list (since turnkey doesn't render)
|
|
33
|
+
*/
|
|
34
|
+
const selectableWallets = wallets.filter(({ key }) => key !== 'turnkey');
|
|
27
35
|
const { t } = reactI18next.useTranslation();
|
|
28
36
|
const hasEnabledProviders = Boolean(index.getEnabledProviders(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers).length);
|
|
29
37
|
const isWalletOnly = React.useMemo(() => {
|
|
@@ -81,7 +89,7 @@ const useLoginView = () => {
|
|
|
81
89
|
* @returns
|
|
82
90
|
*/
|
|
83
91
|
const filterLoginViewSections = (sections) => {
|
|
84
|
-
if (
|
|
92
|
+
if (selectableWallets === null || selectableWallets === void 0 ? void 0 : selectableWallets.length) {
|
|
85
93
|
return sections;
|
|
86
94
|
}
|
|
87
95
|
return sections.filter((section) => section.type !== 'wallet');
|
|
@@ -90,7 +98,7 @@ const useLoginView = () => {
|
|
|
90
98
|
// if not the first index, no separator is needed
|
|
91
99
|
// if the first index but does not have wallets or providers,
|
|
92
100
|
// it'll show only one view section - no separator is needed
|
|
93
|
-
if (index !== 0 || !(
|
|
101
|
+
if (index !== 0 || !(selectableWallets === null || selectableWallets === void 0 ? void 0 : selectableWallets.length) || !hasEnabledProviders) {
|
|
94
102
|
return [];
|
|
95
103
|
}
|
|
96
104
|
return [
|
|
@@ -115,7 +123,7 @@ const useLoginView = () => {
|
|
|
115
123
|
// add separator if wallets defined
|
|
116
124
|
addSeparator(index));
|
|
117
125
|
}
|
|
118
|
-
if (loginItem === 'wallet' && (
|
|
126
|
+
if (loginItem === 'wallet' && (selectableWallets === null || selectableWallets === void 0 ? void 0 : selectableWallets.length)) {
|
|
119
127
|
// if showWalletsButton is true, it should show "Connec with Wallet" button
|
|
120
128
|
const numOfItemsToDisplay = ((_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _a === void 0 ? void 0 : _a.modal) === null || _b === void 0 ? void 0 : _b.showWalletsButton)
|
|
121
129
|
? 0
|
|
@@ -17,9 +17,17 @@ import '@dynamic-labs/multi-wallet';
|
|
|
17
17
|
import { isEmailProviderEnabled } from '../../utils/functions/isEmailProviderEnabled/isEmailProviderEnabled.js';
|
|
18
18
|
import { getEnabledProviders } from '../../utils/functions/getEnabledProviders/index.js';
|
|
19
19
|
|
|
20
|
+
/* eslint-disable multiline-comment-style */
|
|
20
21
|
const NUMBER_OF_WALLETS = 3;
|
|
21
22
|
const useLoginView = () => {
|
|
22
23
|
const { projectSettings, authorizationViewDisplayOrder, loginWithEmail, wallets, } = useInternalDynamicContext();
|
|
24
|
+
/** Takes from wallets only those that can be selected in the wallet list by the user.
|
|
25
|
+
* Should filter out embedded wallets
|
|
26
|
+
* WHY: when we decide whether to show wallets or not, we need to know how many wallets
|
|
27
|
+
* will actually be rendered. It would be especially bad to only have for ex "turnkey" in
|
|
28
|
+
* wallets and then display an empty wallet list (since turnkey doesn't render)
|
|
29
|
+
*/
|
|
30
|
+
const selectableWallets = wallets.filter(({ key }) => key !== 'turnkey');
|
|
23
31
|
const { t } = useTranslation();
|
|
24
32
|
const hasEnabledProviders = Boolean(getEnabledProviders(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers).length);
|
|
25
33
|
const isWalletOnly = useMemo(() => {
|
|
@@ -77,7 +85,7 @@ const useLoginView = () => {
|
|
|
77
85
|
* @returns
|
|
78
86
|
*/
|
|
79
87
|
const filterLoginViewSections = (sections) => {
|
|
80
|
-
if (
|
|
88
|
+
if (selectableWallets === null || selectableWallets === void 0 ? void 0 : selectableWallets.length) {
|
|
81
89
|
return sections;
|
|
82
90
|
}
|
|
83
91
|
return sections.filter((section) => section.type !== 'wallet');
|
|
@@ -86,7 +94,7 @@ const useLoginView = () => {
|
|
|
86
94
|
// if not the first index, no separator is needed
|
|
87
95
|
// if the first index but does not have wallets or providers,
|
|
88
96
|
// it'll show only one view section - no separator is needed
|
|
89
|
-
if (index !== 0 || !(
|
|
97
|
+
if (index !== 0 || !(selectableWallets === null || selectableWallets === void 0 ? void 0 : selectableWallets.length) || !hasEnabledProviders) {
|
|
90
98
|
return [];
|
|
91
99
|
}
|
|
92
100
|
return [
|
|
@@ -111,7 +119,7 @@ const useLoginView = () => {
|
|
|
111
119
|
// add separator if wallets defined
|
|
112
120
|
addSeparator(index));
|
|
113
121
|
}
|
|
114
|
-
if (loginItem === 'wallet' && (
|
|
122
|
+
if (loginItem === 'wallet' && (selectableWallets === null || selectableWallets === void 0 ? void 0 : selectableWallets.length)) {
|
|
115
123
|
// if showWalletsButton is true, it should show "Connec with Wallet" button
|
|
116
124
|
const numOfItemsToDisplay = ((_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _a === void 0 ? void 0 : _a.modal) === null || _b === void 0 ? void 0 : _b.showWalletsButton)
|
|
117
125
|
? 0
|
|
@@ -89,7 +89,7 @@ const TransactionConfirmationView = ({ transaction, mutation, onError, onSuccess
|
|
|
89
89
|
provider,
|
|
90
90
|
transaction,
|
|
91
91
|
});
|
|
92
|
-
const { data: transactionToAddress, isLoading: isTransactionToAddressLoading, } = usePromise.usePromise(() => transaction.to);
|
|
92
|
+
const { data: transactionToAddress, isLoading: isTransactionToAddressLoading, } = usePromise.usePromise(() => { var _a; return (_a = transaction.to) === null || _a === void 0 ? void 0 : _a.toString(); });
|
|
93
93
|
const { data: transactionFromAddress, isLoading: isTransactionFromAddressLoading, } = usePromise.usePromise(() => transaction.from);
|
|
94
94
|
const { data: transactionValue, isLoading: isTransactionValueLoading } = usePromise.usePromise(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
95
95
|
const val = yield transaction.value;
|
|
@@ -85,7 +85,7 @@ const TransactionConfirmationView = ({ transaction, mutation, onError, onSuccess
|
|
|
85
85
|
provider,
|
|
86
86
|
transaction,
|
|
87
87
|
});
|
|
88
|
-
const { data: transactionToAddress, isLoading: isTransactionToAddressLoading, } = usePromise(() => transaction.to);
|
|
88
|
+
const { data: transactionToAddress, isLoading: isTransactionToAddressLoading, } = usePromise(() => { var _a; return (_a = transaction.to) === null || _a === void 0 ? void 0 : _a.toString(); });
|
|
89
89
|
const { data: transactionFromAddress, isLoading: isTransactionFromAddressLoading, } = usePromise(() => transaction.from);
|
|
90
90
|
const { data: transactionValue, isLoading: isTransactionValueLoading } = usePromise(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
91
91
|
const val = yield transaction.value;
|
|
@@ -15,7 +15,7 @@ const WalletGroupView = () => {
|
|
|
15
15
|
if (!selectedWalletGroup)
|
|
16
16
|
throw new Error('Could not access WalletGroup view without selected group');
|
|
17
17
|
const walletBookData = walletBook.getWalletGroup(walletBook$1, selectedWalletGroup === null || selectedWalletGroup === void 0 ? void 0 : selectedWalletGroup.key);
|
|
18
|
-
return (jsxRuntime.jsx(SelectWalletChainLayout.SelectWalletChainLayout, { HeaderIcon: jsxRuntime.jsx(walletBook.WalletIcon, { walletKey: (_a = walletBookData.brand) === null || _a === void 0 ? void 0 : _a.spriteId }), children: selectedWalletGroup.groupedWallets.map((wallet) => (jsxRuntime.jsx(WalletGroupItem.WalletGroupItem, { wallet: wallet }, wallet.key))) }));
|
|
18
|
+
return (jsxRuntime.jsx(SelectWalletChainLayout.SelectWalletChainLayout, { HeaderIcon: jsxRuntime.jsx(walletBook.WalletIcon, { walletKey: (_a = walletBookData.brand) === null || _a === void 0 ? void 0 : _a.spriteId }), children: selectedWalletGroup.groupedWallets.map((wallet, index) => (jsxRuntime.jsx(WalletGroupItem.WalletGroupItem, { wallet: wallet }, `${wallet.key}_${index}`))) }));
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
exports.WalletGroupView = WalletGroupView;
|
|
@@ -11,7 +11,7 @@ const WalletGroupView = () => {
|
|
|
11
11
|
if (!selectedWalletGroup)
|
|
12
12
|
throw new Error('Could not access WalletGroup view without selected group');
|
|
13
13
|
const walletBookData = getWalletGroup(walletBook, selectedWalletGroup === null || selectedWalletGroup === void 0 ? void 0 : selectedWalletGroup.key);
|
|
14
|
-
return (jsx(SelectWalletChainLayout, { HeaderIcon: jsx(WalletIcon, { walletKey: (_a = walletBookData.brand) === null || _a === void 0 ? void 0 : _a.spriteId }), children: selectedWalletGroup.groupedWallets.map((wallet) => (jsx(WalletGroupItem, { wallet: wallet }, wallet.key))) }));
|
|
14
|
+
return (jsx(SelectWalletChainLayout, { HeaderIcon: jsx(WalletIcon, { walletKey: (_a = walletBookData.brand) === null || _a === void 0 ? void 0 : _a.spriteId }), children: selectedWalletGroup.groupedWallets.map((wallet, index) => (jsx(WalletGroupItem, { wallet: wallet }, `${wallet.key}_${index}`))) }));
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
export { WalletGroupView };
|
|
@@ -80,7 +80,7 @@ const WalletList = ({ isWalletConnectList = false, }) => {
|
|
|
80
80
|
};
|
|
81
81
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: 'wallet-list__container', children: [error && jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: error }), !projectSettings ? (jsxRuntime.jsx(Skeleton.Skeleton, { className: 'wallet-list__search-skeleton' })) : (isSearchEnabled && (jsxRuntime.jsx(Search.Search, { label: `Search through ${numberOfWallets} wallets...`, value: filterValue, onChange: ({ target: { value } }) => handleFilterValueChange(value), onClickClear: () => handleFilterValueChange('') }))), jsxRuntime.jsxs("div", { className: classNames.classNames('wallet-list__scroll-container', {
|
|
82
82
|
'wallet-list__scroll-container--full-height': isSearchEnabled,
|
|
83
|
-
}), "data-testid": 'wallet-list-scroll-container', ref: walletListScrollRef, onScroll: handleScroll, children: [!projectSettings ? (jsxRuntime.jsx(Skeleton.Skeleton, { count: 10, className: 'wallet-list__tile-skeleton' })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [wallets.length === 0 && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: "Oops, no login methods have been configured." })), wallets.length && walletsList.length === 0 ? (jsxRuntime.jsx(SearchNotFoundMessage.SearchNotFoundMessage, { title: 'No wallet found.', subtitle: 'Try searching for a different wallet', image: jsxRuntime.jsx(noWalletFound.ReactComponent, {}) })) : (walletsList.map((wallet) => (jsxRuntime.jsx(WalletListItem.WalletListItem, { wallet: wallet, usingMultiWallet: multiWallet, onResetSearchValue: () => handleFilterValueChange('') }, wallet.key))))] })), isSearchEnabled && !filterValue && projectSettings && (jsxRuntime.jsx(SearchNotFoundMessage.SearchNotFoundMessage, {}))] })] }), noDefaultFooter && (jsxRuntime.jsx("div", { className: classNames.classNames('wallet-list__tiny-footer', {
|
|
83
|
+
}), "data-testid": 'wallet-list-scroll-container', ref: walletListScrollRef, onScroll: handleScroll, children: [!projectSettings ? (jsxRuntime.jsx(Skeleton.Skeleton, { count: 10, className: 'wallet-list__tile-skeleton' })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [wallets.length === 0 && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: "Oops, no login methods have been configured." })), wallets.length && walletsList.length === 0 ? (jsxRuntime.jsx(SearchNotFoundMessage.SearchNotFoundMessage, { title: 'No wallet found.', subtitle: 'Try searching for a different wallet', image: jsxRuntime.jsx(noWalletFound.ReactComponent, {}) })) : (walletsList.map((wallet, index) => (jsxRuntime.jsx(WalletListItem.WalletListItem, { wallet: wallet, usingMultiWallet: multiWallet, onResetSearchValue: () => handleFilterValueChange('') }, `${wallet.key}_${index}`))))] })), isSearchEnabled && !filterValue && projectSettings && (jsxRuntime.jsx(SearchNotFoundMessage.SearchNotFoundMessage, {}))] })] }), noDefaultFooter && (jsxRuntime.jsx("div", { className: classNames.classNames('wallet-list__tiny-footer', {
|
|
84
84
|
'wallet-list__tiny-footer--hidden': footerIsVisible,
|
|
85
85
|
}), "data-testid": 'wallet-list-tiny-footer' }))] }));
|
|
86
86
|
};
|