Class Indexer

The Indexer provides a REST API interface of API calls to support searching the Algorand Blockchain.

The Indexer REST APIs retrieve the blockchain data from a PostgreSQL compatible database that must be populated.

This database is populated using the same indexer instance or a separate instance of the indexer which must connect to the algod process of a running Algorand node to read block data.

This node must also be an Archival node to make searching the entire blockchain possible.

Relevant Information

Learn more about Indexer

Run Indexer in Postman OAS3

Hierarchy

Constructors

  • Create an IndexerClient from

    • either a token, baseServer, port, and optional headers
    • or a base client server for interoperability with external dApp wallets

    Example

    const token  = "";
    const server = "http://localhost";
    const port = 8980;
    const indexerClient = new algosdk.Indexer(token, server, port);

    Remarks

    The above configuration is for a sandbox private network. For applications on production, you are encouraged to run your own node with indexer, or use an Algorand REST API provider with a dedicated API key.

    Parameters

    • tokenOrBaseClient: string | BaseHTTPClient | IndexerTokenHeader | CustomTokenHeader

      The API token for the Indexer API

    • baseServer: string = 'http://127.0.0.1'

      REST endpoint

    • port: string | number = 8080

      Port number if specifically configured by the server

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

      Optional headers

    Returns Indexer

GET Methods

  • Returns information about indexed application boxes.

    Example

    const maxResults = 20;
    const appID = 1234;

    const responsePage1 = await indexerClient
    .searchForApplicationBoxes(appID)
    .limit(maxResults)
    .do();
    const boxNamesPage1 = responsePage1.boxes.map(box => box.name);

    const responsePage2 = await indexerClient
    .searchForApplicationBoxes(appID)
    .limit(maxResults)
    .nextToken(responsePage1.nextToken)
    .do();
    const boxNamesPage2 = responsePage2.boxes.map(box => box.name);

    Response data schema details

    Parameters

    • appID: number

      The ID of the application with boxes.

    Returns SearchForApplicationBoxes

Other Methods

  • Set the default int decoding method for all JSON requests this client creates.

    Parameters

    • method: IntDecoding

      {"default" | "safe" | "mixed" | "bigint"} method The method to use when parsing the response for request. Must be one of "default", "safe", "mixed", or "bigint". See JSONRequest.setIntDecoding for more details about what each method does.

    Returns void

Generated using TypeDoc