1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
// Copyright 2020 ChainSafe Systems // SPDX-License-Identifier: Apache-2.0, MIT use super::{MAINNET_PREFIX, TESTNET_PREFIX}; /// Network defines the preconfigured networks to use with address encoding #[derive(PartialEq, Eq, Copy, Clone, Debug, Hash)] pub enum Network { Mainnet, Testnet, } impl Default for Network { fn default() -> Self { Network::Testnet } } impl Network { /// to_prefix is used to convert the network into a string /// used when converting address to string pub(super) fn to_prefix(self) -> &'static str { match self { Network::Mainnet => MAINNET_PREFIX, Network::Testnet => TESTNET_PREFIX, } } }