Class SearchAccounts

Returns information about indexed accounts.

Example

const accounts = await indexerClient.searchAccounts().do();

Response data schema details

Hierarchy

Constructors

Properties

intDecoding: IntDecoding
query: Record<string, any>

JSONRequest Methods

  • Execute the request.

    Returns

    A promise which resolves to the parsed response data.

    Parameters

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

      Additional headers to send in the request. Optional.

    Returns Promise<Record<string, any>>

  • Execute the request, but do not process the response data in any way.

    Returns

    A promise which resolves to the raw response data, exactly as returned by the server.

    Parameters

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

      Additional headers to send in the request. Optional.

    Returns Promise<Uint8Array>

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

Other Methods

query Methods

  • 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 accounts = await indexerClient
    .searchAccounts()
    .currencyGreaterThan(minBalance - 1)
    .do();

    Example 2

    const assetID = 163650;
    const minBalance = 300000;
    const accounts = await indexerClient
    .searchAccounts()
    .assetID(assetID)
    .currencyGreaterThan(minBalance - 1)
    .do();

    Remarks

    If you are looking for accounts 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 accounts with a 0 amount.

    Parameters

    • greater: number

    Returns SearchAccounts

  • 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 accounts = await indexerClient
    .searchAccounts()
    .currencyLessThan(maxBalance + 1)
    .do();

    Example 2

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

    Parameters

    • lesser: number

    Returns SearchAccounts

  • Exclude additional items such as asset holdings, application local data stored for this account, asset parameters created by this account, and application parameters created by this account.

    Example 1

    const accounts = await indexerClient
    .searchAccounts()
    .exclude("all")
    .do();

    Example 2

    const accounts = await indexerClient
    .searchAccounts()
    .exclude("assets,created-assets")
    .do();

    Remarks

    By default, it behaves as exclude=none

    Parameters

    • exclude: string

      Array of all, assets, created-assets, apps-local-state, created-apps, none

    Returns SearchAccounts

  • Includes all items including closed accounts, deleted applications, destroyed assets, opted-out asset holdings, and closed-out application localstates

    Example 1

    const assetId = 163650;
    const accounts = await indexerClient
    .searchAccounts()
    .includeAll(false)
    .do();

    Example 2

    const assetId = 163650;
    const accounts = await indexerClient
    .searchAccounts()
    .includeAll()
    .do();

    Parameters

    • value: boolean = true

      default true when called without passing a value

    Returns SearchAccounts

  • The next page of results.

    Example

    const maxResults = 25;

    const accountsPage1 = await indexerClient
    .searchAccounts()
    .limit(maxResults)
    .do();

    const accountsPage2 = await indexerClient
    .searchAccounts()
    .limit(maxResults)
    .nextToken(accountsPage1["next-token"])
    .do();

    Parameters

    • nextToken: string

      provided by the previous results

    Returns SearchAccounts

  • Include results for the specified round.

    Example

    const targetBlock = 18309917;
    const accounts = await indexerClient
    .searchAccounts()
    .round(targetBlock)
    .do();

    Remarks

    For performance reasons, this parameter may be disabled on some configurations.

    Parameters

    • round: number

    Returns SearchAccounts

Generated using TypeDoc