lunar-mining 4 жил өмнө
parent
commit
c8c932b149

+ 14 - 1
src/bin/drk.rs

@@ -97,6 +97,11 @@ impl Drk {
         Ok(self.request(req).await?)
         Ok(self.request(req).await?)
     }
     }
 
 
+    async fn get_tokens(&self) -> Result<Value> {
+        let req = jsonrpc::request(json!("get_tokens"), json![()]);
+        Ok(self.request(req).await?)
+    }
+
     // --> {"jsonrpc": "2.0", "method": "features", "params": [], "id": 42}
     // --> {"jsonrpc": "2.0", "method": "features", "params": [], "id": 42}
     // <-- {"jsonrpc": "2.0", "result": ["network": "btc", "sol"], "id": 42}
     // <-- {"jsonrpc": "2.0", "result": ["network": "btc", "sol"], "id": 42}
     async fn features(&self) -> Result<Value> {
     async fn features(&self) -> Result<Value> {
@@ -161,6 +166,12 @@ async fn start(config: &DrkConfig, options: ArgMatches<'_>) -> Result<()> {
             println!("Server replied: {}", &reply.to_string());
             println!("Server replied: {}", &reply.to_string());
             return Ok(());
             return Ok(());
         }
         }
+
+        if matches.is_present("tokens") {
+            let reply = client.get_tokens().await?;
+            println!("Server replied: {}", &reply.to_string());
+            return Ok(());
+        }
     }
     }
 
 
     if let Some(matches) = options.subcommand_matches("id") {
     if let Some(matches) = options.subcommand_matches("id") {
@@ -211,7 +222,9 @@ async fn start(config: &DrkConfig, options: ArgMatches<'_>) -> Result<()> {
             .check_network(&NetworkName::from_str(&network)?)
             .check_network(&NetworkName::from_str(&network)?)
             .await?;
             .await?;
 
 
-        let reply = client.withdraw(&network, &token_sym, &address, amount).await?;
+        let reply = client
+            .withdraw(&network, &token_sym, &address, amount)
+            .await?;
 
 
         println!("{}", &reply.to_string());
         println!("{}", &reply.to_string());
 
 

+ 1 - 1
src/wallet/walletdb.rs

@@ -345,7 +345,7 @@ impl WalletDb {
     }
     }
 
 
     pub fn get_token_id(&self) -> Result<Vec<jubjub::Fr>> {
     pub fn get_token_id(&self) -> Result<Vec<jubjub::Fr>> {
-        debug!(target: "WALLETDB", "Get token and balances...");
+        debug!(target: "WALLETDB", "Get token ID...");
         let conn = Connection::open(&self.path)?;
         let conn = Connection::open(&self.path)?;
         conn.pragma_update(None, "key", &self.password)?;
         conn.pragma_update(None, "key", &self.password)?;