Skip to content

API ReferenceVaults, collateral, and riskFunction

getCollateralTokens()

function getCollateralTokens(
ctx,
params?,
subgraphUrl,
options?
): Promise<CollectionPage<CollateralToken>>;

Lists the ERC-20 tokens the CollateralVault knows as collateral, from the subgraph, with each token’s enabled flag and indexed name/symbol/decimals. Paginated via cursor/limit; each call performs a fresh read.

Parameters

ParameterTypeDescription
ctxSDKContextThe SDK context.
paramsGetCollateralTokensParamsThe request-specific parameters to filter the returned results.
subgraphUrlstringThe URL of the subgraph endpoint.
optionsReadExecutionOptionsCancellation controls kept separate from collection filters.

Returns

Promise<CollectionPage<CollateralToken>>

The collateral tokens that match the specified request parameters.

Example

// Every token the CollateralVault currently accepts, across all pages.
const tokens: CollateralToken[] = [];
let cursor: string | undefined;
do {
const page = await sdk.loc.getCollateralTokens({
enabled: true,
cursor,
});
tokens.push(...page.items);
cursor = page.nextCursor ?? undefined;
} while (cursor);