@dynamic-labs/sdk-react-core 3.0.0-alpha.51 → 3.0.0-alpha.52
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 +12 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +13 -13
- package/src/lib/context/DynamicContext/DynamicContext.cjs +5 -4
- package/src/lib/context/DynamicContext/DynamicContext.js +5 -4
- package/src/lib/context/DynamicContext/types/SettingsOverrides.d.ts +3 -2
- package/src/lib/store/hooks/useNetworkConfigurations/useNetworkConfigurations.cjs +19 -4
- package/src/lib/store/hooks/useNetworkConfigurations/useNetworkConfigurations.d.ts +4 -3
- package/src/lib/store/hooks/useNetworkConfigurations/useNetworkConfigurations.js +19 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
|
|
2
|
+
## [3.0.0-alpha.52](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.51...v3.0.0-alpha.52) (2024-08-28)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add support for custom keplr chains ([#6635](https://github.com/dynamic-labs/DynamicAuth/issues/6635)) ([f0aa2da](https://github.com/dynamic-labs/DynamicAuth/commit/f0aa2dac2a2b259d145ff52174da7cc6ef963182))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* better error handling on solana transaction decoding ([#6731](https://github.com/dynamic-labs/DynamicAuth/issues/6731)) ([a71af86](https://github.com/dynamic-labs/DynamicAuth/commit/a71af869395c9b99c04f0cac78a73e1b2b17bafe))
|
|
13
|
+
|
|
2
14
|
## [3.0.0-alpha.51](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.50...v3.0.0-alpha.51) (2024-08-23)
|
|
3
15
|
|
|
4
16
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.52",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
|
|
@@ -17,18 +17,18 @@
|
|
|
17
17
|
"react-i18next": "13.5.0",
|
|
18
18
|
"yup": "0.32.11",
|
|
19
19
|
"react-international-phone": "4.2.5",
|
|
20
|
-
"@dynamic-labs/ethereum-core": "3.0.0-alpha.
|
|
21
|
-
"@dynamic-labs/global-wallet": "3.0.0-alpha.
|
|
22
|
-
"@dynamic-labs/iconic": "3.0.0-alpha.
|
|
23
|
-
"@dynamic-labs/logger": "3.0.0-alpha.
|
|
24
|
-
"@dynamic-labs/message-transport": "3.0.0-alpha.
|
|
25
|
-
"@dynamic-labs/multi-wallet": "3.0.0-alpha.
|
|
26
|
-
"@dynamic-labs/rpc-providers": "3.0.0-alpha.
|
|
27
|
-
"@dynamic-labs/store": "3.0.0-alpha.
|
|
28
|
-
"@dynamic-labs/types": "3.0.0-alpha.
|
|
29
|
-
"@dynamic-labs/utils": "3.0.0-alpha.
|
|
30
|
-
"@dynamic-labs/wallet-book": "3.0.0-alpha.
|
|
31
|
-
"@dynamic-labs/wallet-connector-core": "3.0.0-alpha.
|
|
20
|
+
"@dynamic-labs/ethereum-core": "3.0.0-alpha.52",
|
|
21
|
+
"@dynamic-labs/global-wallet": "3.0.0-alpha.52",
|
|
22
|
+
"@dynamic-labs/iconic": "3.0.0-alpha.52",
|
|
23
|
+
"@dynamic-labs/logger": "3.0.0-alpha.52",
|
|
24
|
+
"@dynamic-labs/message-transport": "3.0.0-alpha.52",
|
|
25
|
+
"@dynamic-labs/multi-wallet": "3.0.0-alpha.52",
|
|
26
|
+
"@dynamic-labs/rpc-providers": "3.0.0-alpha.52",
|
|
27
|
+
"@dynamic-labs/store": "3.0.0-alpha.52",
|
|
28
|
+
"@dynamic-labs/types": "3.0.0-alpha.52",
|
|
29
|
+
"@dynamic-labs/utils": "3.0.0-alpha.52",
|
|
30
|
+
"@dynamic-labs/wallet-book": "3.0.0-alpha.52",
|
|
31
|
+
"@dynamic-labs/wallet-connector-core": "3.0.0-alpha.52",
|
|
32
32
|
"eventemitter3": "5.0.1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
@@ -145,7 +145,7 @@ const PUBLIC_PROJECT_LIVE_ENVIRONMENT_ID = '2762a57b-faa4-41ce-9f16-abff9300e2c9
|
|
|
145
145
|
const DynamicContext = React.createContext(undefined);
|
|
146
146
|
/** The context provider itself we only use internally */
|
|
147
147
|
const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, locale: locale$1, enableInstrumentation = false, }) => {
|
|
148
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
148
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
149
149
|
const { accessDeniedMessagePrimary, accessDeniedMessageSecondary, accessDeniedButton, defaultPhoneInputIso2, apiBaseUrl, coinbaseWalletPreference, enableConnectOnlyFallback = false, deepLinkPreference: deepLinkPreferenceProp = 'native', bridgeChains, cssOverrides, defaultNumberOfWalletsToShow = values.DEFAULT_NUMBER_OF_WALLETS_TO_SHOW, flowNetwork, initialAuthenticationMode = 'connect-and-sign', debugError = false, displaySiweStatement = true, newToWeb3WalletChainMap, enableVisitTrackingOnConnectOnly = true, environmentId, walletsFilter, logLevel = 'WARN', mobileExperience, notInTheListImageUrl, onboardingImageUrl, policiesConsentInnerComponent, customPrivacyPolicy, privacyPolicyUrl, signWithEmailWalletName, socialMediaLinkText, socialMediaIconUrl, socialMediaUrl, customTermsOfServices, termsOfServiceUrl, toolkitEnabled, siweStatement, shadowDOMEnabled = true, walletConnectors: walletConnectorsProp, socialProvidersFilter, showLockedWalletView = false, walletConnectPreferredChains, walletConnectorExtensions, recommendedWallets, hideEmbeddedWalletTransactionUIs, handlers, headless = false, } = settings$1;
|
|
150
150
|
localStorage.LocalStorage.setSuffix(settings$1.localStorageSuffix);
|
|
151
151
|
/**
|
|
@@ -227,8 +227,9 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
227
227
|
const [legacyIsVerifying, setLegacyIsVerifying] = React.useState(false);
|
|
228
228
|
const walletBook$1 = walletBook.useWalletBookCdn();
|
|
229
229
|
const { networkConfigurations: serverNetworkConfigurations } = useNetworkConfigurations.useNetworkConfigurations({
|
|
230
|
+
cosmosNetworkOverrides: (_k = settings$1.overrides) === null || _k === void 0 ? void 0 : _k.cosmosNetworks,
|
|
230
231
|
environmentId,
|
|
231
|
-
evmNetworksOverrides: (
|
|
232
|
+
evmNetworksOverrides: (_l = settings$1.overrides) === null || _l === void 0 ? void 0 : _l.evmNetworks,
|
|
232
233
|
projectSettings,
|
|
233
234
|
});
|
|
234
235
|
const { imageUserInAccessList, imageUserNotInAccessList, displayName, appLogo, } = (projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general) || {};
|
|
@@ -240,7 +241,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
240
241
|
appLogoUrl,
|
|
241
242
|
appName,
|
|
242
243
|
getAppOrigin: () => window.location.origin,
|
|
243
|
-
hideEmbeddedWalletTransactionUIs: hideEmbeddedWalletTransactionUIs !== null && hideEmbeddedWalletTransactionUIs !== void 0 ? hideEmbeddedWalletTransactionUIs : !((
|
|
244
|
+
hideEmbeddedWalletTransactionUIs: hideEmbeddedWalletTransactionUIs !== null && hideEmbeddedWalletTransactionUIs !== void 0 ? hideEmbeddedWalletTransactionUIs : !((_o = (_m = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _m === void 0 ? void 0 : _m.embeddedWallets) === null || _o === void 0 ? void 0 : _o.showEmbeddedWalletActionsUI),
|
|
244
245
|
});
|
|
245
246
|
const { walletConnectorOptions } = useWalletConnectorOptions.useWalletConnectorOptions({
|
|
246
247
|
appLogoUrl,
|
|
@@ -717,7 +718,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
717
718
|
}
|
|
718
719
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
719
720
|
}, [multiWallet, multiWalletWidgetState, showDynamicUserProfile]);
|
|
720
|
-
return (jsxRuntime.jsx(reactI18next.I18nextProvider, { i18n: i18nSDKInstance, children: jsxRuntime.jsx(DynamicContext.Provider, { value: value, children: jsxRuntime.jsx(walletBook.WalletBookContextProvider, { walletBook: walletBook$1, children: jsxRuntime.jsx(ThemeContext.ThemeContextProvider, { customerTheme: parseTheme.parseTheme(theme, ((
|
|
721
|
+
return (jsxRuntime.jsx(reactI18next.I18nextProvider, { i18n: i18nSDKInstance, children: jsxRuntime.jsx(DynamicContext.Provider, { value: value, children: jsxRuntime.jsx(walletBook.WalletBookContextProvider, { walletBook: walletBook$1, children: jsxRuntime.jsx(ThemeContext.ThemeContextProvider, { customerTheme: parseTheme.parseTheme(theme, ((_p = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _p === void 0 ? void 0 : _p.modal) || undefined), designSettings: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design, children: jsxRuntime.jsx(LoadingContext.LoadingContextProvider, { children: jsxRuntime.jsxs(ViewContext.ViewContextProvider, { initialView: helpers.getInitialView({
|
|
721
722
|
bridgeOnboardingCompleted,
|
|
722
723
|
connectedWallets,
|
|
723
724
|
isAuthenticated: isAuthenticated || Boolean(primaryWallet),
|
|
@@ -141,7 +141,7 @@ const PUBLIC_PROJECT_LIVE_ENVIRONMENT_ID = '2762a57b-faa4-41ce-9f16-abff9300e2c9
|
|
|
141
141
|
const DynamicContext = createContext(undefined);
|
|
142
142
|
/** The context provider itself we only use internally */
|
|
143
143
|
const InnerDynamicContextProvider = ({ children, theme, settings, locale, enableInstrumentation = false, }) => {
|
|
144
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
144
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
145
145
|
const { accessDeniedMessagePrimary, accessDeniedMessageSecondary, accessDeniedButton, defaultPhoneInputIso2, apiBaseUrl, coinbaseWalletPreference, enableConnectOnlyFallback = false, deepLinkPreference: deepLinkPreferenceProp = 'native', bridgeChains, cssOverrides, defaultNumberOfWalletsToShow = DEFAULT_NUMBER_OF_WALLETS_TO_SHOW, flowNetwork, initialAuthenticationMode = 'connect-and-sign', debugError = false, displaySiweStatement = true, newToWeb3WalletChainMap, enableVisitTrackingOnConnectOnly = true, environmentId, walletsFilter, logLevel = 'WARN', mobileExperience, notInTheListImageUrl, onboardingImageUrl, policiesConsentInnerComponent, customPrivacyPolicy, privacyPolicyUrl, signWithEmailWalletName, socialMediaLinkText, socialMediaIconUrl, socialMediaUrl, customTermsOfServices, termsOfServiceUrl, toolkitEnabled, siweStatement, shadowDOMEnabled = true, walletConnectors: walletConnectorsProp, socialProvidersFilter, showLockedWalletView = false, walletConnectPreferredChains, walletConnectorExtensions, recommendedWallets, hideEmbeddedWalletTransactionUIs, handlers, headless = false, } = settings;
|
|
146
146
|
LocalStorage.setSuffix(settings.localStorageSuffix);
|
|
147
147
|
/**
|
|
@@ -223,8 +223,9 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, enable
|
|
|
223
223
|
const [legacyIsVerifying, setLegacyIsVerifying] = useState(false);
|
|
224
224
|
const walletBook = useWalletBookCdn();
|
|
225
225
|
const { networkConfigurations: serverNetworkConfigurations } = useNetworkConfigurations({
|
|
226
|
+
cosmosNetworkOverrides: (_k = settings.overrides) === null || _k === void 0 ? void 0 : _k.cosmosNetworks,
|
|
226
227
|
environmentId,
|
|
227
|
-
evmNetworksOverrides: (
|
|
228
|
+
evmNetworksOverrides: (_l = settings.overrides) === null || _l === void 0 ? void 0 : _l.evmNetworks,
|
|
228
229
|
projectSettings,
|
|
229
230
|
});
|
|
230
231
|
const { imageUserInAccessList, imageUserNotInAccessList, displayName, appLogo, } = (projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general) || {};
|
|
@@ -236,7 +237,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, enable
|
|
|
236
237
|
appLogoUrl,
|
|
237
238
|
appName,
|
|
238
239
|
getAppOrigin: () => window.location.origin,
|
|
239
|
-
hideEmbeddedWalletTransactionUIs: hideEmbeddedWalletTransactionUIs !== null && hideEmbeddedWalletTransactionUIs !== void 0 ? hideEmbeddedWalletTransactionUIs : !((
|
|
240
|
+
hideEmbeddedWalletTransactionUIs: hideEmbeddedWalletTransactionUIs !== null && hideEmbeddedWalletTransactionUIs !== void 0 ? hideEmbeddedWalletTransactionUIs : !((_o = (_m = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _m === void 0 ? void 0 : _m.embeddedWallets) === null || _o === void 0 ? void 0 : _o.showEmbeddedWalletActionsUI),
|
|
240
241
|
});
|
|
241
242
|
const { walletConnectorOptions } = useWalletConnectorOptions({
|
|
242
243
|
appLogoUrl,
|
|
@@ -713,7 +714,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, enable
|
|
|
713
714
|
}
|
|
714
715
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
715
716
|
}, [multiWallet, multiWalletWidgetState, showDynamicUserProfile]);
|
|
716
|
-
return (jsx(I18nextProvider, { i18n: i18nSDKInstance, children: jsx(DynamicContext.Provider, { value: value, children: jsx(WalletBookContextProvider, { walletBook: walletBook, children: jsx(ThemeContextProvider, { customerTheme: parseTheme(theme, ((
|
|
717
|
+
return (jsx(I18nextProvider, { i18n: i18nSDKInstance, children: jsx(DynamicContext.Provider, { value: value, children: jsx(WalletBookContextProvider, { walletBook: walletBook, children: jsx(ThemeContextProvider, { customerTheme: parseTheme(theme, ((_p = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _p === void 0 ? void 0 : _p.modal) || undefined), designSettings: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design, children: jsx(LoadingContextProvider, { children: jsxs(ViewContextProvider, { initialView: getInitialView({
|
|
717
718
|
bridgeOnboardingCompleted,
|
|
718
719
|
connectedWallets,
|
|
719
720
|
isAuthenticated: isAuthenticated || Boolean(primaryWallet),
|
|
@@ -9,7 +9,7 @@ export type WalletListViewSettings = {
|
|
|
9
9
|
items: WalletListViewTabItem[];
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
|
-
export type
|
|
12
|
+
export type NetworksOverrides = GenericNetwork[] | ((dashboardNetworks: GenericNetwork[]) => GenericNetwork[]);
|
|
13
13
|
export type ViewsOverrides = SdkView | WalletListViewSettings;
|
|
14
14
|
export type SettingsOverrides = {
|
|
15
15
|
views?: Array<ViewsOverrides>;
|
|
@@ -22,7 +22,8 @@ export type SettingsOverrides = {
|
|
|
22
22
|
* WARNING: this callback must be memoized as it will be used in a dependency array to ensure
|
|
23
23
|
* the SDK can react to this value changing (for ex, toggling a chain off).
|
|
24
24
|
*/
|
|
25
|
-
evmNetworks?:
|
|
25
|
+
evmNetworks?: NetworksOverrides;
|
|
26
|
+
cosmosNetworks?: NetworksOverrides;
|
|
26
27
|
/**
|
|
27
28
|
* Allows overriding the multi-wallet feature from the dashboard.
|
|
28
29
|
*/
|
|
@@ -103,7 +103,18 @@ const createNetwork = (network, parser = (input) => input) => ({
|
|
|
103
103
|
rpcUrls: network.rpcUrls,
|
|
104
104
|
vanityName: network.vanityName,
|
|
105
105
|
});
|
|
106
|
-
const
|
|
106
|
+
const overrideNetworks = (networkOverrides, networks) => {
|
|
107
|
+
if (!networkOverrides) {
|
|
108
|
+
return networks;
|
|
109
|
+
}
|
|
110
|
+
if (Array.isArray(networkOverrides)) {
|
|
111
|
+
return networkOverrides;
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
return networkOverrides(networks !== null && networks !== void 0 ? networks : []);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
const useNetworkConfigurations = ({ environmentId, projectSettings, evmNetworksOverrides, cosmosNetworkOverrides, }) => {
|
|
107
118
|
const storedNetworks = useStoreWithSelector.useStoreWithSelector(store.getStore(), ({ networkConfigurations }) => networkConfigurations);
|
|
108
119
|
const { isLoading } = usePromise.usePromise(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
109
120
|
var _a, _b, _c, _d;
|
|
@@ -114,15 +125,19 @@ const useNetworkConfigurations = ({ environmentId, projectSettings, evmNetworksO
|
|
|
114
125
|
const solana = networks.find((configurations) => configurations.chainName === 'solana');
|
|
115
126
|
const cosmos = networks.find((configurations) => configurations.chainName === 'cosmos');
|
|
116
127
|
const starknet = networks.find((configurations) => configurations.chainName === 'starknet');
|
|
117
|
-
|
|
128
|
+
let cosmosNetworks = (_a = cosmos === null || cosmos === void 0 ? void 0 : cosmos.networks) === null || _a === void 0 ? void 0 : _a.map((net) => createNetwork(net, parseInt));
|
|
129
|
+
cosmosNetworks = overrideNetworks(cosmosNetworkOverrides, cosmosNetworks);
|
|
118
130
|
let evmNetworks = (_b = evm === null || evm === void 0 ? void 0 : evm.networks) === null || _b === void 0 ? void 0 : _b.map((net) => createNetwork(net, parseInt));
|
|
131
|
+
evmNetworks = overrideNetworks(evmNetworksOverrides, evmNetworks);
|
|
119
132
|
const starknetNetworks = (_c = starknet === null || starknet === void 0 ? void 0 : starknet.networks) === null || _c === void 0 ? void 0 : _c.map((net) => createNetwork(net));
|
|
120
133
|
const solanaNetworks = (_d = solana === null || solana === void 0 ? void 0 : solana.networks) === null || _d === void 0 ? void 0 : _d.map((net) => createNetwork(net));
|
|
121
134
|
if (evmNetworksOverrides) {
|
|
122
|
-
if (Array.isArray(evmNetworksOverrides))
|
|
135
|
+
if (Array.isArray(evmNetworksOverrides)) {
|
|
123
136
|
evmNetworks = evmNetworksOverrides;
|
|
124
|
-
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
125
139
|
evmNetworks = evmNetworksOverrides(evmNetworks !== null && evmNetworks !== void 0 ? evmNetworks : []);
|
|
140
|
+
}
|
|
126
141
|
}
|
|
127
142
|
return Promise.resolve({
|
|
128
143
|
cosmos: cosmosNetworks,
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { ProjectSettings } from '@dynamic-labs/sdk-api-core';
|
|
2
2
|
import { NetworkConfigurationMap } from '@dynamic-labs/types';
|
|
3
|
-
import {
|
|
3
|
+
import { NetworksOverrides } from '../../../context/DynamicContext/types';
|
|
4
4
|
export type UseNetworkConfigurationsProps = {
|
|
5
5
|
environmentId: string;
|
|
6
6
|
projectSettings?: ProjectSettings;
|
|
7
|
-
evmNetworksOverrides?:
|
|
7
|
+
evmNetworksOverrides?: NetworksOverrides;
|
|
8
|
+
cosmosNetworkOverrides?: NetworksOverrides;
|
|
8
9
|
};
|
|
9
|
-
export declare const useNetworkConfigurations: ({ environmentId, projectSettings, evmNetworksOverrides, }: UseNetworkConfigurationsProps) => {
|
|
10
|
+
export declare const useNetworkConfigurations: ({ environmentId, projectSettings, evmNetworksOverrides, cosmosNetworkOverrides, }: UseNetworkConfigurationsProps) => {
|
|
10
11
|
isLoading: boolean;
|
|
11
12
|
networkConfigurations: NetworkConfigurationMap | undefined;
|
|
12
13
|
};
|
|
@@ -99,7 +99,18 @@ const createNetwork = (network, parser = (input) => input) => ({
|
|
|
99
99
|
rpcUrls: network.rpcUrls,
|
|
100
100
|
vanityName: network.vanityName,
|
|
101
101
|
});
|
|
102
|
-
const
|
|
102
|
+
const overrideNetworks = (networkOverrides, networks) => {
|
|
103
|
+
if (!networkOverrides) {
|
|
104
|
+
return networks;
|
|
105
|
+
}
|
|
106
|
+
if (Array.isArray(networkOverrides)) {
|
|
107
|
+
return networkOverrides;
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
return networkOverrides(networks !== null && networks !== void 0 ? networks : []);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
const useNetworkConfigurations = ({ environmentId, projectSettings, evmNetworksOverrides, cosmosNetworkOverrides, }) => {
|
|
103
114
|
const storedNetworks = useStoreWithSelector(getStore(), ({ networkConfigurations }) => networkConfigurations);
|
|
104
115
|
const { isLoading } = usePromise(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
105
116
|
var _a, _b, _c, _d;
|
|
@@ -110,15 +121,19 @@ const useNetworkConfigurations = ({ environmentId, projectSettings, evmNetworksO
|
|
|
110
121
|
const solana = networks.find((configurations) => configurations.chainName === 'solana');
|
|
111
122
|
const cosmos = networks.find((configurations) => configurations.chainName === 'cosmos');
|
|
112
123
|
const starknet = networks.find((configurations) => configurations.chainName === 'starknet');
|
|
113
|
-
|
|
124
|
+
let cosmosNetworks = (_a = cosmos === null || cosmos === void 0 ? void 0 : cosmos.networks) === null || _a === void 0 ? void 0 : _a.map((net) => createNetwork(net, parseInt));
|
|
125
|
+
cosmosNetworks = overrideNetworks(cosmosNetworkOverrides, cosmosNetworks);
|
|
114
126
|
let evmNetworks = (_b = evm === null || evm === void 0 ? void 0 : evm.networks) === null || _b === void 0 ? void 0 : _b.map((net) => createNetwork(net, parseInt));
|
|
127
|
+
evmNetworks = overrideNetworks(evmNetworksOverrides, evmNetworks);
|
|
115
128
|
const starknetNetworks = (_c = starknet === null || starknet === void 0 ? void 0 : starknet.networks) === null || _c === void 0 ? void 0 : _c.map((net) => createNetwork(net));
|
|
116
129
|
const solanaNetworks = (_d = solana === null || solana === void 0 ? void 0 : solana.networks) === null || _d === void 0 ? void 0 : _d.map((net) => createNetwork(net));
|
|
117
130
|
if (evmNetworksOverrides) {
|
|
118
|
-
if (Array.isArray(evmNetworksOverrides))
|
|
131
|
+
if (Array.isArray(evmNetworksOverrides)) {
|
|
119
132
|
evmNetworks = evmNetworksOverrides;
|
|
120
|
-
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
121
135
|
evmNetworks = evmNetworksOverrides(evmNetworks !== null && evmNetworks !== void 0 ? evmNetworks : []);
|
|
136
|
+
}
|
|
122
137
|
}
|
|
123
138
|
return Promise.resolve({
|
|
124
139
|
cosmos: cosmosNetworks,
|