nits
This commit is contained in:
@@ -1,12 +1,15 @@
|
||||
import { ENDPOINTS, DEV_ENDPOINTS } from '@dydxprotocol/v4-localization';
|
||||
|
||||
const endpoints = import.meta.env.MODE === 'production' ? ENDPOINTS : DEV_ENDPOINTS;
|
||||
export const NETWORK_ENDPOINTS = import.meta.env.MODE === 'production' ? ENDPOINTS : DEV_ENDPOINTS;
|
||||
|
||||
export const CLIENT_NETWORK_CONFIGS: Record<string, (typeof endpoints.environments)[number]> =
|
||||
Object.fromEntries(
|
||||
endpoints.environments.map((environment) => [environment.environment, environment])
|
||||
);
|
||||
export const DEFAULT_APP_ENVIRONMENT = endpoints.defaultEnvironment;
|
||||
export const CLIENT_NETWORK_CONFIGS: Record<
|
||||
string,
|
||||
(typeof NETWORK_ENDPOINTS.environments)[number]
|
||||
> = Object.fromEntries(
|
||||
NETWORK_ENDPOINTS.environments.map((environment) => [environment.environment, environment])
|
||||
);
|
||||
|
||||
export const DEFAULT_APP_ENVIRONMENT = NETWORK_ENDPOINTS.defaultEnvironment;
|
||||
|
||||
export enum DydxV4Network {
|
||||
V4Mainnet = 'dydxprotocol-mainnet',
|
||||
|
||||
@@ -72,7 +72,9 @@ class AbacusStateManager {
|
||||
|
||||
this.stateManager = new AsyncAbacusStateManager(
|
||||
import.meta.env.SHARED_RESOURCES_URI,
|
||||
'config/staging/environments.json',
|
||||
import.meta.env.MODE === 'production'
|
||||
? 'config/prod/endpoints.json'
|
||||
: 'config/staging/dev_endpoints.json',
|
||||
ioImplementations,
|
||||
uiImplementations,
|
||||
// @ts-ignore
|
||||
|
||||
@@ -40,11 +40,11 @@ class AbacusStateNotifier implements AbacusStateNotificationProtocol {
|
||||
}
|
||||
|
||||
environmentsChanged(): void {
|
||||
console.log('environments changed');
|
||||
return;
|
||||
}
|
||||
|
||||
notificationsChanged(notifications: kollections.List<AbacusNotification>): void {
|
||||
console.log(notifications.toArray());
|
||||
return;
|
||||
}
|
||||
|
||||
stateChanged(
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
import { ENDPOINTS, DEV_ENDPOINTS } from '@dydxprotocol/v4-localization';
|
||||
|
||||
import { type MenuItem } from '@/constants/menus';
|
||||
import { DydxNetwork } from '@/constants/networks';
|
||||
import { type DydxNetwork, NETWORK_ENDPOINTS } from '@/constants/networks';
|
||||
import { useStringGetter } from '@/hooks';
|
||||
|
||||
export const useNetworks = (): MenuItem<DydxNetwork>[] => {
|
||||
const stringGetter = useStringGetter();
|
||||
|
||||
const environments =
|
||||
import.meta.env.MODE === 'production' ? ENDPOINTS.environments : DEV_ENDPOINTS.environments;
|
||||
|
||||
return environments.map(({ stringKey, environment }) => ({
|
||||
return NETWORK_ENDPOINTS.environments.map(({ stringKey, environment }) => ({
|
||||
key: environment,
|
||||
label: stringGetter({ key: stringKey }),
|
||||
value: environment,
|
||||
|
||||
Reference in New Issue
Block a user