Skip to content

API ReferenceLOC lifecycleFunction

getMaxLOCPriceUpdateSecondsAgo()

function getMaxLOCPriceUpdateSecondsAgo(ctx): Promise<number>;

Gets the maximum number of seconds an oracle price update may be stale but still valid for the LetterOfCredit contract. Incorporates a UX buffer so the returned value may not exactly match the contract value.

This is the single place the buffer is applied — callers should treat the result as the effective freshness window and not subtract the buffer again.

The buffer should stay well below the contract window. When it does not (the contract permits maxPriceUpdateSecondsAgo as low as 30s while the default buffer is 30s), the returned window shrinks toward zero; the guard below falls back to the unbuffered contract value rather than returning a zero/negative window, but the effective window can still be very small.

Parameters

ParameterTypeDescription
ctxSDKContextThe SDK context.

Returns

Promise<number>

The max stale seconds of a valid price update.