anychain_ethereum/network/
avalanche.rs1use crate::network::EthereumNetwork;
2use anychain_core::{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 Avalanche;
10
11impl Network for Avalanche {
12 const NAME: &'static str = "avalanche";
13}
14
15impl EthereumNetwork for Avalanche {
16 const CHAIN_ID: u32 = 43114;
17 const NETWORK_ID: u32 = 43114;
18}
19
20impl FromStr for Avalanche {
21 type Err = NetworkError;
22
23 fn from_str(s: &str) -> Result<Self, Self::Err> {
24 match s {
25 Self::NAME => Ok(Self),
26 _ => Err(NetworkError::InvalidNetwork(s.into())),
27 }
28 }
29}
30
31impl fmt::Display for Avalanche {
32 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
33 write!(f, "{}", Self::NAME)
34 }
35}