@dynamic-labs/sdk-react-core 4.40.0 → 4.40.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +12 -12
  5. package/src/lib/components/SendBalanceForm/SendBalanceForm.cjs +1 -2
  6. package/src/lib/components/SendBalanceForm/SendBalanceForm.js +1 -2
  7. package/src/lib/components/SendBalancePageLayout/components/TokensBalanceDropdown/TokensBalanceDropdown.cjs +5 -2
  8. package/src/lib/components/SendBalancePageLayout/components/TokensBalanceDropdown/TokensBalanceDropdown.js +5 -2
  9. package/src/lib/context/DynamicContext/hooks/useHandleLogout/types.d.ts +2 -1
  10. package/src/lib/context/DynamicContext/hooks/useSelectedWalletConnector/SetSelectedWalletConnectorKey.type.d.ts +5 -0
  11. package/src/lib/context/DynamicContext/hooks/useSelectedWalletConnector/useSelectedWalletConnector.cjs +19 -5
  12. package/src/lib/context/DynamicContext/hooks/useSelectedWalletConnector/useSelectedWalletConnector.d.ts +3 -3
  13. package/src/lib/context/DynamicContext/hooks/useSelectedWalletConnector/useSelectedWalletConnector.js +19 -5
  14. package/src/lib/context/DynamicContext/types/IDynamicContext.d.ts +2 -1
  15. package/src/lib/styles/index.shadow.cjs +1 -1
  16. package/src/lib/styles/index.shadow.js +1 -1
  17. package/src/lib/utils/functions/findWalletOptionFor/findWalletOptionFor.cjs +8 -3
  18. package/src/lib/utils/functions/findWalletOptionFor/findWalletOptionFor.js +8 -3
  19. package/src/lib/utils/functions/walletListBuilder/utils/groupWalletOptions/groupWalletOptions.cjs +4 -1
  20. package/src/lib/utils/functions/walletListBuilder/utils/groupWalletOptions/groupWalletOptions.js +4 -1
  21. package/src/lib/utils/functions/walletListBuilder/walletListBuilder.cjs +14 -7
  22. package/src/lib/utils/functions/walletListBuilder/walletListBuilder.js +14 -7
  23. package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.cjs +4 -1
  24. package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.js +4 -1
  25. package/src/lib/utils/hooks/useConnectedWalletsNetworkValidation/useConnectedWalletsNetworkValidation.cjs +4 -1
  26. package/src/lib/utils/hooks/useConnectedWalletsNetworkValidation/useConnectedWalletsNetworkValidation.js +4 -1
  27. package/src/lib/utils/hooks/useSyncOnboardingFlow/useSyncOnboardingFlow.cjs +7 -2
  28. package/src/lib/utils/hooks/useSyncOnboardingFlow/useSyncOnboardingFlow.js +7 -2
  29. package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +8 -2
  30. package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +8 -2
  31. package/src/lib/utils/hooks/useWalletItemActions/useHandleWalletItem/useHandleWalletItem.cjs +24 -6
  32. package/src/lib/utils/hooks/useWalletItemActions/useHandleWalletItem/useHandleWalletItem.js +24 -6
  33. package/src/lib/views/LoginView/sections/EmailSignInSection/LoginEmailForm.cjs +7 -3
  34. package/src/lib/views/LoginView/sections/EmailSignInSection/LoginEmailForm.js +7 -3
  35. package/src/lib/views/LoginView/sections/PhoneNumberSignInSection/PhoneNumberSignInSection.cjs +6 -2
  36. package/src/lib/views/LoginView/sections/PhoneNumberSignInSection/PhoneNumberSignInSection.js +6 -2
  37. package/src/lib/views/LoginView/sections/SocialSignInSection/SocialSignInSection.cjs +17 -85
  38. package/src/lib/views/LoginView/sections/SocialSignInSection/SocialSignInSection.js +17 -85
  39. package/src/lib/views/LoginView/useLoginView/useLoginView.cjs +11 -7
  40. package/src/lib/views/LoginView/useLoginView/useLoginView.js +11 -7
  41. package/src/lib/views/WalletDelegation/WalletDelegationView/WalletDelegationView.cjs +6 -6
  42. package/src/lib/views/WalletDelegation/WalletDelegationView/WalletDelegationView.js +6 -6
  43. package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/TokenBalanceItem/TokenBalanceItem.cjs +1 -8
  44. package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/TokenBalanceItem/TokenBalanceItem.js +1 -8
  45. package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.cjs +4 -1
  46. package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.js +4 -1
@@ -7,7 +7,7 @@ var values = require('../../constants/values.cjs');
7
7
  var compareChains = require('../compareChains/compareChains.cjs');
8
8
 
9
9
  const findWalletOptionFor = (account, walletOptions) => {
10
- const { walletName } = account;
10
+ const { walletName, chain } = account;
11
11
  if (walletName === 'turnkeyhd' || walletName === 'dynamicwaas') {
12
12
  const chain = account.chain
13
13
  ? values.VerifiedCredentialNameToChainEnum[account.chain]
@@ -19,14 +19,19 @@ const findWalletOptionFor = (account, walletOptions) => {
19
19
  // set to "unknown" if not found in wallet book. We need to use fallback connector for these wallets.
20
20
  // The "unknown" wallet connector is also legacy and should never be used.
21
21
  if (walletName !== 'unknown') {
22
- const wallet = walletOptions.find((wallet) => wallet.key === walletName);
22
+ // The verified credential chain follows a different format than the wallet connector chain
23
+ // so we need first convert
24
+ const walletChain = chain
25
+ ? values.VerifiedCredentialNameToChainEnum[chain]
26
+ : undefined;
27
+ const wallet = walletOptions.find((wallet) => wallet.key === walletName &&
28
+ (!walletChain || wallet.walletConnector.connectedChain === walletChain));
23
29
  if (wallet)
24
30
  return wallet;
25
31
  }
26
32
  // If we cannot find the correct connector for the wallet, we default to the fallback
27
33
  // this way the wallet will appear in user wallets, but will not be able to be interacted with
28
34
  const fallbackOptions = walletOptions.filter((wallet) => wallet.key === 'fallbackconnector');
29
- const { chain } = account;
30
35
  if (chain) {
31
36
  const unknownWallet = fallbackOptions.find(({ walletConnector }) => compareChains.compareChains(walletConnector.connectedChain, chain));
32
37
  if (unknownWallet)
@@ -3,7 +3,7 @@ import { VerifiedCredentialNameToChainEnum } from '../../constants/values.js';
3
3
  import { compareChains } from '../compareChains/compareChains.js';
4
4
 
5
5
  const findWalletOptionFor = (account, walletOptions) => {
6
- const { walletName } = account;
6
+ const { walletName, chain } = account;
7
7
  if (walletName === 'turnkeyhd' || walletName === 'dynamicwaas') {
8
8
  const chain = account.chain
9
9
  ? VerifiedCredentialNameToChainEnum[account.chain]
@@ -15,14 +15,19 @@ const findWalletOptionFor = (account, walletOptions) => {
15
15
  // set to "unknown" if not found in wallet book. We need to use fallback connector for these wallets.
16
16
  // The "unknown" wallet connector is also legacy and should never be used.
17
17
  if (walletName !== 'unknown') {
18
- const wallet = walletOptions.find((wallet) => wallet.key === walletName);
18
+ // The verified credential chain follows a different format than the wallet connector chain
19
+ // so we need first convert
20
+ const walletChain = chain
21
+ ? VerifiedCredentialNameToChainEnum[chain]
22
+ : undefined;
23
+ const wallet = walletOptions.find((wallet) => wallet.key === walletName &&
24
+ (!walletChain || wallet.walletConnector.connectedChain === walletChain));
19
25
  if (wallet)
20
26
  return wallet;
21
27
  }
22
28
  // If we cannot find the correct connector for the wallet, we default to the fallback
23
29
  // this way the wallet will appear in user wallets, but will not be able to be interacted with
24
30
  const fallbackOptions = walletOptions.filter((wallet) => wallet.key === 'fallbackconnector');
25
- const { chain } = account;
26
31
  if (chain) {
27
32
  const unknownWallet = fallbackOptions.find(({ walletConnector }) => compareChains(walletConnector.connectedChain, chain));
28
33
  if (unknownWallet)
@@ -28,7 +28,10 @@ const groupWalletOptions = (walletGroups, walletOptionList) => {
28
28
  // Validate if there is any other wallet with the same group
29
29
  const isThereWalletOptionWithSameGroup = walletOptionList.some((walletOption) => {
30
30
  const isSameGroup = currentWalletOption.group === walletOption.group;
31
- const isDifferentKey = currentWalletOption.key !== walletOption.key;
31
+ // Some WC wallets may have the same key on different chains, so we need to check that chain as well
32
+ const isDifferentKey = currentWalletOption.key !== walletOption.key ||
33
+ currentWalletOption.walletConnector.connectedChain !==
34
+ walletOption.walletConnector.connectedChain;
32
35
  return isSameGroup && isDifferentKey;
33
36
  });
34
37
  // Avoid group creation if there only one wallet in group
@@ -24,7 +24,10 @@ const groupWalletOptions = (walletGroups, walletOptionList) => {
24
24
  // Validate if there is any other wallet with the same group
25
25
  const isThereWalletOptionWithSameGroup = walletOptionList.some((walletOption) => {
26
26
  const isSameGroup = currentWalletOption.group === walletOption.group;
27
- const isDifferentKey = currentWalletOption.key !== walletOption.key;
27
+ // Some WC wallets may have the same key on different chains, so we need to check that chain as well
28
+ const isDifferentKey = currentWalletOption.key !== walletOption.key ||
29
+ currentWalletOption.walletConnector.connectedChain !==
30
+ walletOption.walletConnector.connectedChain;
28
31
  return isSameGroup && isDifferentKey;
29
32
  });
30
33
  // Avoid group creation if there only one wallet in group
@@ -69,8 +69,11 @@ const walletListBuilder = ({ userWallets, multiWallet, numberOfWalletsToShow, in
69
69
  walletOptions: walletList,
70
70
  });
71
71
  }
72
- let lastUsedWallet;
73
72
  const hasWalletFilter = Boolean(walletsFilter);
73
+ // This is an array because we might have multiple options with the same key
74
+ // this happens on WC wallets for different chains, because the WC wallet book entries for all chains
75
+ // is always in the EVM entry (for historical reasons) and therefore they all share the same EVM entry's key
76
+ const lastUsedWallets = [];
74
77
  const recommendedWalletsList = [];
75
78
  const installedWallets = [];
76
79
  const otherWallets = [];
@@ -78,13 +81,14 @@ const walletListBuilder = ({ userWallets, multiWallet, numberOfWalletsToShow, in
78
81
  const orderedInputList = orderAndFilterList(walletList, walletsFilter, isWalletConnectList, recommendedWalletKeys);
79
82
  orderedInputList.forEach((wallet) => {
80
83
  if (walletConnectorCore.isEmbeddedConnector(wallet.walletConnector) ||
81
- !wallet.walletConnector.isAvailable)
84
+ !wallet.walletConnector.isAvailable) {
82
85
  return;
86
+ }
83
87
  if (recommendedWalletKeys === null || recommendedWalletKeys === void 0 ? void 0 : recommendedWalletKeys.includes(wallet.key)) {
84
88
  recommendedWalletsList.push(wallet);
85
89
  }
86
90
  else if (lastUsedWalletKey === wallet.key) {
87
- lastUsedWallet = wallet;
91
+ lastUsedWallets.push(wallet);
88
92
  }
89
93
  else if (wallet.isInstalledOnBrowser) {
90
94
  installedWallets.push(wallet);
@@ -93,10 +97,9 @@ const walletListBuilder = ({ userWallets, multiWallet, numberOfWalletsToShow, in
93
97
  otherWallets.push(wallet);
94
98
  }
95
99
  });
96
- const firstPriorityWallets = [...(lastUsedWallet ? [lastUsedWallet] : [])];
97
100
  const initialWalletsList = [
98
101
  ...recommendedWalletsList,
99
- ...firstPriorityWallets,
102
+ ...lastUsedWallets,
100
103
  ...installedWallets,
101
104
  ...otherWallets,
102
105
  ];
@@ -106,7 +109,7 @@ const walletListBuilder = ({ userWallets, multiWallet, numberOfWalletsToShow, in
106
109
  // If a filter has been applied we want to add an offset to the number of wallets
107
110
  // to include the installed and last used wallets
108
111
  const updatedNumberOfWalletsToShow = showMoreWalletsWithFilter && hasWalletFilter
109
- ? calculateWalletOffsetBasedOnInstalledAndLastUsedWallets(orderedInputList, firstPriorityWallets.concat(installedWallets), numberOfWalletsToShow)
112
+ ? calculateWalletOffsetBasedOnInstalledAndLastUsedWallets(orderedInputList, lastUsedWallets.concat(installedWallets), numberOfWalletsToShow)
110
113
  : numberOfWalletsToShow;
111
114
  const walletsList = listToDisplay(finalizedWalletList, searchFilter, isWalletConnectList, updatedNumberOfWalletsToShow, hasWalletFilter, loginWithEmail);
112
115
  return {
@@ -125,7 +128,11 @@ const orderAndFilterList = (walletList, walletsFilter, isWalletConnectList, reco
125
128
  return sortedWalletList;
126
129
  }
127
130
  };
128
- const KEEP_WALLETS_NAME_LIST = ['walletconnect', 'bitcoin.com wallet'];
131
+ const KEEP_WALLETS_NAME_LIST = [
132
+ 'walletconnect',
133
+ 'walletconnect sol',
134
+ 'bitcoin.com wallet',
135
+ ];
129
136
  const applySearchFilterToWalletOptionList = (rawSearchFilter, walletOptionList) => {
130
137
  const searchFilter = rawSearchFilter.trim().toLowerCase();
131
138
  const cleanName = (name) => {
@@ -65,8 +65,11 @@ const walletListBuilder = ({ userWallets, multiWallet, numberOfWalletsToShow, in
65
65
  walletOptions: walletList,
66
66
  });
67
67
  }
68
- let lastUsedWallet;
69
68
  const hasWalletFilter = Boolean(walletsFilter);
69
+ // This is an array because we might have multiple options with the same key
70
+ // this happens on WC wallets for different chains, because the WC wallet book entries for all chains
71
+ // is always in the EVM entry (for historical reasons) and therefore they all share the same EVM entry's key
72
+ const lastUsedWallets = [];
70
73
  const recommendedWalletsList = [];
71
74
  const installedWallets = [];
72
75
  const otherWallets = [];
@@ -74,13 +77,14 @@ const walletListBuilder = ({ userWallets, multiWallet, numberOfWalletsToShow, in
74
77
  const orderedInputList = orderAndFilterList(walletList, walletsFilter, isWalletConnectList, recommendedWalletKeys);
75
78
  orderedInputList.forEach((wallet) => {
76
79
  if (isEmbeddedConnector(wallet.walletConnector) ||
77
- !wallet.walletConnector.isAvailable)
80
+ !wallet.walletConnector.isAvailable) {
78
81
  return;
82
+ }
79
83
  if (recommendedWalletKeys === null || recommendedWalletKeys === void 0 ? void 0 : recommendedWalletKeys.includes(wallet.key)) {
80
84
  recommendedWalletsList.push(wallet);
81
85
  }
82
86
  else if (lastUsedWalletKey === wallet.key) {
83
- lastUsedWallet = wallet;
87
+ lastUsedWallets.push(wallet);
84
88
  }
85
89
  else if (wallet.isInstalledOnBrowser) {
86
90
  installedWallets.push(wallet);
@@ -89,10 +93,9 @@ const walletListBuilder = ({ userWallets, multiWallet, numberOfWalletsToShow, in
89
93
  otherWallets.push(wallet);
90
94
  }
91
95
  });
92
- const firstPriorityWallets = [...(lastUsedWallet ? [lastUsedWallet] : [])];
93
96
  const initialWalletsList = [
94
97
  ...recommendedWalletsList,
95
- ...firstPriorityWallets,
98
+ ...lastUsedWallets,
96
99
  ...installedWallets,
97
100
  ...otherWallets,
98
101
  ];
@@ -102,7 +105,7 @@ const walletListBuilder = ({ userWallets, multiWallet, numberOfWalletsToShow, in
102
105
  // If a filter has been applied we want to add an offset to the number of wallets
103
106
  // to include the installed and last used wallets
104
107
  const updatedNumberOfWalletsToShow = showMoreWalletsWithFilter && hasWalletFilter
105
- ? calculateWalletOffsetBasedOnInstalledAndLastUsedWallets(orderedInputList, firstPriorityWallets.concat(installedWallets), numberOfWalletsToShow)
108
+ ? calculateWalletOffsetBasedOnInstalledAndLastUsedWallets(orderedInputList, lastUsedWallets.concat(installedWallets), numberOfWalletsToShow)
106
109
  : numberOfWalletsToShow;
107
110
  const walletsList = listToDisplay(finalizedWalletList, searchFilter, isWalletConnectList, updatedNumberOfWalletsToShow, hasWalletFilter, loginWithEmail);
108
111
  return {
@@ -121,7 +124,11 @@ const orderAndFilterList = (walletList, walletsFilter, isWalletConnectList, reco
121
124
  return sortedWalletList;
122
125
  }
123
126
  };
124
- const KEEP_WALLETS_NAME_LIST = ['walletconnect', 'bitcoin.com wallet'];
127
+ const KEEP_WALLETS_NAME_LIST = [
128
+ 'walletconnect',
129
+ 'walletconnect sol',
130
+ 'bitcoin.com wallet',
131
+ ];
125
132
  const applySearchFilterToWalletOptionList = (rawSearchFilter, walletOptionList) => {
126
133
  const searchFilter = rawSearchFilter.trim().toLowerCase();
127
134
  const cleanName = (name) => {
@@ -124,7 +124,10 @@ const useSignConnectOnlyUser = () => {
124
124
  // We need this because in connect-only we don't want to show wallet-list
125
125
  // We don't want to show the back button in the pending signature view
126
126
  // because we don't want to go back to the wallet-list
127
- setSelectedWalletConnectorKey(walletConnector.key);
127
+ setSelectedWalletConnectorKey({
128
+ chain: walletConnector.connectedChain,
129
+ key: walletConnector.key,
130
+ });
128
131
  pushView('pending-signature-without-back-button');
129
132
  setShowAuthFlow(true);
130
133
  // Wallet should be already connected at this point
@@ -120,7 +120,10 @@ const useSignConnectOnlyUser = () => {
120
120
  // We need this because in connect-only we don't want to show wallet-list
121
121
  // We don't want to show the back button in the pending signature view
122
122
  // because we don't want to go back to the wallet-list
123
- setSelectedWalletConnectorKey(walletConnector.key);
123
+ setSelectedWalletConnectorKey({
124
+ chain: walletConnector.connectedChain,
125
+ key: walletConnector.key,
126
+ });
124
127
  pushView('pending-signature-without-back-button');
125
128
  setShowAuthFlow(true);
126
129
  // Wallet should be already connected at this point
@@ -137,7 +137,10 @@ const useConnectedWalletsNetworkValidation = () => {
137
137
  // This is required because NetworkNotSupported uses walletConnector to display wallet icon, address etc.
138
138
  if (connectedWalletWithInvalidNetwork.connector.key !==
139
139
  (selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.key)) {
140
- setSelectedWalletConnectorKey(connectedWalletWithInvalidNetwork.connector.key);
140
+ setSelectedWalletConnectorKey({
141
+ chain: connectedWalletWithInvalidNetwork.connector.connectedChain,
142
+ key: connectedWalletWithInvalidNetwork.connector.key,
143
+ });
141
144
  }
142
145
  const networkNotSupportedView = isProgrammableNetworkSwitchSupported.isProgrammableNetworkSwitchSupported(connectedWalletWithInvalidNetwork.connector)
143
146
  ? 'network-not-supported'
@@ -133,7 +133,10 @@ const useConnectedWalletsNetworkValidation = () => {
133
133
  // This is required because NetworkNotSupported uses walletConnector to display wallet icon, address etc.
134
134
  if (connectedWalletWithInvalidNetwork.connector.key !==
135
135
  (selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.key)) {
136
- setSelectedWalletConnectorKey(connectedWalletWithInvalidNetwork.connector.key);
136
+ setSelectedWalletConnectorKey({
137
+ chain: connectedWalletWithInvalidNetwork.connector.connectedChain,
138
+ key: connectedWalletWithInvalidNetwork.connector.key,
139
+ });
137
140
  }
138
141
  const networkNotSupportedView = isProgrammableNetworkSwitchSupported(connectedWalletWithInvalidNetwork.connector)
139
142
  ? 'network-not-supported'
@@ -17,7 +17,7 @@ var logger = require('../../../shared/logger.cjs');
17
17
  require('@dynamic-labs/wallet-book');
18
18
  require('@dynamic-labs/utils');
19
19
  require('../../constants/colors.cjs');
20
- require('../../constants/values.cjs');
20
+ var values = require('../../constants/values.cjs');
21
21
  var hasPendingMfaAction = require('../../../shared/utils/functions/hasPendingMfaAction/hasPendingMfaAction.cjs');
22
22
  require('../../../shared/consts/index.cjs');
23
23
  require('../../../context/CaptchaContext/CaptchaContext.cjs');
@@ -162,7 +162,12 @@ const useSyncOnboardingFlow = ({ handler: headlessHandler, } = {}) => {
162
162
  setShowAuthFlow(true);
163
163
  const lastVerifiedCredential = userWithMissingInfo === null || userWithMissingInfo === void 0 ? void 0 : userWithMissingInfo.verifiedCredentials.find((vc) => vc.id === (userWithMissingInfo === null || userWithMissingInfo === void 0 ? void 0 : userWithMissingInfo.lastVerifiedCredentialId));
164
164
  if (lastVerifiedCredential === null || lastVerifiedCredential === void 0 ? void 0 : lastVerifiedCredential.walletName) {
165
- setSelectedWalletConnectorKey(lastVerifiedCredential === null || lastVerifiedCredential === void 0 ? void 0 : lastVerifiedCredential.walletName);
165
+ setSelectedWalletConnectorKey({
166
+ chain: (lastVerifiedCredential === null || lastVerifiedCredential === void 0 ? void 0 : lastVerifiedCredential.chain)
167
+ ? values.VerifiedCredentialNameToChainEnum[lastVerifiedCredential.chain]
168
+ : undefined,
169
+ key: lastVerifiedCredential === null || lastVerifiedCredential === void 0 ? void 0 : lastVerifiedCredential.walletName,
170
+ });
166
171
  }
167
172
  switch (lastVerifiedCredential === null || lastVerifiedCredential === void 0 ? void 0 : lastVerifiedCredential.format) {
168
173
  case sdkApiCore.JwtVerifiedCredentialFormatEnum.Email:
@@ -13,7 +13,7 @@ import { logger } from '../../../shared/logger.js';
13
13
  import '@dynamic-labs/wallet-book';
14
14
  import '@dynamic-labs/utils';
15
15
  import '../../constants/colors.js';
16
- import '../../constants/values.js';
16
+ import { VerifiedCredentialNameToChainEnum } from '../../constants/values.js';
17
17
  import { hasPendingMfaAction } from '../../../shared/utils/functions/hasPendingMfaAction/hasPendingMfaAction.js';
18
18
  import '../../../shared/consts/index.js';
19
19
  import '../../../context/CaptchaContext/CaptchaContext.js';
@@ -158,7 +158,12 @@ const useSyncOnboardingFlow = ({ handler: headlessHandler, } = {}) => {
158
158
  setShowAuthFlow(true);
159
159
  const lastVerifiedCredential = userWithMissingInfo === null || userWithMissingInfo === void 0 ? void 0 : userWithMissingInfo.verifiedCredentials.find((vc) => vc.id === (userWithMissingInfo === null || userWithMissingInfo === void 0 ? void 0 : userWithMissingInfo.lastVerifiedCredentialId));
160
160
  if (lastVerifiedCredential === null || lastVerifiedCredential === void 0 ? void 0 : lastVerifiedCredential.walletName) {
161
- setSelectedWalletConnectorKey(lastVerifiedCredential === null || lastVerifiedCredential === void 0 ? void 0 : lastVerifiedCredential.walletName);
161
+ setSelectedWalletConnectorKey({
162
+ chain: (lastVerifiedCredential === null || lastVerifiedCredential === void 0 ? void 0 : lastVerifiedCredential.chain)
163
+ ? VerifiedCredentialNameToChainEnum[lastVerifiedCredential.chain]
164
+ : undefined,
165
+ key: lastVerifiedCredential === null || lastVerifiedCredential === void 0 ? void 0 : lastVerifiedCredential.walletName,
166
+ });
162
167
  }
163
168
  switch (lastVerifiedCredential === null || lastVerifiedCredential === void 0 ? void 0 : lastVerifiedCredential.format) {
164
169
  case JwtVerifiedCredentialFormatEnum.Email:
@@ -45,7 +45,10 @@ const useWalletEventListeners = ({ disconnectWallet, handleLogOut, multiWallet,
45
45
  if (!linkedSecondaryWallet) {
46
46
  setMultiWalletWidgetState('awaiting_signature', undefined, 'linking_new_wallet');
47
47
  if (isPrimaryWallet && primaryWallet) {
48
- setSelectedWalletConnectorKey(primaryWallet.connector.key);
48
+ setSelectedWalletConnectorKey({
49
+ chain: primaryWallet.connector.connectedChain,
50
+ key: primaryWallet.connector.key,
51
+ });
49
52
  }
50
53
  return;
51
54
  }
@@ -105,7 +108,10 @@ const useWalletEventListeners = ({ disconnectWallet, handleLogOut, multiWallet,
105
108
  }
106
109
  if (user && detectNewWalletsForLinking) {
107
110
  setMultiWalletWidgetState('detected_new_wallet');
108
- setSelectedWalletConnectorKey(primaryWallet.connector.key);
111
+ setSelectedWalletConnectorKey({
112
+ chain: primaryWallet.connector.connectedChain,
113
+ key: primaryWallet.connector.key,
114
+ });
109
115
  }
110
116
  }, [
111
117
  detectNewWalletsForLinking,
@@ -41,7 +41,10 @@ const useWalletEventListeners = ({ disconnectWallet, handleLogOut, multiWallet,
41
41
  if (!linkedSecondaryWallet) {
42
42
  setMultiWalletWidgetState('awaiting_signature', undefined, 'linking_new_wallet');
43
43
  if (isPrimaryWallet && primaryWallet) {
44
- setSelectedWalletConnectorKey(primaryWallet.connector.key);
44
+ setSelectedWalletConnectorKey({
45
+ chain: primaryWallet.connector.connectedChain,
46
+ key: primaryWallet.connector.key,
47
+ });
45
48
  }
46
49
  return;
47
50
  }
@@ -101,7 +104,10 @@ const useWalletEventListeners = ({ disconnectWallet, handleLogOut, multiWallet,
101
104
  }
102
105
  if (user && detectNewWalletsForLinking) {
103
106
  setMultiWalletWidgetState('detected_new_wallet');
104
- setSelectedWalletConnectorKey(primaryWallet.connector.key);
107
+ setSelectedWalletConnectorKey({
108
+ chain: primaryWallet.connector.connectedChain,
109
+ key: primaryWallet.connector.key,
110
+ });
105
111
  }
106
112
  }, [
107
113
  detectNewWalletsForLinking,
@@ -116,7 +116,10 @@ const useHandleWalletItem = ({ allowAlreadyConnectedWallet, onQrCodeConnect, onC
116
116
  logger.logger.logVerboseTroubleshootingMessage('[handleCustodialWalletClick]', {
117
117
  twoStepAuthentication,
118
118
  });
119
- setSelectedWalletConnectorKey(walletConnector.key);
119
+ setSelectedWalletConnectorKey({
120
+ chain: walletConnector.connectedChain,
121
+ key: walletConnector.key,
122
+ });
120
123
  return onCustodialWallet({
121
124
  requiresTwoStepAuthentication: twoStepAuthentication,
122
125
  walletConnector,
@@ -125,7 +128,10 @@ const useHandleWalletItem = ({ allowAlreadyConnectedWallet, onQrCodeConnect, onC
125
128
  const handleMobileWalletClick = (walletConnector) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
126
129
  var _a;
127
130
  logger.logger.debug('handleMobileWalletClick', walletConnector);
128
- setSelectedWalletConnectorKey(walletConnector.key);
131
+ setSelectedWalletConnectorKey({
132
+ chain: walletConnector.connectedChain,
133
+ key: walletConnector.key,
134
+ });
129
135
  // We need to set to LS when about to verify phantom wallet on mobile
130
136
  // because the deeplink interrupts this code execution and then redirects back on a new tab.
131
137
  // This resets all state (except for LS obviously). When we receive the phantom signature in this new tab,
@@ -153,12 +159,18 @@ const useHandleWalletItem = ({ allowAlreadyConnectedWallet, onQrCodeConnect, onC
153
159
  });
154
160
  const handleInstalledExtensionClick = (walletConnector) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
155
161
  logger.logger.debug('handleInstalledExtensionClick', walletConnector);
156
- setSelectedWalletConnectorKey(walletConnector.key);
162
+ setSelectedWalletConnectorKey({
163
+ chain: walletConnector.connectedChain,
164
+ key: walletConnector.key,
165
+ });
157
166
  return onInstalledExtension({ walletConnector });
158
167
  });
159
168
  const handleUninstalledClick = (walletConnector) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
160
169
  logger.logger.debug('handleUninstalledClick', walletConnector);
161
- setSelectedWalletConnectorKey(walletConnector.key);
170
+ setSelectedWalletConnectorKey({
171
+ chain: walletConnector.connectedChain,
172
+ key: walletConnector.key,
173
+ });
162
174
  if (!walletConnector.canConnectViaQrCode) {
163
175
  replaceView('no-qr-not-installed');
164
176
  }
@@ -191,7 +203,10 @@ const useHandleWalletItem = ({ allowAlreadyConnectedWallet, onQrCodeConnect, onC
191
203
  linkedWallets,
192
204
  walletConnectorKey: walletConnector.key,
193
205
  });
194
- setSelectedWalletConnectorKey(walletConnector.key);
206
+ setSelectedWalletConnectorKey({
207
+ chain: walletConnector.connectedChain,
208
+ key: walletConnector.key,
209
+ });
195
210
  if (!activeAccountAlreadyLinked) {
196
211
  setMultiWalletWidgetState('awaiting_signature', undefined, 'linking_new_wallet');
197
212
  return;
@@ -246,7 +261,10 @@ const useHandleWalletItem = ({ allowAlreadyConnectedWallet, onQrCodeConnect, onC
246
261
  // also this is only a feature in MM
247
262
  if (authMode$1 !== 'connect-only' && isMetamask) {
248
263
  try {
249
- setSelectedWalletConnectorKey(walletConnector.key);
264
+ setSelectedWalletConnectorKey({
265
+ chain: walletConnector.connectedChain,
266
+ key: walletConnector.key,
267
+ });
250
268
  pushView('pending-connect');
251
269
  yield walletConnector.chooseAccountsToConnect();
252
270
  }
@@ -112,7 +112,10 @@ const useHandleWalletItem = ({ allowAlreadyConnectedWallet, onQrCodeConnect, onC
112
112
  logger.logVerboseTroubleshootingMessage('[handleCustodialWalletClick]', {
113
113
  twoStepAuthentication,
114
114
  });
115
- setSelectedWalletConnectorKey(walletConnector.key);
115
+ setSelectedWalletConnectorKey({
116
+ chain: walletConnector.connectedChain,
117
+ key: walletConnector.key,
118
+ });
116
119
  return onCustodialWallet({
117
120
  requiresTwoStepAuthentication: twoStepAuthentication,
118
121
  walletConnector,
@@ -121,7 +124,10 @@ const useHandleWalletItem = ({ allowAlreadyConnectedWallet, onQrCodeConnect, onC
121
124
  const handleMobileWalletClick = (walletConnector) => __awaiter(void 0, void 0, void 0, function* () {
122
125
  var _a;
123
126
  logger.debug('handleMobileWalletClick', walletConnector);
124
- setSelectedWalletConnectorKey(walletConnector.key);
127
+ setSelectedWalletConnectorKey({
128
+ chain: walletConnector.connectedChain,
129
+ key: walletConnector.key,
130
+ });
125
131
  // We need to set to LS when about to verify phantom wallet on mobile
126
132
  // because the deeplink interrupts this code execution and then redirects back on a new tab.
127
133
  // This resets all state (except for LS obviously). When we receive the phantom signature in this new tab,
@@ -149,12 +155,18 @@ const useHandleWalletItem = ({ allowAlreadyConnectedWallet, onQrCodeConnect, onC
149
155
  });
150
156
  const handleInstalledExtensionClick = (walletConnector) => __awaiter(void 0, void 0, void 0, function* () {
151
157
  logger.debug('handleInstalledExtensionClick', walletConnector);
152
- setSelectedWalletConnectorKey(walletConnector.key);
158
+ setSelectedWalletConnectorKey({
159
+ chain: walletConnector.connectedChain,
160
+ key: walletConnector.key,
161
+ });
153
162
  return onInstalledExtension({ walletConnector });
154
163
  });
155
164
  const handleUninstalledClick = (walletConnector) => __awaiter(void 0, void 0, void 0, function* () {
156
165
  logger.debug('handleUninstalledClick', walletConnector);
157
- setSelectedWalletConnectorKey(walletConnector.key);
166
+ setSelectedWalletConnectorKey({
167
+ chain: walletConnector.connectedChain,
168
+ key: walletConnector.key,
169
+ });
158
170
  if (!walletConnector.canConnectViaQrCode) {
159
171
  replaceView('no-qr-not-installed');
160
172
  }
@@ -187,7 +199,10 @@ const useHandleWalletItem = ({ allowAlreadyConnectedWallet, onQrCodeConnect, onC
187
199
  linkedWallets,
188
200
  walletConnectorKey: walletConnector.key,
189
201
  });
190
- setSelectedWalletConnectorKey(walletConnector.key);
202
+ setSelectedWalletConnectorKey({
203
+ chain: walletConnector.connectedChain,
204
+ key: walletConnector.key,
205
+ });
191
206
  if (!activeAccountAlreadyLinked) {
192
207
  setMultiWalletWidgetState('awaiting_signature', undefined, 'linking_new_wallet');
193
208
  return;
@@ -242,7 +257,10 @@ const useHandleWalletItem = ({ allowAlreadyConnectedWallet, onQrCodeConnect, onC
242
257
  // also this is only a feature in MM
243
258
  if (authMode !== 'connect-only' && isMetamask) {
244
259
  try {
245
- setSelectedWalletConnectorKey(walletConnector.key);
260
+ setSelectedWalletConnectorKey({
261
+ chain: walletConnector.connectedChain,
262
+ key: walletConnector.key,
263
+ });
246
264
  pushView('pending-connect');
247
265
  yield walletConnector.chooseAccountsToConnect();
248
266
  }
@@ -23,7 +23,6 @@ require('../../../../events/dynamicEvents.cjs');
23
23
  require('../../../../context/DynamicContext/DynamicContext.cjs');
24
24
  require('../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
25
25
  require('../../../../store/state/authMode/authMode.cjs');
26
- var useInternalDynamicContext = require('../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
27
26
  require('../../../../context/CaptchaContext/CaptchaContext.cjs');
28
27
  var ErrorContext = require('../../../../context/ErrorContext/ErrorContext.cjs');
29
28
  require('@dynamic-labs/multi-wallet');
@@ -34,6 +33,7 @@ require('@dynamic-labs-sdk/client/core');
34
33
  require('../../../../client/client.cjs');
35
34
  require('@dynamic-labs-sdk/client');
36
35
  require('../../../../config/ApiEndpoint.cjs');
36
+ var useProjectSettings = require('../../../../client/extension/projectSettings/useProjectSettings/useProjectSettings.cjs');
37
37
  require('@dynamic-labs/locale');
38
38
  require('../../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
39
39
  require('../../../../store/state/primaryWalletId/primaryWalletId.cjs');
@@ -107,7 +107,7 @@ require('../../../../components/Popper/PopperContext/PopperContext.cjs');
107
107
 
108
108
  const LoginEmailForm = ({ isLoading, onSubmit, onSubmitError, currentEmail, className, style, }) => {
109
109
  var _a;
110
- const { projectSettings } = useInternalDynamicContext.useInternalDynamicContext();
110
+ const projectSettings = useProjectSettings.useProjectSettings();
111
111
  const { view, pushView } = ViewContext.useViewContext();
112
112
  const { setVerificationUUID, setDisplayedDestination } = VerificationContext.useVerification();
113
113
  const { setError } = ErrorContext.useErrorContext();
@@ -148,7 +148,11 @@ const LoginEmailForm = ({ isLoading, onSubmit, onSubmitError, currentEmail, clas
148
148
  setVerificationUUID,
149
149
  setDisplayedDestination,
150
150
  ]);
151
- if (!isEmailProviderEnabled.isEmailProviderEnabled(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers)) {
151
+ if (!projectSettings) {
152
+ logger.logger.debug('Failed to render EmailSignInSection - no project settings');
153
+ return null;
154
+ }
155
+ if (!isEmailProviderEnabled.isEmailProviderEnabled(projectSettings.providers)) {
152
156
  logger.logger.error('Failed to render EmailSignInSection - no sign in provider enabled');
153
157
  return null;
154
158
  }
@@ -19,7 +19,6 @@ import '../../../../events/dynamicEvents.js';
19
19
  import '../../../../context/DynamicContext/DynamicContext.js';
20
20
  import '../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
21
21
  import '../../../../store/state/authMode/authMode.js';
22
- import { useInternalDynamicContext } from '../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
23
22
  import '../../../../context/CaptchaContext/CaptchaContext.js';
24
23
  import { useErrorContext } from '../../../../context/ErrorContext/ErrorContext.js';
25
24
  import '@dynamic-labs/multi-wallet';
@@ -30,6 +29,7 @@ import '@dynamic-labs-sdk/client/core';
30
29
  import '../../../../client/client.js';
31
30
  import '@dynamic-labs-sdk/client';
32
31
  import '../../../../config/ApiEndpoint.js';
32
+ import { useProjectSettings } from '../../../../client/extension/projectSettings/useProjectSettings/useProjectSettings.js';
33
33
  import '@dynamic-labs/locale';
34
34
  import '../../../../store/state/dynamicContextProps/dynamicContextProps.js';
35
35
  import '../../../../store/state/primaryWalletId/primaryWalletId.js';
@@ -103,7 +103,7 @@ import '../../../../components/Popper/PopperContext/PopperContext.js';
103
103
 
104
104
  const LoginEmailForm = ({ isLoading, onSubmit, onSubmitError, currentEmail, className, style, }) => {
105
105
  var _a;
106
- const { projectSettings } = useInternalDynamicContext();
106
+ const projectSettings = useProjectSettings();
107
107
  const { view, pushView } = useViewContext();
108
108
  const { setVerificationUUID, setDisplayedDestination } = useVerification();
109
109
  const { setError } = useErrorContext();
@@ -144,7 +144,11 @@ const LoginEmailForm = ({ isLoading, onSubmit, onSubmitError, currentEmail, clas
144
144
  setVerificationUUID,
145
145
  setDisplayedDestination,
146
146
  ]);
147
- if (!isEmailProviderEnabled(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers)) {
147
+ if (!projectSettings) {
148
+ logger.debug('Failed to render EmailSignInSection - no project settings');
149
+ return null;
150
+ }
151
+ if (!isEmailProviderEnabled(projectSettings.providers)) {
148
152
  logger.error('Failed to render EmailSignInSection - no sign in provider enabled');
149
153
  return null;
150
154
  }
@@ -23,7 +23,6 @@ require('../../../../events/dynamicEvents.cjs');
23
23
  require('../../../../context/DynamicContext/DynamicContext.cjs');
24
24
  require('../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
25
25
  require('../../../../store/state/authMode/authMode.cjs');
26
- var useInternalDynamicContext = require('../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
27
26
  require('../../../../context/CaptchaContext/CaptchaContext.cjs');
28
27
  require('../../../../context/ErrorContext/ErrorContext.cjs');
29
28
  require('@dynamic-labs/multi-wallet');
@@ -38,6 +37,7 @@ require('@dynamic-labs-sdk/client/core');
38
37
  require('../../../../client/client.cjs');
39
38
  require('@dynamic-labs-sdk/client');
40
39
  require('../../../../config/ApiEndpoint.cjs');
40
+ var useProjectSettings = require('../../../../client/extension/projectSettings/useProjectSettings/useProjectSettings.cjs');
41
41
  require('@dynamic-labs/locale');
42
42
  require('../../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
43
43
  require('../../../../store/state/primaryWalletId/primaryWalletId.cjs');
@@ -113,7 +113,7 @@ require('../../../../components/Popper/PopperContext/PopperContext.cjs');
113
113
 
114
114
  const PhoneNumberSignInSection = ({ isLoading, onSubmit, onSubmitError, }) => {
115
115
  var _a, _b;
116
- const { projectSettings } = useInternalDynamicContext.useInternalDynamicContext();
116
+ const projectSettings = useProjectSettings.useProjectSettings();
117
117
  const countriesWithVerification = React.useMemo(() => {
118
118
  const enabledCountries = getSupportedCountriesForVerificationFromProjectSettings.getSupportedCountriesForVerificationFromProjectSettings(projectSettings);
119
119
  // For login, we always want to use only countries with verification supported
@@ -138,6 +138,10 @@ const PhoneNumberSignInSection = ({ isLoading, onSubmit, onSubmitError, }) => {
138
138
  phone: phoneData.phone,
139
139
  setInvalidNumberMessage,
140
140
  });
141
+ if (!projectSettings) {
142
+ logger.logger.debug('Failed to render PhoneNumberSignInSection - no project settings');
143
+ return null;
144
+ }
141
145
  if (!isPhoneNumberProviderEnabled.isPhoneNumberProviderEnabled((_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers) !== null && _a !== void 0 ? _a : [])) {
142
146
  logger.logger.error('Failed to render PhoneNumberSignInSection - no sign in provider enabled');
143
147
  return null;