API ReferencePricing and oraclesFunction
getTokenPairPrice()
function getTokenPairPrice(ctx, params): Promise<TokenPairPrice>;Reads a token pair price with the actual successful source, including a proven-fresh chain-oracle fallback when Hermes is unavailable.
Parameters
| Parameter | Type | Description |
|---|---|---|
ctx | SDKContext | The configured SDK context. |
params | GetPriceParams | Direction of the smallest-unit input-to-output price. |
Returns
Promise<TokenPairPrice>
The pair, price and source actually used by the read.
Throws
PriceServerError when Hermes is unavailable and no fresh chain price can be established.
Throws
InvalidArgumentError when either token cannot be resolved.
Throws
StalePythPriceError when Hermes returns unsafe stale or future-dated data.
Example
const pair = await getTokenPairPrice(sdk, { inputToken: collateralAddress, outputToken: creditedAddress });// Pass pair to assessLetterOfCreditRisk; pair.source records a fallback honestly.