use crate::*;
use serde::Deserialize;
use serde_json::json;
#[derive(Clone, Deserialize, Debug)]
pub struct PendingTxnStatus {
pub hash: String,
}
pub async fn submit<T>(client: &Client, txn: T) -> Result<PendingTxnStatus>
where
T: AsRef<[u8]>,
{
let json = json!({ "txn": base64::encode(&txn) });
client.post("/pending_transactions", &json).await
}
pub async fn get(client: &Client, hash: &str) -> Result<PendingTxnStatus> {
client
.fetch(&format!("/pending_transactions/{}", hash), NO_QUERY)
.await
}