Explorar o código

jsonrpc: Rename send_request() to send_raw_request().

parazyd %!s(int64=4) %!d(string=hai) anos
pai
achega
0817c97754
Modificáronse 3 ficheiros con 6 adicións e 6 borrados
  1. 4 4
      src/bin/darkfid.rs
  2. 1 1
      src/bin/drk.rs
  3. 1 1
      src/rpc/jsonrpc.rs

+ 4 - 4
src/bin/darkfid.rs

@@ -19,7 +19,7 @@ use drk::{
         load_params, merkle::CommitmentTree, save_params, setup_mint_prover, setup_spend_prover,
         load_params, merkle::CommitmentTree, save_params, setup_mint_prover, setup_spend_prover,
     },
     },
     rpc::{
     rpc::{
-        jsonrpc::{error as jsonerr, request as jsonreq, response as jsonresp, send_request},
+        jsonrpc::{error as jsonerr, request as jsonreq, response as jsonresp, send_raw_request},
         jsonrpc::{ErrorCode::*, JsonRequest, JsonResult},
         jsonrpc::{ErrorCode::*, JsonRequest, JsonResult},
         rpcserver::{listen_and_serve, RequestHandler, RpcServerConfig},
         rpcserver::{listen_and_serve, RequestHandler, RpcServerConfig},
     },
     },
@@ -226,7 +226,7 @@ impl Darkfid {
         let req = jsonreq(json!("features"), json!([]));
         let req = jsonreq(json!("features"), json!([]));
         let rep: JsonResult;
         let rep: JsonResult;
         // NOTE: this just selects the first cashier in the list
         // NOTE: this just selects the first cashier in the list
-        match send_request(&self.cashiers[0].rpc_url, json!(req)).await {
+        match send_raw_request(&self.cashiers[0].rpc_url, json!(req)).await {
             Ok(v) => rep = v,
             Ok(v) => rep = v,
             Err(e) => {
             Err(e) => {
                 return JsonResult::Err(jsonerr(ServerError(-32004), Some(e.to_string()), id))
                 return JsonResult::Err(jsonerr(ServerError(-32004), Some(e.to_string()), id))
@@ -289,7 +289,7 @@ impl Darkfid {
         // If not, an error is returned, and forwarded to the method caller.
         // If not, an error is returned, and forwarded to the method caller.
         let req = jsonreq(json!("deposit"), json!([network, token_id, pubkey]));
         let req = jsonreq(json!("deposit"), json!([network, token_id, pubkey]));
         let rep: JsonResult;
         let rep: JsonResult;
-        match send_request(&self.cashiers[0].rpc_url, json!(req)).await {
+        match send_raw_request(&self.cashiers[0].rpc_url, json!(req)).await {
             Ok(v) => rep = v,
             Ok(v) => rep = v,
             Err(e) => {
             Err(e) => {
                 debug!(target: "DARKFID", "REQUEST IS ERR");
                 debug!(target: "DARKFID", "REQUEST IS ERR");
@@ -374,7 +374,7 @@ impl Darkfid {
             json!([network, token_id, address, amount_in_apo]),
             json!([network, token_id, address, amount_in_apo]),
         );
         );
         let mut rep: JsonResult;
         let mut rep: JsonResult;
-        match send_request(&self.cashiers[0].rpc_url, json!(req)).await {
+        match send_raw_request(&self.cashiers[0].rpc_url, json!(req)).await {
             Ok(v) => rep = v,
             Ok(v) => rep = v,
             Err(e) => {
             Err(e) => {
                 return JsonResult::Err(jsonerr(ServerError(-32004), Some(e.to_string()), id));
                 return JsonResult::Err(jsonerr(ServerError(-32004), Some(e.to_string()), id));

+ 1 - 1
src/bin/drk.rs

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

+ 1 - 1
src/rpc/jsonrpc.rs

@@ -146,7 +146,7 @@ pub fn notification(m: Value, p: Value) -> JsonNotification {
     }
     }
 }
 }
 
 
-pub async fn send_request(url: &str, data: Value) -> Result<JsonResult, Error> {
+pub async fn send_raw_request(url: &str, data: Value) -> Result<JsonResult, Error> {
     let use_tls: bool;
     let use_tls: bool;
     let parsed_url = url::Url::parse(url)?;
     let parsed_url = url::Url::parse(url)?;