Просмотр исходного кода

util: add Ethereum to Networks enum

ghassmo 4 лет назад
Родитель
Сommit
0a105db2fe
2 измененных файлов с 7 добавлено и 2 удалено
  1. 2 2
      src/service/eth.rs
  2. 5 0
      src/util/net_name.rs

+ 2 - 2
src/service/eth.rs

@@ -242,8 +242,8 @@ impl EthClient {
 
         send_notification
             .send(TokenNotification {
-                network: NetworkName::Solana,
-                token_id: generate_id(ETH_NATIVE_TOKEN_ID, &NetworkName::Solana)?,
+                network: NetworkName::Ethereum,
+                token_id: generate_id(ETH_NATIVE_TOKEN_ID, &NetworkName::Ethereum)?,
                 drk_pub_key,
                 // TODO FIX
                 received_balance: amnt.to_u64_digits()[0],

+ 5 - 0
src/util/net_name.rs

@@ -9,6 +9,7 @@ use crate::{
 pub enum NetworkName {
     Solana,
     Bitcoin,
+    Ethereum,
     Empty,
 }
 
@@ -21,6 +22,9 @@ impl std::fmt::Display for NetworkName {
             Self::Bitcoin => {
                 write!(f, "Bitcoin")
             }
+            Self::Ethereum => {
+                write!(f, "Ethereum")
+            }
             Self::Empty => {
                 write!(f, "No Supported Network")
             }
@@ -35,6 +39,7 @@ impl FromStr for NetworkName {
         match s.to_lowercase().as_str() {
             "sol" | "solana" => Ok(NetworkName::Solana),
             "btc" | "bitcoin" => Ok(NetworkName::Bitcoin),
+            "eth" | "ethereum" => Ok(NetworkName::Ethereum),
             _ => Err(crate::Error::NotSupportedNetwork),
         }
     }