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.
The return value contains two properties:
response— the account records you can use directlybuilder— exposesnext()andprev()to paginate through results
Type
export type CallBuilderOptions = {
cursor?: string;
limit?: number;
network?: string;
order?: "asc" | "desc";
};
type GetAccountsOptionsA = {
forSigner: string;
forAsset?: Asset;
sponsor?: string;
forLiquidityPool?: string;
};
type GetAccountsOptionsB = {
forSigner?: string;
forAsset: Asset;
sponsor?: string;
forLiquidityPool?: string;
};
type GetAccountsOptionsC = {
forSigner?: string;
forAsset?: Asset;
sponsor: string;
forLiquidityPool?: string;
};
type GetAccountsOptionsD = {
forSigner?: string;
forAsset?: Asset;
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({});