helium_api/
pending_transactions.rs

1use crate::{models::transactions::PendingTxnStatus, *};
2use serde_json::json;
3
4/// Convert a given transaction to json, ready to be submitted
5/// Submit a transaction to the blockchain
6pub async fn submit<T>(client: &Client, txn: T) -> Result<PendingTxnStatus>
7where
8    T: AsRef<[u8]>,
9{
10    let json = json!({ "txn": base64::encode(&txn) });
11    client.post("/pending_transactions", &json).await
12}
13
14/// Get the status for a specific pending transaction hash
15pub async fn get(client: &Client, hash: &str) -> Result<PendingTxnStatus> {
16    client
17        .fetch(&format!("/pending_transactions/{}", hash), NO_QUERY)
18        .await
19}