Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.hadron.fi/llms.txt

Use this file to discover all available pages before exploring further.

refetchStates

Re-fetches all on-chain accounts (config, oracle, curve metadata, prefabs) in parallel and updates the instance in-place. Best to run first to get the latest pool data.
await pool.refetchStates();

getMidprice

Current midprice decoded from the on-chain Q32 oracle value.
const mid = pool.getMidprice(); // e.g. 1.0023
Returnsnumber

getSpreadFactor

Current base-spread factor decoded from the on-chain Q32 oracle value. A factor of 0.9995 means 5 bps of spread.
const factor = pool.getSpreadFactor(); // e.g. 0.9995
const bps = pool.getSpreadBps();       // e.g. 5
Returnsnumber

getActiveCurveSlots

Returns the slot index for each active curve.
const slots = pool.getActiveCurveSlots();
// { priceBid: 0, priceAsk: 0, riskBid: 0, riskAsk: 0 }
Returns{ priceBid: number, priceAsk: number, riskBid: number, riskAsk: number }

getActiveCurves

Decodes and returns all four active curves from the appropriate prefab data.
const curves = pool.getActiveCurves();
// curves.priceBid.points, curves.priceAsk.points, etc.
Returns{ priceBid: CurveSide, priceAsk: CurveSide, riskBid: CurveSide, riskAsk: CurveSide } EachCurveSidecontains:
FieldTypeDescription
numPointsnumberNumber of curve points
defaultInterpolationInterpolationDefault interpolation mode
xModeCurveXModeX-axis mode (Native or Alternate)
riskModeRiskModeVirtual or Integrated
pointsCurvePoint[]The curve point array

getCurveSlot

Decode a specific curve slot by type and index.
const curve = pool.getCurveSlot(CurveType.PriceBid, 1);
ReturnsCurveSide
ParamTypeDescription
curveTypeCurveTypeOne of PriceBid, PriceAsk, RiskBid, RiskAsk
slotnumberSlot index