diff --git a/src/bin/darkfid.rs b/src/bin/darkfid.rs index 2d99197b1..cd29b870d 100644 --- a/src/bin/darkfid.rs +++ b/src/bin/darkfid.rs @@ -17,9 +17,7 @@ use drk::{ rpcserver::{listen_and_serve, RequestHandler, RpcServerConfig}, }, serial::{deserialize, serialize}, - util::{ - expand_path, join_config_path, parse_network, parse_wrapped_token, search_id, TokenList, - }, + util::{expand_path, join_config_path, parse_network, parse_wrapped_token, search_id}, wallet::WalletDb, Result, }; @@ -351,8 +349,6 @@ impl Darkfid { #[async_std::main] async fn main() -> Result<()> { - let _tokens = TokenList::new()?; - let args = clap_app!(darkfid => (@arg CONFIG: -c --config +takes_value "Sets a custom config file") (@arg verbose: -v --verbose "Increase verbosity") diff --git a/src/util.rs b/src/util.rs index 88eaa8cb6..08ceb460d 100644 --- a/src/util.rs +++ b/src/util.rs @@ -6,22 +6,9 @@ use crate::{ use log::debug; use sha2::{Digest, Sha256}; -use serde_json::Value; use std::path::{Path, PathBuf}; use std::str::FromStr; -pub struct TokenList { - tokenlist: Value, -} - -impl TokenList { - pub fn new() -> Result { - let file_contents = std::fs::read_to_string("token/solanatokenlist.json")?; - let tokenlist: serde_json::Value = serde_json::from_str(&file_contents)?; - Ok(Self { tokenlist }) - } -} - pub fn expand_path(path: &str) -> Result { let ret: PathBuf; @@ -52,6 +39,7 @@ pub fn join_config_path(file: &Path) -> Result { Ok(path) } + #[derive(Debug, PartialEq, Eq, Hash, Clone)] pub enum NetworkName { Solana, @@ -217,25 +205,6 @@ pub fn search_id(symbol: &str) -> Result { unreachable!(); } -// TODO: implement this - -//pub fn search_decimals(symbol: &str) -> Result { -// // TODO: FIXME -// let file_contents = std::fs::read_to_string("token/solanatokenlist.json")?; -// let tokenlist: serde_json::Value = serde_json::from_str(&file_contents)?; -// let tokens = tokenlist["tokens"] -// .as_array() -// .ok_or_else(|| Error::TokenParseError)?; -// for item in tokens { -// if item["symbol"] == symbol.to_uppercase() { -// let address = item["address"].clone(); -// let address = address.as_str().ok_or_else(|| Error::TokenParseError)?; -// return Ok(address.to_string()); -// } -// } -// unreachable!(); -//} - #[cfg(test)] mod tests { use crate::serial::{deserialize, serialize};