From ae7e3a4688f5a17fd9653c2d3bb23ef2248e3bab Mon Sep 17 00:00:00 2001 From: zancas Date: Tue, 8 Nov 2022 09:29:27 -0700 Subject: [PATCH] remove deprecated command --- lib/src/commands.rs | 25 ------------------------- lib/src/lightclient.rs | 23 ----------------------- 2 files changed, 48 deletions(-) diff --git a/lib/src/commands.rs b/lib/src/commands.rs index 172f8c4fd..c1cd3f179 100644 --- a/lib/src/commands.rs +++ b/lib/src/commands.rs @@ -373,30 +373,6 @@ impl Command for InfoCommand { } } -struct ZecPriceCommand {} -impl Command for ZecPriceCommand { - fn help(&self) -> String { - let mut h = vec![]; - h.push("Use UpdateCurrentPriceCommand instead."); - h.push("Backwards compatible price fetch"); - h.push("Get the latest ZEC price from Gemini exchange's API."); - h.push("Currently using USD."); - h.push("Usage:"); - h.push("zecprice"); - h.push(""); - - h.join("\n") - } - - fn short_help(&self) -> String { - "Get the latest ZEC price in the wallet's currency (USD)".to_string() - } - - fn exec(&self, _args: &[&str], lightclient: &LightClient) -> String { - RT.block_on(async move { lightclient.do_zec_price().await }) - } -} - struct UpdateCurrentPriceCommand {} impl Command for UpdateCurrentPriceCommand { fn help(&self) -> String { @@ -1313,7 +1289,6 @@ pub fn get_commands() -> Box>> { map.insert("import".to_string(), Box::new(ImportCommand {})); map.insert("export".to_string(), Box::new(ExportCommand {})); map.insert("info".to_string(), Box::new(InfoCommand {})); - map.insert("zecprice".to_string(), Box::new(ZecPriceCommand {})); map.insert( "updatecurrentprice".to_string(), Box::new(UpdateCurrentPriceCommand {}), diff --git a/lib/src/lightclient.rs b/lib/src/lightclient.rs index 3554da3e5..2ed566493 100644 --- a/lib/src/lightclient.rs +++ b/lib/src/lightclient.rs @@ -573,29 +573,6 @@ impl LightClient { self.config.get_server_uri() } - pub async fn do_zec_price(&self) -> String { - let mut price = self.wallet.price.read().await.clone(); - - // If there is no price, try to fetch it first. - if price.zec_price.is_none() { - self.update_current_price().await; - price = self.wallet.price.read().await.clone(); - } - - match price.zec_price { - None => return "Error: No price".to_string(), - Some((timestamp, p)) => { - let o = object! { - "zec_price" => p, - "fetched_at" => timestamp, - "currency" => price.currency - }; - - o.pretty(2) - } - } - } - pub async fn do_info(&self) -> String { match GrpcConnector::get_info(self.get_server_uri()).await { Ok(i) => {