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

bin/darkfid: pass socks_url to send_request function

ghassmo 4 лет назад
Родитель
Сommit
d82ecbb6bc

+ 1 - 1
bin/cashierd/src/service/eth.rs

@@ -350,7 +350,7 @@ impl EthClient {
         debug!(target: "ETH RPC", "--> {}", serde_json::to_string(&r)?);
         let url = Url::parse(&format!("unix://{}", self.socket_path)).map_err(Error::from)?;
         let reply: JsonResult =
-            match jsonrpc::send_request(&url, json!(r)).await.map_err(EthFailed::from) {
+            match jsonrpc::send_request(&url, json!(r), None).await.map_err(EthFailed::from) {
                 Ok(v) => v,
                 Err(e) => return Err(e),
             };

+ 5 - 5
bin/dao-cli/src/main.rs

@@ -38,11 +38,11 @@ impl Client {
     }
 
     async fn request(&self, r: jsonrpc::JsonRequest) -> Result<Value> {
-        let reply: JsonResult = match jsonrpc::send_request(&Url::parse(&self.url)?, json!(r)).await
-        {
-            Ok(v) => v,
-            Err(e) => return Err(e),
-        };
+        let reply: JsonResult =
+            match jsonrpc::send_request(&Url::parse(&self.url)?, json!(r), None).await {
+                Ok(v) => v,
+                Err(e) => return Err(e),
+            };
 
         match reply {
             JsonResult::Resp(r) => {

+ 6 - 3
bin/darkfid/src/main.rs

@@ -504,7 +504,7 @@ impl Darkfid {
         let req = jsonreq(json!("features"), json!([]));
         let rep: JsonResult =
             // NOTE: this just selects the first cashier in the list
-            match send_request(&self.cashiers[0].rpc_url, json!(req)).await {
+            match send_request(&self.cashiers[0].rpc_url, json!(req), None).await {
                 Ok(v) => v,
                 Err(e) => return JsonResult::Err(jsonerr(ServerError(-32004), Some(e.to_string()), id)),
             };
@@ -569,7 +569,8 @@ impl Darkfid {
         // (and token), it shall return a valid address where tokens can be deposited.
         // If not, an error is returned, and forwarded to the method caller.
         let req = jsonreq(json!("deposit"), json!([network, token_id, pubkey]));
-        let rep: JsonResult = match send_request(&self.cashiers[0].rpc_url, json!(req)).await {
+        let rep: JsonResult = match send_request(&self.cashiers[0].rpc_url, json!(req), None).await
+        {
             Ok(v) => v,
             Err(e) => {
                 debug!(target: "DARKFID", "REQUEST IS ERR");
@@ -646,7 +647,9 @@ impl Darkfid {
         };
 
         let req = jsonreq(json!("withdraw"), json!([network, token_id, address, amount_in_apo]));
-        let mut rep: JsonResult = match send_request(&self.cashiers[0].rpc_url, json!(req)).await {
+        let mut rep: JsonResult = match send_request(&self.cashiers[0].rpc_url, json!(req), None)
+            .await
+        {
             Ok(v) => v,
             Err(e) => return JsonResult::Err(jsonerr(ServerError(-32004), Some(e.to_string()), id)),
         };

+ 1 - 1
bin/drk/src/main.rs

@@ -162,7 +162,7 @@ impl Drk {
     }
 
     async fn request(&self, r: jsonrpc::JsonRequest) -> Result<Value> {
-        let reply: JsonResult = match jsonrpc::send_request(&self.url, json!(r)).await {
+        let reply: JsonResult = match jsonrpc::send_request(&self.url, json!(r), None).await {
             Ok(v) => v,
             Err(e) => return Err(e),
         };

+ 1 - 1
bin/map/src/main.rs

@@ -60,7 +60,7 @@ impl Map {
     }
 
     async fn request(&self, r: jsonrpc::JsonRequest) -> Result<Value> {
-        let reply: JsonResult = match jsonrpc::send_request(&self.url, json!(r)).await {
+        let reply: JsonResult = match jsonrpc::send_request(&self.url, json!(r), None).await {
             Ok(v) => v,
             Err(e) => return Err(e),
         };

+ 1 - 1
src/rpc/jsonrpc.rs

@@ -142,7 +142,7 @@ pub fn notification(m: Value, p: Value) -> JsonNotification {
     JsonNotification { jsonrpc: json!("2.0"), method: m, params: p }
 }
 
-pub async fn send_request(uri: &Url, data: Value) -> Result<JsonResult> {
+pub async fn send_request(uri: &Url, data: Value, _socks_url: Option<Url>) -> Result<JsonResult> {
     // If we don't get a reply after 30 seconds, we'll fail.
     let read_timeout = Duration::from_secs(30);