extern crate reqwest; use rocket::serde::json::{Value}; use reqwest::{RequestBuilder, Client}; use std::env; pub async fn build_rpc(method: &str, raw_data: Option, raw: bool) -> RequestBuilder { let http_client = Client::new(); let daemon_uri = env::var("DAEMON_URI").unwrap(); let uri = if raw { format!("{}/{}", &daemon_uri, &method) } else { format!("{}/json_rpc", &daemon_uri) }; if let None = raw_data { http_client.post(&uri) } else { http_client.post(&uri).json(&raw_data) } }