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

  • default
    • Indexer

GET

  • Returns application local state about the given account.

    Example

    const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
    const accountAppLocalStates = await indexerClient.lookupAccountAppLocalStates(address).do();

    Response data schema details

    Parameters

    • account: string | Address

      The address of the account to look up.

    Returns default

  • Returns asset about the given account.

    Example

    const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
    const accountAssets = await indexerClient.lookupAccountAssets(address).do();

    Response data schema details

    Parameters

    • account: string | Address

      The address of the account to look up.

    Returns default

  • Returns information about the given account.

    Example

    const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
    const accountInfo = await indexerClient.lookupAccountByID(address).do();

    Response data schema details

    Parameters

    • account: string | Address

      The address of the account to look up.

    Returns default

  • Returns application information created by the given account.

    Example

    const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
    const accountCreatedApps = await indexerClient.lookupAccountCreatedApplications(address).do();

    Response data schema details

    Parameters

    • account: string | Address

      The address of the account to look up.

    Returns default

  • Returns asset information created by the given account.

    Example

    const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
    const accountCreatedAssets = await indexerClient.lookupAccountCreatedAssets(address).do();

    Response data schema details

    Parameters

    • account: string | Address

      The address of the account to look up.

    Returns default

  • Returns transactions relating to the given account.

    Example

    const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
    const accountTxns = await indexerClient.lookupAccountTransactions(address).do();

    Response data schema details

    Parameters

    • account: string | Address

      The address of the account.

    Returns default

  • Returns information about the application box given its name.

    Example

    const boxName = Buffer.from("foo");
    const boxResponse = await indexerClient
    .LookupApplicationBoxByIDandName(1234, boxName)
    .do();
    const boxValue = boxResponse.value;

    Response data schema details

    Parameters

    • appID: number | bigint

      The ID of the application with boxes.

    • boxName: Uint8Array

    Returns default

  • Returns log messages generated by the passed in application.

    Example

    const appId = 60553466;
    const appLogs = await indexerClient.lookupApplicationLogs(appId).do();

    Response data schema details

    Parameters

    • appID: number | bigint

      The ID of the application which generated the logs.

    Returns default

  • Returns information about the passed application.

    Example

    const appId = 60553466;
    const appInfo = await indexerClient.lookupApplications(appId).do();

    Response data schema details

    Parameters

    • index: number | bigint

      The ID of the application to look up.

    Returns default

  • Returns the list of accounts who hold the given asset and their balance.

    Example

    const assetId = 163650;
    const assetBalances = await indexerClient.lookupAssetBalances(assetId).do();

    Response data schema details

    Parameters

    • index: number | bigint

      The asset ID to look up.

    Returns default

  • Returns transactions relating to the given asset.

    Example

    const assetId = 163650;
    const assetTxns = await indexerClient.lookupAssetTransactions(assetId).do();

    Response data schema details

    Parameters

    • index: number | bigint

      The asset ID to look up.

    Returns default

  • Returns information about the given transaction.

    Example

    const txnId = "MEUOC4RQJB23CQZRFRKYEI6WBO73VTTPST5A7B3S5OKBUY6LFUDA";
    const txnInfo = await indexerClient.lookupTransactionByID(txnId).do();

    Response data schema details

    Parameters

    • txID: string

      The ID of the transaction to look up.

    Returns default

  • 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 | bigint

      The ID of the application with boxes.

    Returns default

Other

  • 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);

    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

    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.

Generated using TypeDoc