@dynamic-labs/sdk-react-core 3.4.0 → 3.4.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.
Files changed (129) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/package.cjs +2 -2
  3. package/package.js +2 -2
  4. package/package.json +12 -12
  5. package/src/lib/Main.cjs +1 -1
  6. package/src/lib/Main.js +1 -1
  7. package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.cjs +26 -6
  8. package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.js +27 -7
  9. package/src/lib/components/TransactionCard/TransactionCard.cjs +76 -5
  10. package/src/lib/components/TransactionCard/TransactionCard.js +77 -6
  11. package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.cjs +1 -1
  12. package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.js +1 -1
  13. package/src/lib/components/UserProfile/UserProfile.cjs +1 -1
  14. package/src/lib/components/UserProfile/UserProfile.js +1 -1
  15. package/src/lib/components/UserProfileForm/UserProfileForm.cjs +1 -1
  16. package/src/lib/components/UserProfileForm/UserProfileForm.js +1 -1
  17. package/src/lib/components/WalletConnectorEvents/WalletConnectorEvents.cjs +126 -0
  18. package/src/lib/components/WalletConnectorEvents/WalletConnectorEvents.d.ts +1 -0
  19. package/src/lib/components/WalletConnectorEvents/WalletConnectorEvents.js +122 -0
  20. package/src/lib/components/WalletConnectorEvents/index.d.ts +1 -0
  21. package/src/lib/components/index.d.ts +1 -0
  22. package/src/lib/context/DynamicContext/DynamicContext.cjs +26 -25
  23. package/src/lib/context/DynamicContext/DynamicContext.js +18 -17
  24. package/src/lib/context/MockContext/MockContext.cjs +1 -1
  25. package/src/lib/context/MockContext/MockContext.js +1 -1
  26. package/src/lib/layout/DynamicAuthLayout/Header/header.cjs +1 -1
  27. package/src/lib/layout/DynamicAuthLayout/Header/header.js +1 -1
  28. package/src/lib/layout/DynamicAuthLayout/HelpContent/HelpHeader/HelpHeader.cjs +1 -1
  29. package/src/lib/layout/DynamicAuthLayout/HelpContent/HelpHeader/HelpHeader.js +1 -1
  30. package/src/lib/layouts/BridgeNextWalletToConnectLayout/BridgeNextWalletToConnectLayout.cjs +1 -1
  31. package/src/lib/layouts/BridgeNextWalletToConnectLayout/BridgeNextWalletToConnectLayout.js +1 -1
  32. package/src/lib/layouts/BridgeWelcomeLayout/BridgeWelcomeLayout.cjs +1 -1
  33. package/src/lib/layouts/BridgeWelcomeLayout/BridgeWelcomeLayout.js +1 -1
  34. package/src/lib/layouts/ConnectedWalletsListLayout/ConnectedWalletsListLayout.cjs +1 -1
  35. package/src/lib/layouts/ConnectedWalletsListLayout/ConnectedWalletsListLayout.js +1 -1
  36. package/src/lib/modals/SendBalanceModal/SendBalanceModal.cjs +1 -1
  37. package/src/lib/modals/SendBalanceModal/SendBalanceModal.js +1 -1
  38. package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.cjs +1 -1
  39. package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.js +1 -1
  40. package/src/lib/store/internalImplementation/utils/clearExpiredData/clearExpiredData.cjs +1 -6
  41. package/src/lib/store/internalImplementation/utils/clearExpiredData/clearExpiredData.js +1 -6
  42. package/src/lib/store/stateConfig.cjs +0 -5
  43. package/src/lib/store/stateConfig.js +0 -5
  44. package/src/lib/store/types.d.ts +1 -6
  45. package/src/lib/utils/functions/networksAndChains/networksAndChains.cjs +19 -40
  46. package/src/lib/utils/functions/networksAndChains/networksAndChains.d.ts +11 -7
  47. package/src/lib/utils/functions/networksAndChains/networksAndChains.js +19 -38
  48. package/src/lib/utils/hooks/index.d.ts +1 -1
  49. package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.cjs +2 -2
  50. package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.js +2 -2
  51. package/src/lib/utils/hooks/useCreateWalletConnectorOptions/index.d.ts +1 -0
  52. package/src/lib/utils/hooks/{useWalletConnectorOptions/useWalletConnectorOptions.cjs → useCreateWalletConnectorOptions/useCreateWalletConnectorOptions.cjs} +2 -2
  53. package/src/lib/utils/hooks/{useWalletConnectorOptions/useWalletConnectorOptions.d.ts → useCreateWalletConnectorOptions/useCreateWalletConnectorOptions.d.ts} +1 -1
  54. package/src/lib/utils/hooks/{useWalletConnectorOptions/useWalletConnectorOptions.js → useCreateWalletConnectorOptions/useCreateWalletConnectorOptions.js} +2 -2
  55. package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.cjs +18 -9
  56. package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.js +18 -9
  57. package/src/lib/utils/hooks/useNetworkConfigurationsFromProjectSettings/index.d.ts +1 -0
  58. package/src/lib/utils/hooks/useNetworkConfigurationsFromProjectSettings/useNetworkConfigurationsFromProjectSettings.cjs +63 -0
  59. package/src/lib/utils/hooks/useNetworkConfigurationsFromProjectSettings/useNetworkConfigurationsFromProjectSettings.d.ts +9 -0
  60. package/src/lib/utils/hooks/useNetworkConfigurationsFromProjectSettings/useNetworkConfigurationsFromProjectSettings.js +59 -0
  61. package/src/lib/views/CoinbaseMPCClaimIntro/CoinbaseMPCClaimIntro.cjs +1 -1
  62. package/src/lib/views/CoinbaseMPCClaimIntro/CoinbaseMPCClaimIntro.js +1 -1
  63. package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.cjs +1 -1
  64. package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.js +1 -1
  65. package/src/lib/views/CreatePasswordView/CreatePasswordStep/CreatePasswordStep.cjs +1 -1
  66. package/src/lib/views/CreatePasswordView/CreatePasswordStep/CreatePasswordStep.js +1 -1
  67. package/src/lib/views/CreatePasswordView/SavePasswordStep/SavePasswordStep.cjs +1 -1
  68. package/src/lib/views/CreatePasswordView/SavePasswordStep/SavePasswordStep.js +1 -1
  69. package/src/lib/views/EnterPasswordView/EnterPasswordView.cjs +1 -1
  70. package/src/lib/views/EnterPasswordView/EnterPasswordView.js +1 -1
  71. package/src/lib/views/MfaChooseDeviceView/MfaChooseDeviceView.cjs +1 -1
  72. package/src/lib/views/MfaChooseDeviceView/MfaChooseDeviceView.js +1 -1
  73. package/src/lib/views/Passkey/PasskeyNewDomainDetectedView/PasskeyNewDomainDetectedView.cjs +1 -1
  74. package/src/lib/views/Passkey/PasskeyNewDomainDetectedView/PasskeyNewDomainDetectedView.js +1 -1
  75. package/src/lib/views/Passkey/PasskeyRecovery/InitRecovery/PasskeyInitRecovery.cjs +1 -1
  76. package/src/lib/views/Passkey/PasskeyRecovery/InitRecovery/PasskeyInitRecovery.js +1 -1
  77. package/src/lib/views/Passkey/RenamePasskeyView/RenamePasskeyView.cjs +1 -1
  78. package/src/lib/views/Passkey/RenamePasskeyView/RenamePasskeyView.js +1 -1
  79. package/src/lib/views/SendBalanceView/SendBalanceView.cjs +2 -3
  80. package/src/lib/views/SendBalanceView/SendBalanceView.js +3 -4
  81. package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +7 -4
  82. package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +7 -4
  83. package/src/lib/views/UserFieldEditorView/UserFieldEditorView.cjs +1 -1
  84. package/src/lib/views/UserFieldEditorView/UserFieldEditorView.js +1 -1
  85. package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCardBody/DynamicBridgeWalletCardBody.cjs +1 -1
  86. package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCardBody/DynamicBridgeWalletCardBody.js +1 -1
  87. package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedUserProfile/DynamicEmbeddedUserProfile.cjs +1 -1
  88. package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedUserProfile/DynamicEmbeddedUserProfile.js +1 -1
  89. package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveBitcoinWalletAddresses/ActiveBitcoinWalletAddresses.cjs +1 -1
  90. package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveBitcoinWalletAddresses/ActiveBitcoinWalletAddresses.js +1 -1
  91. package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletAddress/ActiveWalletAddress.cjs +1 -1
  92. package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletAddress/ActiveWalletAddress.js +1 -1
  93. package/src/lib/widgets/DynamicWidget/components/DynamicUserProfile/DynamicUserProfile.cjs +1 -1
  94. package/src/lib/widgets/DynamicWidget/components/DynamicUserProfile/DynamicUserProfile.js +1 -1
  95. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.cjs +1 -1
  96. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.js +1 -1
  97. package/src/lib/widgets/DynamicWidget/components/UnknownWalletInformation/UnknownWalletInformation.cjs +1 -1
  98. package/src/lib/widgets/DynamicWidget/components/UnknownWalletInformation/UnknownWalletInformation.js +1 -1
  99. package/src/lib/widgets/DynamicWidget/hooks/useFetchChain/index.d.ts +1 -0
  100. package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.cjs +1 -1
  101. package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.js +1 -1
  102. package/src/lib/widgets/DynamicWidget/views/ManageMfaWidgetView/ManageMfaWidgetView.cjs +1 -1
  103. package/src/lib/widgets/DynamicWidget/views/ManageMfaWidgetView/ManageMfaWidgetView.js +1 -1
  104. package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/ManagePasskeysWidgetView.cjs +1 -1
  105. package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/ManagePasskeysWidgetView.js +1 -1
  106. package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs +1 -1
  107. package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js +1 -1
  108. package/src/lib/store/state/networkConfigurations/index.d.ts +0 -1
  109. package/src/lib/store/state/networkConfigurations/networkConfigurations.cjs +0 -159
  110. package/src/lib/store/state/networkConfigurations/networkConfigurations.d.ts +0 -10
  111. package/src/lib/store/state/networkConfigurations/networkConfigurations.js +0 -151
  112. package/src/lib/utils/hooks/useWalletConnectorOptions/index.d.ts +0 -1
  113. /package/src/lib/utils/hooks/{useWalletConnectorOptions → useCreateWalletConnectorOptions}/utils/errors/ConnectorSetupError.cjs +0 -0
  114. /package/src/lib/utils/hooks/{useWalletConnectorOptions → useCreateWalletConnectorOptions}/utils/errors/ConnectorSetupError.d.ts +0 -0
  115. /package/src/lib/utils/hooks/{useWalletConnectorOptions → useCreateWalletConnectorOptions}/utils/errors/ConnectorSetupError.js +0 -0
  116. /package/src/lib/utils/hooks/{useWalletConnectorOptions → useCreateWalletConnectorOptions}/utils/errors/index.d.ts +0 -0
  117. /package/src/lib/utils/hooks/{useWalletConnectorOptions → useCreateWalletConnectorOptions}/utils/index.d.ts +0 -0
  118. /package/src/lib/utils/hooks/{useWalletConnectorOptions → useCreateWalletConnectorOptions}/utils/verifyMagicIsSetup/index.d.ts +0 -0
  119. /package/src/lib/utils/hooks/{useWalletConnectorOptions → useCreateWalletConnectorOptions}/utils/verifyMagicIsSetup/verifyMagicIsSetup.cjs +0 -0
  120. /package/src/lib/utils/hooks/{useWalletConnectorOptions → useCreateWalletConnectorOptions}/utils/verifyMagicIsSetup/verifyMagicIsSetup.d.ts +0 -0
  121. /package/src/lib/utils/hooks/{useWalletConnectorOptions → useCreateWalletConnectorOptions}/utils/verifyMagicIsSetup/verifyMagicIsSetup.js +0 -0
  122. /package/src/lib/utils/hooks/{useWalletConnectorOptions → useCreateWalletConnectorOptions}/utils/verifyRequiredConnectorsAreSetup/index.d.ts +0 -0
  123. /package/src/lib/utils/hooks/{useWalletConnectorOptions → useCreateWalletConnectorOptions}/utils/verifyRequiredConnectorsAreSetup/verifyRequiredConnectorsAreSetup.cjs +0 -0
  124. /package/src/lib/utils/hooks/{useWalletConnectorOptions → useCreateWalletConnectorOptions}/utils/verifyRequiredConnectorsAreSetup/verifyRequiredConnectorsAreSetup.d.ts +0 -0
  125. /package/src/lib/utils/hooks/{useWalletConnectorOptions → useCreateWalletConnectorOptions}/utils/verifyRequiredConnectorsAreSetup/verifyRequiredConnectorsAreSetup.js +0 -0
  126. /package/src/lib/utils/hooks/{useWalletConnectorOptions → useCreateWalletConnectorOptions}/utils/verifyZeroDevIsSetup/index.d.ts +0 -0
  127. /package/src/lib/utils/hooks/{useWalletConnectorOptions → useCreateWalletConnectorOptions}/utils/verifyZeroDevIsSetup/verifyZeroDevIsSetup.cjs +0 -0
  128. /package/src/lib/utils/hooks/{useWalletConnectorOptions → useCreateWalletConnectorOptions}/utils/verifyZeroDevIsSetup/verifyZeroDevIsSetup.d.ts +0 -0
  129. /package/src/lib/utils/hooks/{useWalletConnectorOptions → useCreateWalletConnectorOptions}/utils/verifyZeroDevIsSetup/verifyZeroDevIsSetup.js +0 -0
@@ -66,8 +66,8 @@ var IconButton = require('../../components/IconButton/IconButton.cjs');
66
66
  require('../../components/MenuList/Dropdown/Dropdown.cjs');
67
67
  var TypographyButton = require('../../components/TypographyButton/TypographyButton.cjs');
68
68
  require('formik');
69
- require('../../store/state/sendBalances.cjs');
70
69
  var ModalHeader = require('../../components/ModalHeader/ModalHeader.cjs');
70
+ require('../../store/state/sendBalances.cjs');
71
71
  require('../../components/Input/Input.cjs');
72
72
  require('../../views/TransactionConfirmationView/helpers/transactionErrorMessage.cjs');
73
73
  require('../../context/PasskeyContext/PasskeyContext.cjs');
@@ -62,8 +62,8 @@ import { IconButton } from '../../components/IconButton/IconButton.js';
62
62
  import '../../components/MenuList/Dropdown/Dropdown.js';
63
63
  import { TypographyButton } from '../../components/TypographyButton/TypographyButton.js';
64
64
  import 'formik';
65
- import '../../store/state/sendBalances.js';
66
65
  import { ModalHeader } from '../../components/ModalHeader/ModalHeader.js';
66
+ import '../../store/state/sendBalances.js';
67
67
  import '../../components/Input/Input.js';
68
68
  import '../../views/TransactionConfirmationView/helpers/transactionErrorMessage.js';
69
69
  import '../../context/PasskeyContext/PasskeyContext.js';
@@ -67,8 +67,8 @@ var IconButton = require('../../components/IconButton/IconButton.cjs');
67
67
  require('../../components/MenuList/Dropdown/Dropdown.cjs');
68
68
  var TypographyButton = require('../../components/TypographyButton/TypographyButton.cjs');
69
69
  require('formik');
70
- require('../../store/state/sendBalances.cjs');
71
70
  var ModalHeader = require('../../components/ModalHeader/ModalHeader.cjs');
71
+ require('../../store/state/sendBalances.cjs');
72
72
  require('../../components/Input/Input.cjs');
73
73
  require('../../views/TransactionConfirmationView/helpers/transactionErrorMessage.cjs');
74
74
  require('../../context/PasskeyContext/PasskeyContext.cjs');
@@ -63,8 +63,8 @@ import { IconButton } from '../../components/IconButton/IconButton.js';
63
63
  import '../../components/MenuList/Dropdown/Dropdown.js';
64
64
  import { TypographyButton } from '../../components/TypographyButton/TypographyButton.js';
65
65
  import 'formik';
66
- import '../../store/state/sendBalances.js';
67
66
  import { ModalHeader } from '../../components/ModalHeader/ModalHeader.js';
67
+ import '../../store/state/sendBalances.js';
68
68
  import '../../components/Input/Input.js';
69
69
  import '../../views/TransactionConfirmationView/helpers/transactionErrorMessage.js';
70
70
  import '../../context/PasskeyContext/PasskeyContext.js';
@@ -71,7 +71,6 @@ var SendBalanceView = require('../../views/SendBalanceView/SendBalanceView.cjs')
71
71
  require('../../context/PasskeyContext/PasskeyContext.cjs');
72
72
  require('../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
73
73
  require('../../../index.cjs');
74
- require('../../store/state/sendBalances.cjs');
75
74
  require('../../views/TransactionConfirmationView/helpers/transactionErrorMessage.cjs');
76
75
  require('../../store/state/tokenBalances.cjs');
77
76
  require('../../components/InlineWidget/InlineWidget.cjs');
@@ -84,6 +83,7 @@ require('qrcode');
84
83
  require('../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
85
84
  require('@hcaptcha/react-hcaptcha');
86
85
  require('../../context/IpConfigurationContext/IpConfigurationContext.cjs');
86
+ require('../../store/state/sendBalances.cjs');
87
87
 
88
88
  const SendBalanceModal = ({ initialRecipientAddress, initialValue, onReject, onSuccess, }) => {
89
89
  usePreventPageScroll.usePreventPageScroll(true);
@@ -67,7 +67,6 @@ import { SendBalanceView } from '../../views/SendBalanceView/SendBalanceView.js'
67
67
  import '../../context/PasskeyContext/PasskeyContext.js';
68
68
  import '../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
69
69
  import '../../../index.js';
70
- import '../../store/state/sendBalances.js';
71
70
  import '../../views/TransactionConfirmationView/helpers/transactionErrorMessage.js';
72
71
  import '../../store/state/tokenBalances.js';
73
72
  import '../../components/InlineWidget/InlineWidget.js';
@@ -80,6 +79,7 @@ import 'qrcode';
80
79
  import '../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
81
80
  import '@hcaptcha/react-hcaptcha';
82
81
  import '../../context/IpConfigurationContext/IpConfigurationContext.js';
82
+ import '../../store/state/sendBalances.js';
83
83
 
84
84
  const SendBalanceModal = ({ initialRecipientAddress, initialValue, onReject, onSuccess, }) => {
85
85
  usePreventPageScroll(true);
@@ -83,8 +83,8 @@ var IconButton = require('../../components/IconButton/IconButton.cjs');
83
83
  require('../../components/MenuList/Dropdown/Dropdown.cjs');
84
84
  var ErrorContainer = require('../../components/ErrorContainer/ErrorContainer.cjs');
85
85
  require('formik');
86
- require('../../store/state/sendBalances.cjs');
87
86
  var ModalHeader = require('../../components/ModalHeader/ModalHeader.cjs');
87
+ require('../../store/state/sendBalances.cjs');
88
88
  require('../../components/Input/Input.cjs');
89
89
  require('../../views/TransactionConfirmationView/helpers/transactionErrorMessage.cjs');
90
90
  var PasskeyContext = require('../../context/PasskeyContext/PasskeyContext.cjs');
@@ -79,8 +79,8 @@ import { IconButton } from '../../components/IconButton/IconButton.js';
79
79
  import '../../components/MenuList/Dropdown/Dropdown.js';
80
80
  import { ErrorContainer } from '../../components/ErrorContainer/ErrorContainer.js';
81
81
  import 'formik';
82
- import '../../store/state/sendBalances.js';
83
82
  import { ModalHeader } from '../../components/ModalHeader/ModalHeader.js';
83
+ import '../../store/state/sendBalances.js';
84
84
  import '../../components/Input/Input.js';
85
85
  import '../../views/TransactionConfirmationView/helpers/transactionErrorMessage.js';
86
86
  import { usePasskeyContext } from '../../context/PasskeyContext/PasskeyContext.js';
@@ -7,7 +7,7 @@ var utils = require('@dynamic-labs/utils');
7
7
  var localStorage = require('../../../../utils/constants/localStorage.cjs');
8
8
 
9
9
  const clearExpiredData = (store) => {
10
- const { projectSettings, networkConfigurations, user } = store.getState();
10
+ const { projectSettings, user } = store.getState();
11
11
  // TODO: we can clean this up once we move wallet info to the store
12
12
  const [connectedWalletData] = utils.StorageService.getItem(localStorage.CONNECTED_WALLETS_INFO) || [];
13
13
  const shouldRemoveSettingsAndConfigs = !user && !connectedWalletData;
@@ -18,11 +18,6 @@ const clearExpiredData = (store) => {
18
18
  projectSettings: store.getInitialState().projectSettings,
19
19
  });
20
20
  }
21
- if (isExpired(networkConfigurations)) {
22
- store.setState({
23
- networkConfigurations: store.getInitialState().networkConfigurations,
24
- });
25
- }
26
21
  return store;
27
22
  };
28
23
 
@@ -3,7 +3,7 @@ import { StorageService } from '@dynamic-labs/utils';
3
3
  import { CONNECTED_WALLETS_INFO } from '../../../../utils/constants/localStorage.js';
4
4
 
5
5
  const clearExpiredData = (store) => {
6
- const { projectSettings, networkConfigurations, user } = store.getState();
6
+ const { projectSettings, user } = store.getState();
7
7
  // TODO: we can clean this up once we move wallet info to the store
8
8
  const [connectedWalletData] = StorageService.getItem(CONNECTED_WALLETS_INFO) || [];
9
9
  const shouldRemoveSettingsAndConfigs = !user && !connectedWalletData;
@@ -14,11 +14,6 @@ const clearExpiredData = (store) => {
14
14
  projectSettings: store.getInitialState().projectSettings,
15
15
  });
16
16
  }
17
- if (isExpired(networkConfigurations)) {
18
- store.setState({
19
- networkConfigurations: store.getInitialState().networkConfigurations,
20
- });
21
- }
22
17
  return store;
23
18
  };
24
19
 
@@ -11,10 +11,6 @@ const createInitialStates = ({ environmentId, }) => ({
11
11
  loadingAndLifecycle: {
12
12
  sessionValidation: false,
13
13
  },
14
- networkConfigurations: {
15
- expiresAt: undefined,
16
- networkConfigurations: undefined,
17
- },
18
14
  projectSettings: { expiresAt: undefined, settings: undefined },
19
15
  sendBalanceState: {
20
16
  amount: undefined,
@@ -36,7 +32,6 @@ const createInitialStates = ({ environmentId, }) => ({
36
32
  */
37
33
  const transformStateForLocalStorage = (state) => ({
38
34
  environmentId: state.environmentId,
39
- networkConfigurations: state.networkConfigurations,
40
35
  projectSettings: state.projectSettings,
41
36
  user: state.user,
42
37
  });
@@ -7,10 +7,6 @@ const createInitialStates = ({ environmentId, }) => ({
7
7
  loadingAndLifecycle: {
8
8
  sessionValidation: false,
9
9
  },
10
- networkConfigurations: {
11
- expiresAt: undefined,
12
- networkConfigurations: undefined,
13
- },
14
10
  projectSettings: { expiresAt: undefined, settings: undefined },
15
11
  sendBalanceState: {
16
12
  amount: undefined,
@@ -32,7 +28,6 @@ const createInitialStates = ({ environmentId, }) => ({
32
28
  */
33
29
  const transformStateForLocalStorage = (state) => ({
34
30
  environmentId: state.environmentId,
35
- networkConfigurations: state.networkConfigurations,
36
31
  projectSettings: state.projectSettings,
37
32
  user: state.user,
38
33
  });
@@ -1,5 +1,5 @@
1
1
  import { ProjectSettings, TokenBalance } from '@dynamic-labs/sdk-api-core';
2
- import { NetworkConfigurationMap, UserProfile } from '@dynamic-labs/types';
2
+ import { UserProfile } from '@dynamic-labs/types';
3
3
  import { WalletOption } from '../shared/types/wallets';
4
4
  export type SdkStoreProps = {
5
5
  environmentId: string;
@@ -9,7 +9,6 @@ export type SdkStore = {
9
9
  environmentId: string;
10
10
  user: UserProfile | undefined;
11
11
  projectSettings: StoredProjectSettings;
12
- networkConfigurations: StoredNetworkConfigurations;
13
12
  tokenBalancesState: TokenBalancesState;
14
13
  sendBalanceState: SendBalanceState;
15
14
  walletConnectorOptions: WalletOption[];
@@ -36,10 +35,6 @@ export type StoredProjectSettings = {
36
35
  expiresAt: number | undefined;
37
36
  settings: ProjectSettings | undefined;
38
37
  };
39
- export type StoredNetworkConfigurations = {
40
- expiresAt: number | undefined;
41
- networkConfigurations: NetworkConfigurationMap | undefined;
42
- };
43
38
  export type StateConfig = {
44
39
  [K in keyof SdkStore]: {
45
40
  initialValue: SdkStore[K];
@@ -3,39 +3,24 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- const eth = {
7
- logoURI: 'https://app.dynamic.xyz/assets/networks/eth.svg',
8
- name: 'Ethereum',
9
- symbol: 'ETH',
10
- };
11
- const networkMap = {
12
- avalanche: {
13
- logoURI: 'https://app.dynamic.xyz/assets/networks/avax.svg',
14
- name: 'Avalanche',
15
- symbol: 'AVAX',
16
- },
17
- polygon: {
18
- logoURI: 'https://app.dynamic.xyz/assets/networks/polygon.svg',
19
- name: 'Polygon',
20
- symbol: 'MATIC',
21
- },
22
- solana: {
23
- logoURI: 'https://app.dynamic.xyz/assets/networks/solana.svg',
24
- name: 'Solana',
25
- symbol: 'SOL',
26
- },
27
- };
28
- const getNativeTokenInfo = (blockchain = 'eth') => networkMap[blockchain] || eth;
29
- const allowedChains = {
30
- 'arbitrum one': 'arbitrum',
31
- avalanche: 'avalanche',
32
- base: 'base',
33
- eth: 'eth',
34
- 'op mainnet': 'optimism',
35
- optimism: 'optimism',
36
- polygon: 'polygon',
37
- sepolia: 'sepolia',
38
- solana: 'solana',
6
+ var values = require('../../constants/values.cjs');
7
+
8
+ const getNetworkInfoEntry = (chain, networkInfo) => {
9
+ if (!chain || !chain.symbol) {
10
+ return;
11
+ }
12
+ const normalizedChainSymbol = chain.symbol === 'ETH' || chain.symbol === 'EVM'
13
+ ? 'evm'
14
+ : chain.symbol.toLowerCase();
15
+ const networkData = networkInfo[normalizedChainSymbol] ||
16
+ networkInfo[values.ChainEnumToVerifiedCredentialName[normalizedChainSymbol.toUpperCase()]];
17
+ if (!networkData)
18
+ return;
19
+ if (normalizedChainSymbol === 'evm') {
20
+ return networkData.find((e) => e.chainId === (chain === null || chain === void 0 ? void 0 : chain.chainId));
21
+ }
22
+ // Solana, etc
23
+ return networkData[0];
39
24
  };
40
25
  const getEvmChainName = (chainId) => {
41
26
  const map = {
@@ -49,12 +34,6 @@ const getEvmChainName = (chainId) => {
49
34
  };
50
35
  return map[chainId] || 'Unknown';
51
36
  };
52
- const getIconUrl = (chainName) => {
53
- const chain = allowedChains[chainName === null || chainName === void 0 ? void 0 : chainName.toLowerCase()] || 'eth';
54
- return `https://app.dynamic.xyz/assets/networks/${chain}.svg`;
55
- };
56
37
 
57
- exports.allowedChains = allowedChains;
58
38
  exports.getEvmChainName = getEvmChainName;
59
- exports.getIconUrl = getIconUrl;
60
- exports.getNativeTokenInfo = getNativeTokenInfo;
39
+ exports.getNetworkInfoEntry = getNetworkInfoEntry;
@@ -1,12 +1,16 @@
1
- interface Network {
2
- logoURI: string;
1
+ import { ChainWithIcon } from '../../../widgets/DynamicWidget/hooks/useFetchChain';
2
+ interface NativeCurrency {
3
+ decimals: number;
4
+ iconUrl?: string;
3
5
  name: string;
4
6
  symbol: string;
5
7
  }
6
- export declare const getNativeTokenInfo: (blockchain?: string) => Network;
7
- export declare const allowedChains: {
8
- [key: string]: string;
9
- };
8
+ export interface NetworkInfoEntry {
9
+ chainId: number;
10
+ nativeCurrency: NativeCurrency;
11
+ iconUrls: string[];
12
+ name: string;
13
+ }
14
+ export declare const getNetworkInfoEntry: (chain: ChainWithIcon | undefined, networkInfo: Record<string, NetworkInfoEntry[]>) => NetworkInfoEntry | undefined;
10
15
  export declare const getEvmChainName: (chainId: number) => string;
11
- export declare const getIconUrl: (chainName: string) => string;
12
16
  export {};
@@ -1,37 +1,22 @@
1
1
  'use client'
2
- const eth = {
3
- logoURI: 'https://app.dynamic.xyz/assets/networks/eth.svg',
4
- name: 'Ethereum',
5
- symbol: 'ETH',
6
- };
7
- const networkMap = {
8
- avalanche: {
9
- logoURI: 'https://app.dynamic.xyz/assets/networks/avax.svg',
10
- name: 'Avalanche',
11
- symbol: 'AVAX',
12
- },
13
- polygon: {
14
- logoURI: 'https://app.dynamic.xyz/assets/networks/polygon.svg',
15
- name: 'Polygon',
16
- symbol: 'MATIC',
17
- },
18
- solana: {
19
- logoURI: 'https://app.dynamic.xyz/assets/networks/solana.svg',
20
- name: 'Solana',
21
- symbol: 'SOL',
22
- },
23
- };
24
- const getNativeTokenInfo = (blockchain = 'eth') => networkMap[blockchain] || eth;
25
- const allowedChains = {
26
- 'arbitrum one': 'arbitrum',
27
- avalanche: 'avalanche',
28
- base: 'base',
29
- eth: 'eth',
30
- 'op mainnet': 'optimism',
31
- optimism: 'optimism',
32
- polygon: 'polygon',
33
- sepolia: 'sepolia',
34
- solana: 'solana',
2
+ import { ChainEnumToVerifiedCredentialName } from '../../constants/values.js';
3
+
4
+ const getNetworkInfoEntry = (chain, networkInfo) => {
5
+ if (!chain || !chain.symbol) {
6
+ return;
7
+ }
8
+ const normalizedChainSymbol = chain.symbol === 'ETH' || chain.symbol === 'EVM'
9
+ ? 'evm'
10
+ : chain.symbol.toLowerCase();
11
+ const networkData = networkInfo[normalizedChainSymbol] ||
12
+ networkInfo[ChainEnumToVerifiedCredentialName[normalizedChainSymbol.toUpperCase()]];
13
+ if (!networkData)
14
+ return;
15
+ if (normalizedChainSymbol === 'evm') {
16
+ return networkData.find((e) => e.chainId === (chain === null || chain === void 0 ? void 0 : chain.chainId));
17
+ }
18
+ // Solana, etc
19
+ return networkData[0];
35
20
  };
36
21
  const getEvmChainName = (chainId) => {
37
22
  const map = {
@@ -45,9 +30,5 @@ const getEvmChainName = (chainId) => {
45
30
  };
46
31
  return map[chainId] || 'Unknown';
47
32
  };
48
- const getIconUrl = (chainName) => {
49
- const chain = allowedChains[chainName === null || chainName === void 0 ? void 0 : chainName.toLowerCase()] || 'eth';
50
- return `https://app.dynamic.xyz/assets/networks/${chain}.svg`;
51
- };
52
33
 
53
- export { allowedChains, getEvmChainName, getIconUrl, getNativeTokenInfo };
34
+ export { getEvmChainName, getNetworkInfoEntry };
@@ -35,7 +35,7 @@ export * from './useUserUpdateRequest';
35
35
  export * from './useRpcProviders';
36
36
  export { useValidateSession } from './useValidateSession';
37
37
  export { useVerifyWallet } from './useVerifyWallet';
38
- export { useWalletConnectorOptions } from './useWalletConnectorOptions';
38
+ export { useCreateWalletConnectorOptions } from './useCreateWalletConnectorOptions';
39
39
  export { useWalletConnectors } from './useWalletConnectors';
40
40
  export { useWalletItemActions } from './useWalletItemActions';
41
41
  export { useWalletUiUtils } from './useWalletUiUtils';
@@ -117,7 +117,7 @@ const useCreateDynamicEmbeddedWalletMutation = () => {
117
117
  const turnkeyVerifiedCredentials = (_d = updatedUser.verifiedCredentials) === null || _d === void 0 ? void 0 : _d.find(({ walletName }) => walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey'));
118
118
  /** It's not authenticated if it's a turnkey wallet that still hasn't created a passkey */
119
119
  const isAuthenticated = Boolean((_e = turnkeyVerifiedCredentials === null || turnkeyVerifiedCredentials === void 0 ? void 0 : turnkeyVerifiedCredentials.walletProperties) === null || _e === void 0 ? void 0 : _e.isAuthenticatorAttached);
120
- const passkeyWallet = walletConnector.createWallet({
120
+ const embeddedWallet = walletConnector.createWallet({
121
121
  address: (yield walletConnector.getAddress()) || '',
122
122
  chain: walletConnector.connectedChain,
123
123
  connector: walletConnector,
@@ -137,7 +137,7 @@ const useCreateDynamicEmbeddedWalletMutation = () => {
137
137
  });
138
138
  setPrimaryWalletId(smartWallet$1.id);
139
139
  }
140
- dynamicEvents.dynamicEvents.emit('embeddedWalletCreated', passkeyWallet, turnkeyVerifiedCredentials, updatedUser);
140
+ dynamicEvents.dynamicEvents.emit('embeddedWalletCreated', embeddedWallet, turnkeyVerifiedCredentials, updatedUser);
141
141
  setShowAuthFlow(false, { performMultiWalletChecks: false });
142
142
  }
143
143
  catch (err) {
@@ -113,7 +113,7 @@ const useCreateDynamicEmbeddedWalletMutation = () => {
113
113
  const turnkeyVerifiedCredentials = (_d = updatedUser.verifiedCredentials) === null || _d === void 0 ? void 0 : _d.find(({ walletName }) => walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey'));
114
114
  /** It's not authenticated if it's a turnkey wallet that still hasn't created a passkey */
115
115
  const isAuthenticated = Boolean((_e = turnkeyVerifiedCredentials === null || turnkeyVerifiedCredentials === void 0 ? void 0 : turnkeyVerifiedCredentials.walletProperties) === null || _e === void 0 ? void 0 : _e.isAuthenticatorAttached);
116
- const passkeyWallet = walletConnector.createWallet({
116
+ const embeddedWallet = walletConnector.createWallet({
117
117
  address: (yield walletConnector.getAddress()) || '',
118
118
  chain: walletConnector.connectedChain,
119
119
  connector: walletConnector,
@@ -133,7 +133,7 @@ const useCreateDynamicEmbeddedWalletMutation = () => {
133
133
  });
134
134
  setPrimaryWalletId(smartWallet.id);
135
135
  }
136
- dynamicEvents.emit('embeddedWalletCreated', passkeyWallet, turnkeyVerifiedCredentials, updatedUser);
136
+ dynamicEvents.emit('embeddedWalletCreated', embeddedWallet, turnkeyVerifiedCredentials, updatedUser);
137
137
  setShowAuthFlow(false, { performMultiWalletChecks: false });
138
138
  }
139
139
  catch (err) {
@@ -0,0 +1 @@
1
+ export { useCreateWalletConnectorOptions } from './useCreateWalletConnectorOptions';
@@ -28,7 +28,7 @@ require('../../../store/state/projectSettings/projectSettings.cjs');
28
28
  var walletConnectorOptions = require('../../../store/state/walletConnectorOptions.cjs');
29
29
  var verifyRequiredConnectorsAreSetup = require('./utils/verifyRequiredConnectorsAreSetup/verifyRequiredConnectorsAreSetup.cjs');
30
30
 
31
- const useWalletConnectorOptions = ({ projectSettings, appLogoUrl, appName, coinbaseWalletPreference, deepLinkPreference, flowNetwork, mobileExperience, networkConfigurations, walletBook, walletUiUtils, walletConnectorsProp, walletConnectPreferredChains, walletConnectorExtensions, }) => {
31
+ const useCreateWalletConnectorOptions = ({ projectSettings, appLogoUrl, appName, coinbaseWalletPreference, deepLinkPreference, flowNetwork, mobileExperience, networkConfigurations, walletBook, walletUiUtils, walletConnectorsProp, walletConnectPreferredChains, walletConnectorExtensions, }) => {
32
32
  const walletConnectorsKey = React.useMemo(() => { var _a; return (_a = serializeWalletConnectors.serializeWalletConnectors(walletConnectorsProp)) === null || _a === void 0 ? void 0 : _a.join(','); }, [walletConnectorsProp]);
33
33
  const walletBookLength = React.useMemo(() => Object.keys(walletBook !== null && walletBook !== void 0 ? walletBook : {}).length, [walletBook]);
34
34
  const walletConnectorOptions$1 = React.useMemo(() => {
@@ -75,4 +75,4 @@ const useWalletConnectorOptions = ({ projectSettings, appLogoUrl, appName, coinb
75
75
  return { walletConnectorOptions: walletConnectorOptions$1 };
76
76
  };
77
77
 
78
- exports.useWalletConnectorOptions = useWalletConnectorOptions;
78
+ exports.useCreateWalletConnectorOptions = useCreateWalletConnectorOptions;
@@ -17,7 +17,7 @@ type Props = {
17
17
  walletUiUtils: WalletUiUtils<InternalWalletConnector>;
18
18
  walletConnectorExtensions?: WalletConnectorExtension[];
19
19
  };
20
- export declare const useWalletConnectorOptions: ({ projectSettings, appLogoUrl, appName, coinbaseWalletPreference, deepLinkPreference, flowNetwork, mobileExperience, networkConfigurations, walletBook, walletUiUtils, walletConnectorsProp, walletConnectPreferredChains, walletConnectorExtensions, }: Props) => {
20
+ export declare const useCreateWalletConnectorOptions: ({ projectSettings, appLogoUrl, appName, coinbaseWalletPreference, deepLinkPreference, flowNetwork, mobileExperience, networkConfigurations, walletBook, walletUiUtils, walletConnectorsProp, walletConnectPreferredChains, walletConnectorExtensions, }: Props) => {
21
21
  walletConnectorOptions: import("../../../shared").WalletOption[];
22
22
  };
23
23
  export {};
@@ -24,7 +24,7 @@ import '../../../store/state/projectSettings/projectSettings.js';
24
24
  import { setWalletConnectorOptions } from '../../../store/state/walletConnectorOptions.js';
25
25
  import { verifyRequiredConnectorsAreSetup } from './utils/verifyRequiredConnectorsAreSetup/verifyRequiredConnectorsAreSetup.js';
26
26
 
27
- const useWalletConnectorOptions = ({ projectSettings, appLogoUrl, appName, coinbaseWalletPreference, deepLinkPreference, flowNetwork, mobileExperience, networkConfigurations, walletBook, walletUiUtils, walletConnectorsProp, walletConnectPreferredChains, walletConnectorExtensions, }) => {
27
+ const useCreateWalletConnectorOptions = ({ projectSettings, appLogoUrl, appName, coinbaseWalletPreference, deepLinkPreference, flowNetwork, mobileExperience, networkConfigurations, walletBook, walletUiUtils, walletConnectorsProp, walletConnectPreferredChains, walletConnectorExtensions, }) => {
28
28
  const walletConnectorsKey = useMemo(() => { var _a; return (_a = serializeWalletConnectors(walletConnectorsProp)) === null || _a === void 0 ? void 0 : _a.join(','); }, [walletConnectorsProp]);
29
29
  const walletBookLength = useMemo(() => Object.keys(walletBook !== null && walletBook !== void 0 ? walletBook : {}).length, [walletBook]);
30
30
  const walletConnectorOptions = useMemo(() => {
@@ -71,4 +71,4 @@ const useWalletConnectorOptions = ({ projectSettings, appLogoUrl, appName, coinb
71
71
  return { walletConnectorOptions };
72
72
  };
73
73
 
74
- export { useWalletConnectorOptions };
74
+ export { useCreateWalletConnectorOptions };
@@ -98,17 +98,26 @@ const useTurnkey = () => {
98
98
  const { createDynamicEmbeddedWalletMutation } = useCreateDynamicEmbeddedWalletMutation.useCreateDynamicEmbeddedWalletMutation();
99
99
  const { getEOAWallet } = useSmartWallets.useSmartWallets();
100
100
  const startHeadlessEmbeddedWalletCreationFlow = React.useCallback((chains, options) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
101
- yield createDynamicEmbeddedWalletMutation({
102
- chains,
103
- environmentId,
104
- options,
105
- walletConnectorOptions,
106
- withAuthenticator: false,
107
- });
108
- setShowAuthFlow(false, { performMultiWalletChecks: false }); // close email otp pin modal
109
101
  return new Promise((resolve, reject) => {
110
- dynamicEvents.dynamicEvents.once('embeddedWalletCreated', (wallet) => resolve(wallet));
102
+ // register the event listeners before calling create embedded wallet
103
+ // as the event might fire before the listeners are registered.
104
+ dynamicEvents.dynamicEvents.once('embeddedWalletCreated', (wallet) => {
105
+ resolve(wallet);
106
+ });
111
107
  dynamicEvents.dynamicEvents.once('embeddedWalletFailed', (error) => reject(error));
108
+ createDynamicEmbeddedWalletMutation({
109
+ chains,
110
+ environmentId,
111
+ options,
112
+ walletConnectorOptions,
113
+ withAuthenticator: false,
114
+ })
115
+ .then(() => {
116
+ setShowAuthFlow(false, { performMultiWalletChecks: false }); // close email otp pin modal
117
+ })
118
+ .catch((error) => {
119
+ reject(error);
120
+ });
112
121
  });
113
122
  }), [
114
123
  createDynamicEmbeddedWalletMutation,
@@ -94,17 +94,26 @@ const useTurnkey = () => {
94
94
  const { createDynamicEmbeddedWalletMutation } = useCreateDynamicEmbeddedWalletMutation();
95
95
  const { getEOAWallet } = useSmartWallets();
96
96
  const startHeadlessEmbeddedWalletCreationFlow = useCallback((chains, options) => __awaiter(void 0, void 0, void 0, function* () {
97
- yield createDynamicEmbeddedWalletMutation({
98
- chains,
99
- environmentId,
100
- options,
101
- walletConnectorOptions,
102
- withAuthenticator: false,
103
- });
104
- setShowAuthFlow(false, { performMultiWalletChecks: false }); // close email otp pin modal
105
97
  return new Promise((resolve, reject) => {
106
- dynamicEvents.once('embeddedWalletCreated', (wallet) => resolve(wallet));
98
+ // register the event listeners before calling create embedded wallet
99
+ // as the event might fire before the listeners are registered.
100
+ dynamicEvents.once('embeddedWalletCreated', (wallet) => {
101
+ resolve(wallet);
102
+ });
107
103
  dynamicEvents.once('embeddedWalletFailed', (error) => reject(error));
104
+ createDynamicEmbeddedWalletMutation({
105
+ chains,
106
+ environmentId,
107
+ options,
108
+ walletConnectorOptions,
109
+ withAuthenticator: false,
110
+ })
111
+ .then(() => {
112
+ setShowAuthFlow(false, { performMultiWalletChecks: false }); // close email otp pin modal
113
+ })
114
+ .catch((error) => {
115
+ reject(error);
116
+ });
108
117
  });
109
118
  }), [
110
119
  createDynamicEmbeddedWalletMutation,
@@ -0,0 +1 @@
1
+ export { useNetworkConfigurationsFromProjectSettings } from './useNetworkConfigurationsFromProjectSettings';
@@ -0,0 +1,63 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var React = require('react');
7
+
8
+ const useNetworkConfigurationsFromProjectSettings = ({ projectSettings, cosmosNetworkOverrides, evmNetworksOverrides, }) => React.useMemo(() => {
9
+ var _a, _b, _c, _d;
10
+ const networks = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.networks;
11
+ if (!networks)
12
+ return {};
13
+ const evm = networks.find((configurations) => configurations.chainName === 'evm');
14
+ const solana = networks.find((configurations) => configurations.chainName === 'solana');
15
+ const cosmos = networks.find((configurations) => configurations.chainName === 'cosmos');
16
+ const starknet = networks.find((configurations) => configurations.chainName === 'starknet');
17
+ let cosmosNetworks = (_a = cosmos === null || cosmos === void 0 ? void 0 : cosmos.networks) === null || _a === void 0 ? void 0 : _a.map((net) => createNetwork(net, parseInt));
18
+ cosmosNetworks = overrideNetworks(cosmosNetworkOverrides, cosmosNetworks);
19
+ let evmNetworks = (_b = evm === null || evm === void 0 ? void 0 : evm.networks) === null || _b === void 0 ? void 0 : _b.map((net) => createNetwork(net, parseInt));
20
+ evmNetworks = overrideNetworks(evmNetworksOverrides, evmNetworks);
21
+ const starknetNetworks = (_c = starknet === null || starknet === void 0 ? void 0 : starknet.networks) === null || _c === void 0 ? void 0 : _c.map((net) => createNetwork(net));
22
+ const solanaNetworks = (_d = solana === null || solana === void 0 ? void 0 : solana.networks) === null || _d === void 0 ? void 0 : _d.map((net) => createNetwork(net));
23
+ if (evmNetworksOverrides) {
24
+ if (Array.isArray(evmNetworksOverrides)) {
25
+ evmNetworks = evmNetworksOverrides;
26
+ }
27
+ else {
28
+ evmNetworks = evmNetworksOverrides(evmNetworks !== null && evmNetworks !== void 0 ? evmNetworks : []);
29
+ }
30
+ }
31
+ const networkConfigurations = {
32
+ cosmos: cosmosNetworks,
33
+ evm: evmNetworks,
34
+ solana: solanaNetworks,
35
+ starknet: starknetNetworks,
36
+ };
37
+ return networkConfigurations;
38
+ }, [projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.networks, cosmosNetworkOverrides, evmNetworksOverrides]);
39
+ const createNetwork = (network, parser = (input) => input) => ({
40
+ blockExplorerUrls: network.blockExplorerUrls,
41
+ chainId: parser(network.chainId),
42
+ iconUrls: network.iconUrls,
43
+ lcdUrl: network.lcdUrl,
44
+ name: network.name,
45
+ nativeCurrency: network.nativeCurrency,
46
+ networkId: parser(network.networkId),
47
+ privateCustomerRpcUrls: network.privateCustomerRpcUrls,
48
+ rpcUrls: network.rpcUrls,
49
+ vanityName: network.vanityName,
50
+ });
51
+ const overrideNetworks = (networkOverrides, networks) => {
52
+ if (!networkOverrides) {
53
+ return networks;
54
+ }
55
+ if (Array.isArray(networkOverrides)) {
56
+ return networkOverrides;
57
+ }
58
+ else {
59
+ return networkOverrides(networks !== null && networks !== void 0 ? networks : []);
60
+ }
61
+ };
62
+
63
+ exports.useNetworkConfigurationsFromProjectSettings = useNetworkConfigurationsFromProjectSettings;
@@ -0,0 +1,9 @@
1
+ import { ProjectSettings } from '@dynamic-labs/sdk-api-core';
2
+ import { NetworksOverrides } from '../../../context/DynamicContext';
3
+ type UseNetworkConfigurationsFromProjectSettingsProps = {
4
+ projectSettings: ProjectSettings | undefined;
5
+ evmNetworksOverrides?: NetworksOverrides;
6
+ cosmosNetworkOverrides?: NetworksOverrides;
7
+ };
8
+ export declare const useNetworkConfigurationsFromProjectSettings: ({ projectSettings, cosmosNetworkOverrides, evmNetworksOverrides, }: UseNetworkConfigurationsFromProjectSettingsProps) => {};
9
+ export {};