From 7b13c2e72df69fbdf2e2ccbb113b1cb566d9ce7c Mon Sep 17 00:00:00 2001 From: Eval EXEC Date: Thu, 5 Sep 2024 15:33:06 +0800 Subject: [PATCH] Add NetworkType::Preview Signed-off-by: Eval EXEC --- src/constants.rs | 1 + src/types/network_type.rs | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/constants.rs b/src/constants.rs index 0ed38ce3..59eca08b 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -6,6 +6,7 @@ pub const PREFIX_TESTNET: &str = "ckt"; pub const NETWORK_MAINNET: &str = "ckb"; pub const NETWORK_TESTNET: &str = "ckb_testnet"; pub const NETWORK_STAGING: &str = "ckb_staging"; +pub const NETWORK_PREVIEW: &str = "ckb_preview"; pub const NETWORK_DEV: &str = "ckb_dev"; pub const SECP_SIGNATURE_SIZE: usize = 65; diff --git a/src/types/network_type.rs b/src/types/network_type.rs index 2d92b78d..8c66c2c9 100644 --- a/src/types/network_type.rs +++ b/src/types/network_type.rs @@ -3,7 +3,7 @@ use std::fmt; use serde_derive::{Deserialize, Serialize}; use crate::constants::{ - NETWORK_DEV, NETWORK_MAINNET, NETWORK_STAGING, NETWORK_TESTNET, PREFIX_MAINNET, PREFIX_TESTNET, + NETWORK_DEV, NETWORK_MAINNET, NETWORK_STAGING, NETWORK_TESTNET,NETWORK_PREVIEW, PREFIX_MAINNET, PREFIX_TESTNET, }; #[derive(Hash, Eq, PartialEq, Debug, Clone, Copy, Serialize, Deserialize)] @@ -11,6 +11,7 @@ pub enum NetworkType { Mainnet, Testnet, Staging, + Preview, Dev, } @@ -28,6 +29,7 @@ impl NetworkType { NetworkType::Mainnet => PREFIX_MAINNET, NetworkType::Testnet => PREFIX_TESTNET, NetworkType::Staging => PREFIX_TESTNET, + NetworkType::Preview => PREFIX_TESTNET, NetworkType::Dev => PREFIX_TESTNET, } } @@ -37,6 +39,7 @@ impl NetworkType { NETWORK_MAINNET => Some(NetworkType::Mainnet), NETWORK_TESTNET => Some(NetworkType::Testnet), NETWORK_STAGING => Some(NetworkType::Staging), + NETWORK_PREVIEW => Some(NetworkType::Preview), NETWORK_DEV => Some(NetworkType::Dev), _ => None, } @@ -47,6 +50,7 @@ impl NetworkType { NetworkType::Mainnet => NETWORK_MAINNET, NetworkType::Testnet => NETWORK_TESTNET, NetworkType::Staging => NETWORK_STAGING, + NetworkType::Preview => NETWORK_PREVIEW, NetworkType::Dev => NETWORK_DEV, } } @@ -73,6 +77,7 @@ impl NetworkInfo { NetworkType::Mainnet => Some(Self::mainnet()), NetworkType::Testnet => Some(Self::testnet()), NetworkType::Staging => None, + NetworkType::Preview => None, NetworkType::Dev => None, } }