Skip to content

API ReferenceVaults, collateral, and riskFunction

getCollateralReservation()

function getCollateralReservation(ctx, params): Promise<CollateralReservation | undefined>;

Reads current reservation storage from the referenced ICollateral-compatible vault. Returns undefined when storage was erased or the ID never existed. Token metadata and the identity of a reserving contract’s product are separate concerns.

Parameters

ParameterTypeDescription
ctxSDKContextSDK context selecting the chain and compatible vault ABI.
paramsGetCollateralReservationParamsPortable chain, vault and uint96 reservation identity.

Returns

Promise< | CollateralReservation | undefined>

Current reservation facts, or undefined for absent storage.

Throws

InvalidArgumentError for an invalid reference or another chain, before I/O.

Throws

ConfigError if the live provider chain differs from the profile.

Example

const reference = loc.origin.originatingCollateralReservation;
if (reference !== null) {
const reservation = await getCollateralReservation(sdk, { reference });
// Undefined means current reservation storage no longer exists.
console.log(reservation);
}
// Null means legacy origin evidence could not recover the identity.