Skip to main content

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.

getMidprice

Current midprice decoded from the on-chain Q32 oracle value.
Returnsnumber

getSpreadFactor

Current base-spread factor decoded from the on-chain Q32 oracle value. A factor of 0.9995 means 5 bps of spread.
Returnsnumber

getActiveCurveSlots

Returns the slot index for each active curve.
Returns{ priceBid: number, priceAsk: number, riskBid: number, riskAsk: number }

getActiveCurves

Decodes and returns all four active curves from the appropriate prefab data.
Returns{ priceBid: CurveSide, priceAsk: CurveSide, riskBid: CurveSide, riskAsk: CurveSide } EachCurveSidecontains:

getCurveSlot

Decode a specific curve slot by type and index.
ReturnsCurveSide