diff --git a/src/blockchain.rs b/src/blockchain.rs index 2b9dd7ac..6cecc5f3 100644 --- a/src/blockchain.rs +++ b/src/blockchain.rs @@ -430,16 +430,40 @@ impl FromStr for Network { /// Defines a blockchain network, identifies in which context the system interacts with the /// blockchain. +/// +/// When adding support for a new blockchain in the library a [`From`] implementation must be +/// provided such that it is possible to know what blockchain network to use for each of the three +/// generic contexts: `mainnet`, `testnet`, and `local`. +/// +/// ```rust +/// use farcaster_core::blockchain::Network; +/// +/// pub enum MyNet { +/// MyNet, +/// Test, +/// Regtest, +/// } +/// +/// impl From for MyNet { +/// fn from(net: Network) -> Self { +/// match net { +/// Network::Mainnet => Self::MyNet, +/// Network::Testnet => Self::Test, +/// Network::Local => Self::Regtest, +/// } +/// } +/// } +/// ``` #[derive( Copy, PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Display, Serialize, Deserialize, )] #[display(Debug)] pub enum Network { - /// Represents a real asset on his valuable network. + /// Valuable, real, assets on its production network. Mainnet, - /// Represents non-valuable assets on test networks. + /// Non-valuable assets on its online test networks. Testnet, - /// Local and private testnets. + /// Non-valuable assets on offline test network. Local, }