Skip to content

Commit

Permalink
feat: Add chrysalis-mainnet option to network types
Browse files Browse the repository at this point in the history
  • Loading branch information
msarcev committed Oct 4, 2023
1 parent 0844050 commit 9862b0b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 14 deletions.
2 changes: 2 additions & 0 deletions api/src/models/db/networkType.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
const LEGACY_MAINNET = "legacy-mainnet";
const CHRYSALIS_MAINNET = "chrysalis-mainnet";
const MAINNET = "mainnet";
const DEVNET = "devnet";
export const SHIMMER = "shimmer";
Expand All @@ -9,6 +10,7 @@ const CUSTOM = "custom";

const networkTypes = [
LEGACY_MAINNET,
CHRYSALIS_MAINNET,
MAINNET,
DEVNET,
SHIMMER,
Expand Down
3 changes: 2 additions & 1 deletion client/src/app/AppUtils.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { ReactNode } from "react";
import { Helmet } from "react-helmet";
import { INetwork } from "../models/config/INetwork";
import { ALPHANET, DEVNET, LEGACY_MAINNET, MAINNET, NetworkType, SHIMMER, TESTNET } from "../models/config/networkType";
import { ALPHANET, CHRYSALIS_MAINNET, DEVNET, LEGACY_MAINNET, MAINNET, NetworkType, SHIMMER, TESTNET } from "../models/config/networkType";
import { IOTA_UI, Theme } from "../models/config/uiTheme";
import { IReducedNodeInfo } from "../services/nodeInfoService";
import NetworkContext from "./context/NetworkContext";
Expand Down Expand Up @@ -85,6 +85,7 @@ export const buildMetaLabel = (network: NetworkType | undefined): string => {
switch (network) {
case MAINNET:
case LEGACY_MAINNET:
case CHRYSALIS_MAINNET:
case DEVNET:
metaLabel = "IOTA Tangle Explorer";
break;
Expand Down
16 changes: 9 additions & 7 deletions client/src/helpers/networkHelper.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {
ALPHANET, CUSTOM, DEVNET, LEGACY_MAINNET,
ALPHANET, CHRYSALIS_MAINNET, CUSTOM, DEVNET, LEGACY_MAINNET,
MAINNET, NetworkType, SHIMMER, TESTNET
} from "../models/config/networkType";
import { SHIMMER_UI, Theme } from "../models/config/uiTheme";
Expand All @@ -13,18 +13,20 @@ export const getNetworkOrder = (networkType: NetworkType) => {
switch (networkType) {
case MAINNET:
return 0;
case SHIMMER:
case CHRYSALIS_MAINNET:
return 1;
case TESTNET:
case SHIMMER:
return 2;
case ALPHANET:
case TESTNET:
return 3;
case LEGACY_MAINNET:
case ALPHANET:
return 4;
case DEVNET:
case LEGACY_MAINNET:
return 5;
default:
case DEVNET:
return 6;
default:
return 7;
}
};

Expand Down
14 changes: 8 additions & 6 deletions client/src/models/config/networkType.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable no-multi-spaces */
export const LEGACY_MAINNET = "legacy-mainnet";
export const CHRYSALIS_MAINNET = "chrysalis-mainnet";
export const MAINNET = "mainnet";
export const DEVNET = "devnet";
export const SHIMMER = "shimmer";
Expand All @@ -11,11 +12,12 @@ export const CUSTOM = "custom";
* The network type.
*/
export type NetworkType =
typeof LEGACY_MAINNET |
typeof MAINNET |
typeof DEVNET |
typeof SHIMMER |
typeof TESTNET |
typeof ALPHANET |
typeof LEGACY_MAINNET |
typeof CHRYSALIS_MAINNET |
typeof MAINNET |
typeof DEVNET |
typeof SHIMMER |
typeof TESTNET |
typeof ALPHANET |
typeof CUSTOM;

0 comments on commit 9862b0b

Please sign in to comment.