Skip to content

API ReferencePricing and oraclesFunction

getOraclePriceUpdate()

function getOraclePriceUpdate(ctx, params): Promise<OraclePriceUpdate>;

Gets the Pyth Oracle Price update necessary to send to the LetterOfCredit contract to execute any function call that depends on accurate prices. This includes the fee that Pyth charges to process the price update on-chain. This fee must be passed along in the value of any transaction including this price update.

Parameters

ParameterTypeDescription
ctxSDKContextThe SDK context.
paramsGetOraclePriceUpdateParamsThe parameters indicating the tokens for the update.

Returns

Promise<OraclePriceUpdate>

The oracle price update.

Throws

StalePythPriceError If Hermes returns a price outside oracleConfig.maxPriceAgeSeconds.