Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SearchForTransactions

Returns information about indexed transactions.

Example

const txns = await indexerClient.searchForTransactions().do();

Response data schema details

Hierarchy

Index

Constructors

Properties

intDecoding: IntDecoding
query: Record<string, any>

JSONRequest Methods

  • do(headers?: Record<string, any>): Promise<Record<string, any>>
  • Execute the request.

    Parameters

    • headers: Record<string, any> = {}

      Additional headers to send in the request. Optional.

    Returns Promise<Record<string, any>>

    A promise which resolves to the response data.

  • prepare(body: Uint8Array | Record<string, any>): Record<string, any>
  • Prepare a JSON response before returning it.

    Use this method to change and restructure response data as needed after receiving it from the do() method.

    Parameters

    • body: Uint8Array | Record<string, any>

      Response body received

    Returns Record<string, any>

  • Configure how integers in this request's JSON response will be decoded.

    The options are:

    • "default": Integers will be decoded according to JSON.parse, meaning they will all be Numbers and any values greater than Number.MAX_SAFE_INTEGER will lose precision.
    • "safe": All integers will be decoded as Numbers, but if any values are greater than Number.MAX_SAFE_INTEGER an error will be thrown.
    • "mixed": Integers will be decoded as Numbers if they are less than or equal to Number.MAX_SAFE_INTEGER, otherwise they will be decoded as BigInts.
    • "bigint": All integers will be decoded as BigInts.

    Parameters

    • method: IntDecoding

      The method to use when parsing the response for this request. Must be one of "default", "safe", "mixed", or "bigint".

    Returns SearchForTransactions

Other Methods

  • path(): string

query Methods

  • Only include transactions with this address in one of the transaction fields.

    Example

    const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
    const txns = await indexerClient
    .searchForTransactions()
    .address(address)
    .do();
    remarks

    Alternatively, use indexerClient.lookupAccountTransactions(address).do()

    Parameters

    • address: string

    Returns SearchForTransactions

  • Combined with address, defines what address to filter on, as string.

    Example

    const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
    const role = "freeze-target";
    const txns = await indexerClient
    .searchForTransactions()
    .address(address)
    .addressRole(role)
    .do();

    Parameters

    • role: string

      one of sender, receiver, freeze-target

    Returns SearchForTransactions

  • Filtered results should have an amount greater than this value, as int, representing microAlgos, unless an asset-id is provided, in which case units are in the asset's units.

    Example 1

    const minBalance = 300000;
    const txns = await indexerClient
    .searchForTransactions()
    .currencyGreaterThan(minBalance - 1)
    .do();

    Example 2

    const assetID = 163650;
    const minBalance = 300000;
    const txns = await indexerClient
    .searchForTransactions()
    .assetID(assetID)
    .currencyGreaterThan(minBalance - 1)
    .do();
    remarks

    If you are looking for transactions with the currency amount greater than 0, simply construct the query without currencyGreaterThan because it doesn't accept -1, and passing the 0 currency-greater-than value would exclude transactions with a 0 amount.

    Parameters

    • greater: number

    Returns SearchForTransactions

  • Filtered results should have an amount less than this value, as int, representing microAlgos, unless an asset-id is provided, in which case units are in the asset's units.

    Example 1

    const maxBalance = 500000;
    const txns = await indexerClient
    .searchForTransactions()
    .currencyLessThan(maxBalance + 1)
    .do();

    Example 2

    const assetID = 163650;
    const maxBalance = 500000;
    const txns = await indexerClient
    .searchForTransactions()
    .assetID(assetID)
    .currencyLessThan(maxBalance + 1)
    .do();

    Parameters

    • lesser: number

    Returns SearchForTransactions

  • The next page of results.

    Example

    const maxResults = 25;

    const txnsPage1 = await indexerClient
    .searchForTransactions()
    .limit(maxResults)
    .do();

    const txnsPage2 = await indexerClient
    .searchForTransactions()
    .limit(maxResults)
    .nextToken(txnsPage1["next-token"])
    .do();

    Parameters

    • nextToken: string

      provided by the previous results

    Returns SearchForTransactions

Generated using TypeDoc