BluxBlux

Get Accounts

Fetch a paginated list of Stellar accounts using the Blux core SDK.

The getAccounts function returns a paginated list of Stellar accounts. At least one filter — forSigner, forAsset, sponsor, or forLiquidityPool — must be provided.

forSigner and sponsor accept G…, M…, SEP-2 federation, or .xlm names; see address resolution.

The return value contains two properties:

  • response — the account records you can use directly
  • builder — exposes next() and prev() to paginate through results

Type

export type CallBuilderOptions = {
  cursor?: string;
  limit?: number;
  network?: string;
  order?: "asc" | "desc";
};

type GetAccountsOptionsA = {
  forSigner: string; // G…/M…, SEP-2 address, or .xlm name
  forAsset?: AssetArg;
  sponsor?: string; // G…/M…, SEP-2 address, or .xlm name
  forLiquidityPool?: string;
};

type GetAccountsOptionsB = {
  forSigner?: string;
  forAsset: AssetArg;
  sponsor?: string;
  forLiquidityPool?: string;
};

type GetAccountsOptionsC = {
  forSigner?: string;
  forAsset?: AssetArg;
  sponsor: string;
  forLiquidityPool?: string;
};

type GetAccountsOptionsD = {
  forSigner?: string;
  forAsset?: AssetArg;
  sponsor?: string;
  forLiquidityPool: string;
};

export type GetAccountsOptions = CallBuilderOptions & (
  GetAccountsOptionsA | GetAccountsOptionsB | GetAccountsOptionsC | GetAccountsOptionsD
)

export type GetAccountsResult = {
  builder: AccountCallBuilder;
  response: Horizon.ServerApi.CollectionPage<Horizon.ServerApi.AccountRecord>;
};

Usage

import { core } from "@bluxcc/core";

const result = await core.getAccounts({ forSigner: "alice.xlm" });

On this page