use rocket::serde::json::{Value, json}; #[get("/")] pub fn hash(hash: String) -> Value { let params: Value = json!({ "txs_hashes": [&hash], "decode_as_json": true }); // let mut res: GetTransactions = build_rpc( // &"get_transactions", Some(params), true // ).send().unwrap().json().unwrap(); // if res.txs.len() > 0 { // for f in &mut res.txs { // f.process(); // }; // }; // let context = json!({ // "tx_info": res.txs, // "hash": hash, // "debug": res.clone() // }); return params; } #[get("/receipt?
&&")] pub fn receipt(address: String, hash: String, key: String) -> Value { let payload: Value = json!({ "method": "check_tx_key", "params": { "address": address, "txid": hash, "tx_key": key } }); // let http_client = Client::new(); // let wallet_uri = env::var("WALLET_URI").unwrap(); // let uri = format!("{}/json_rpc", &wallet_uri); // let res: CheckTxKeyResponse = http_client.post(&uri).json(&payload) // .send().unwrap().json().unwrap(); // let context = json!({ // "res": &res.result, // "hash": hash, // "address": address // }); // Template::render("receipt", context) return payload; }