From 105aa44668d89dfd1c5635456ed13b002fd9602c Mon Sep 17 00:00:00 2001 From: Mario Sarcevic Date: Mon, 13 May 2024 11:57:00 +0200 Subject: [PATCH] chore: Add new network type --- api/src/models/db/networkType.ts | 2 ++ client/src/app/AppUtils.tsx | 15 +++++++++++++-- client/src/helpers/networkHelper.ts | 4 +++- client/src/models/config/networkType.ts | 2 ++ 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/api/src/models/db/networkType.ts b/api/src/models/db/networkType.ts index 0aed62d29..9e7a069eb 100644 --- a/api/src/models/db/networkType.ts +++ b/api/src/models/db/networkType.ts @@ -7,6 +7,7 @@ export const SHIMMER = "shimmer"; const TESTNET = "testnet"; const IOTA_TESTNET = "iota-testnet"; const SHIMMER_TESTNET = "shimmer-testnet"; +const IOTA2_TESTNET = "iota2-testnet"; const ALPHANET = "alphanet"; const CUSTOM = "custom"; @@ -19,6 +20,7 @@ const networkTypes = [ TESTNET, IOTA_TESTNET, SHIMMER_TESTNET, + IOTA2_TESTNET, ALPHANET, CUSTOM, ] as const; diff --git a/client/src/app/AppUtils.tsx b/client/src/app/AppUtils.tsx index 959576e86..5002ca030 100644 --- a/client/src/app/AppUtils.tsx +++ b/client/src/app/AppUtils.tsx @@ -2,7 +2,17 @@ import React, { ReactNode } from "react"; import { Helmet } from "react-helmet"; import NetworkContext from "./context/NetworkContext"; import { INetwork } from "~models/config/INetwork"; -import { ALPHANET, CHRYSALIS_MAINNET, DEVNET, LEGACY_MAINNET, MAINNET, NetworkType, SHIMMER, TESTNET } from "~models/config/networkType"; +import { + ALPHANET, + CHRYSALIS_MAINNET, + DEVNET, + IOTA2_TESTNET, + LEGACY_MAINNET, + MAINNET, + NetworkType, + SHIMMER, + TESTNET, +} from "~models/config/networkType"; import { IOTA_UI, Theme } from "~models/config/uiTheme"; import { IStardustNodeInfo } from "~services/stardust/nodeInfoService"; import { ServiceFactory } from "~/factories/serviceFactory"; @@ -132,7 +142,8 @@ export const buildMetaLabel = (network: NetworkType | undefined): string => { metaLabel = "Shimmer Explorer"; break; } - case TESTNET: { + case TESTNET: + case IOTA2_TESTNET: { metaLabel = "Testnet Explorer"; break; } diff --git a/client/src/helpers/networkHelper.ts b/client/src/helpers/networkHelper.ts index 96812d5db..ff5e14aff 100644 --- a/client/src/helpers/networkHelper.ts +++ b/client/src/helpers/networkHelper.ts @@ -3,6 +3,7 @@ import { CHRYSALIS_MAINNET, CUSTOM, DEVNET, + IOTA2_TESTNET, IOTA_TESTNET, LEGACY_MAINNET, MAINNET, @@ -26,7 +27,8 @@ export const getNetworkOrder = (networkType: NetworkType) => { case SHIMMER: { return 1; } - case IOTA_TESTNET: { + case IOTA_TESTNET: + case IOTA2_TESTNET: { return 2; } case SHIMMER_TESTNET: { diff --git a/client/src/models/config/networkType.ts b/client/src/models/config/networkType.ts index 19a3d38b8..a5738542a 100644 --- a/client/src/models/config/networkType.ts +++ b/client/src/models/config/networkType.ts @@ -6,6 +6,7 @@ export const SHIMMER = "shimmer"; export const TESTNET = "testnet"; export const IOTA_TESTNET = "iota-testnet"; export const SHIMMER_TESTNET = "shimmer-testnet"; +export const IOTA2_TESTNET = "iota2-testnet"; export const ALPHANET = "alphanet"; export const CUSTOM = "custom"; @@ -20,6 +21,7 @@ export type NetworkType = | typeof SHIMMER | typeof TESTNET | typeof IOTA_TESTNET + | typeof IOTA2_TESTNET | typeof SHIMMER_TESTNET | typeof ALPHANET | typeof CUSTOM;