You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wow-btc-swap/swap/src/network/rendezvous.rs

30 lines
798 B

use libp2p::rendezvous::Namespace;
use std::fmt;
#[derive(Debug, PartialEq, Clone, Copy)]
pub enum WowBtcNamespace {
Mainnet,
Testnet,
}
const MAINNET: &str = "wow-btc-swap-mainnet";
const TESTNET: &str = "wow-btc-swap-testnet";
impl fmt::Display for WowBtcNamespace {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
WowBtcNamespace::Mainnet => write!(f, "{}", MAINNET),
WowBtcNamespace::Testnet => write!(f, "{}", TESTNET),
}
}
}
impl From<WowBtcNamespace> for Namespace {
fn from(namespace: WowBtcNamespace) -> Self {
match namespace {
WowBtcNamespace::Mainnet => Namespace::from_static(MAINNET),
WowBtcNamespace::Testnet => Namespace::from_static(TESTNET),
}
}
}