You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.3 KiB
Rust

use rocket::serde::json::{Value, json};
#[get("/<hash>")]
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?<address>&<hash>&<key>")]
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;
}