Skip to content

API ReferenceVaults, collateral, and riskFunction

deriveCollateralAllocations()

function deriveCollateralAllocations(reservations): CollateralAllocation[];

Groups active reservations by their actual reserving contract, account, asset and vault namespace. No non-pool or unknown contract is inferred to be a LOC.

Parameters

ParameterTypeDescription
reservationsreadonly CollateralReservation[]Named SDK reservation reads, normally the complete indexed collection.

Returns

CollateralAllocation[]

One token-denominated allocation per group. Inactive reservations do not contribute.

Throws

InvalidArgumentError if a full reservation identity occurs twice.

Example

const allocations = deriveCollateralAllocations(page.items);