wagyu_ethereum/network/
ropsten.rs1use crate::network::EthereumNetwork;
2use wagyu_model::{ChildIndex, Network, NetworkError};
3
4use serde::Serialize;
5use std::{fmt, str::FromStr};
6
7#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize)]
9pub struct Ropsten;
10
11impl Network for Ropsten {
12 const NAME: &'static str = "ropsten";
13}
14
15impl EthereumNetwork for Ropsten {
16 const CHAIN_ID: u32 = 3;
17 const NETWORK_ID: u32 = 3;
18 const HD_COIN_TYPE: ChildIndex = ChildIndex::Hardened(1);
19}
20
21impl FromStr for Ropsten {
22 type Err = NetworkError;
23
24 fn from_str(s: &str) -> Result<Self, Self::Err> {
25 match s {
26 Self::NAME => Ok(Self),
27 _ => Err(NetworkError::InvalidNetwork(s.into())),
28 }
29 }
30}
31
32impl fmt::Display for Ropsten {
33 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
34 write!(f, "{}", Self::NAME)
35 }
36}