Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

search_tx

Look up a transaction outcome by hash.

Signature

async fn search_tx(&self, hash: grug::Hash256) -> Result<grug::SearchTxOutcome, anyhow::Error>;

From impl SearchTxClient for HttpClient.

Example

use {
    anyhow::Result,
    dango_sdk::HttpClient,
    grug::{Hash256, SearchTxClient},
    std::str::FromStr,
};
 
#[tokio::main]
async fn main() -> Result<()> {
    let client = HttpClient::new("https://api-mainnet.dango.zone")?;
    let hash   = Hash256::from_str(
        "0x0000000000000000000000000000000000000000000000000000000000000000",
    )?;
    let outcome = client.search_tx(hash).await?;
    println!("height: {}", outcome.height);
    Ok(())
}

Parameters

hashHash256. The transaction hash returned by broadcast_tx.

Returns

SearchTxOutcome — full outcome with hash, height, transaction body, gas usage, success/failure result, and emitted events.

Notes

  • Returns Err(anyhow!("tx not found: …")) when the transaction isn't yet committed. Treat as "keep polling" (subject to a bounded retry).
  • Returns Err(anyhow!("multiple txs found …")) if the indexer returns more than one match — a rare consistency window.
  • The outcome reconstructs the Tx from indexer-stored fields (messages, data, credential) and re-parses event payloads, so this is heavier than query_block_outcome.

See also