diff --git a/src/constants.rs b/src/constants.rs index 0ed38ce..59eca08 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/test_util.rs b/src/test_util.rs index cffecd1..77f5f1b 100644 --- a/src/test_util.rs +++ b/src/test_util.rs @@ -355,7 +355,8 @@ impl Context { /// Run all scripts in the transaction in ckb-vm pub fn verify_scripts(&self, tx: TransactionView) -> Result { let mock_tx = self.to_mock_tx(tx.data()); - let resource = Resource::from_both(&mock_tx, &mut DummyLoader).map_err(Error::VerifyScript)?; + let resource = + Resource::from_both(&mock_tx, &mut DummyLoader).map_err(Error::VerifyScript)?; let rtx = resolve_transaction(tx, &mut HashSet::new(), &resource, &resource) .map_err(|err| Error::VerifyScript(format!("Resolve transaction error: {:?}", err)))?; let consensus = ConsensusBuilder::default() diff --git a/src/types/network_type.rs b/src/types/network_type.rs index 2d92b78..95ba27a 100644 --- a/src/types/network_type.rs +++ b/src/types/network_type.rs @@ -3,7 +3,8 @@ 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_PREVIEW, NETWORK_STAGING, NETWORK_TESTNET, + PREFIX_MAINNET, PREFIX_TESTNET, }; #[derive(Hash, Eq, PartialEq, Debug, Clone, Copy, Serialize, Deserialize)] @@ -11,6 +12,7 @@ pub enum NetworkType { Mainnet, Testnet, Staging, + Preview, Dev, } @@ -28,6 +30,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 +40,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 +51,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 +78,7 @@ impl NetworkInfo { NetworkType::Mainnet => Some(Self::mainnet()), NetworkType::Testnet => Some(Self::testnet()), NetworkType::Staging => None, + NetworkType::Preview => None, NetworkType::Dev => None, } }