Skip to main content

Documentation/Searchers

Fetching Transactions

How to fetch transactions stored on Signet's transaction cache.

Transactions can be fetched from Signet’s transaction cache. Fetching transactions is easy with Signet’s Transaction Cache Client. Consult the Parmigiana Quickstart for any other RPC endpoints or contract addresses you might need.

Setup

Add the required Signet crates:

bash
cargo add signet-tx-cache

Fetching Transactions

Create a TxCache client and fetch transactions:

rust
use signet_tx_cache::TxCache;

let cache = TxCache::parmigiana();

// `get_transactions` takes an optional cursor parameter. 
// Start with `None` to fetch the first page.
let response = cache.get_transactions(None).await?;

for tx in &response.transactions {
    println!("Transaction: {}", tx.tx_hash());
}

The cache returns up to 50 transactions per request as a list of TxEnvelope objects. You can use these transactions to simulate, analyze, or build bundles.

Transactions are ordered by their effective gas price, so the highest-paying transactions appear first. They are only syntactically validated, which means transactions might fail during EVM execution.

Pagination

The cache uses cursor-based pagination. If more transactions are available, the response will include a cursor. This cursor can be passed into the get_transactions method to fetch the next page:

rust
let mut all_transactions = Vec::new();
let mut cursor = None;

loop {
    let response = cache.get_transactions(cursor).await?;
    all_transactions.extend(response.transactions.clone());

    if response.has_more() {
        cursor = response.next_cursor;
    } else {
        break;
    }
}
ESC

Start typing to search documentation...

Navigate Select ⌘K Open