searchTransactions

How to use it

import { TatumSDK, CardanoRosetta, Network } from '@tatumio/tatum';

// Initialize the Tatum SDK for Cardano
const tatum = await TatumSDK.init<CardanoRosetta>({ network: Network.CARDANO_ROSETTA });

// Define the input parameters in a single object
const params = {
    networkIdentifier: {
        blockchain: 'CARDANO',
        network: 'NETWORK_NAME',
        subNetworkIdentifier: {
            network: 'SUB_NETWORK_NAME',
            metadata: {
                // Optional metadata key-value pairs.
            },
        },
    },
    operator: {
        // Specify search conditions (optional).
    },
    max_block: 5,   // The largest block index to consider (optional).
    offset: 5,      // The offset into the query result to start returning transactions (optional).
    limit: 5,       // The maximum number of transactions to return in one call (optional).
    transactionIdentifier: {
        hash: 'TRANSACTION_HASH',  // string, required
    },
    accountIdentifier: {
        address: 'ACCOUNT_ADDRESS', // string, required
        sub_account: {
            // Specify sub-account information if applicable
        },
        metadata: {
            chain_code: 'CHAIN_CODE', // Specify chain code if applicable
        },
    },
    coin_identifier: {
        identifier: 'CO' // Specify search conditions (optional).
    },
    currency: {
            symbol: 'CURRENCY_SYMBOL', // Required: Specifies the currency symbol .
            decimals: 6, // Required: Specifies the currency decimals (number).
            metadata: {
              // Optional metadata for amount object
            },
    },
    status: 'reverted', // The network-specific operation status type (optional).
    type: 'transfer',   // The network-specific operation type (optional).
    address: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347', // Account address (optional).
    success: true,  // A synthetic condition (optional).
};

// Search for transactions
const transactions = await tatum.rpc.searchTransactions(params);

// Log the retrieved transactions
console.log('Transactions:', transactions);

// Always destroy the Tatum SDK instance when done to stop any background processes
await tatum.destroy();

Overview

The searchTransactions method allows you to search for transactions matching a set of provided conditions in canonical blocks. This can be useful for querying transaction data based on various criteria.

Example Use Cases

  1. Transaction Query: Developers can use this method to search for transactions that meet specific criteria, such as a particular status or operation type.

  2. Block Analysis: Users can analyze transactions within a specific range of blocks to identify patterns or trends.

Request Parameters

The searchTransactions method requires the following parameters in the request body: