Skip to content

API ReferenceVaults, collateral, and riskFunction

getCollateralTokensForCreditedToken()

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

Fetches the CollateralTokens eligible as collateral for the given credited token.

A collateral token is eligible when it is non-disabled AND either:

  • It IS the credited token (the static-LOC case, where a token collateralizes itself and no AssetPair/CollateralFactor is required), or
  • It has a non-disabled AssetPair AND a non-disabled CollateralFactor with creationCollateralFactorBasisPoints > 0 for the credited token.

This is a dedicated action (not a creditedToken filter on getCollateralTokens) because the eligibility join is a materially different query shape from the general listing action.

Parameters

ParameterTypeDescription
ctxSDKContextThe SDK context.
paramsGetCollateralTokensForCreditedTokenParamsThe request-specific parameters, including the credited token to find eligible collateral tokens for.
subgraphUrlstringThe URL of the subgraph endpoint.
optionsReadExecutionOptionsCancellation controls kept separate from collection filters.

Returns

Promise<CollectionPage<CollateralToken>>

The collateral tokens eligible for the specified credited token.