Skip to main content
Call refetch_states first to ensure all decoded values on the instance reflect the latest on-chain data before reading or building instructions.

refetch_states (rpc feature)

Re-fetches all on-chain accounts (config, oracle, curve metadata, prefabs) and updates the instance in-place.
If you are managing account data yourself (Geyser, websocket), reconstruct the pool with Hadron::from_accounts using the latest data instead.

getMidprice

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

getSpreadFactor / getSpreadBps

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

getActiveCurveSlots

Returns the slot index for each currently active curve.
Returns ActiveCurveSlots

getActiveCurves

Decodes and returns all four active curves from the appropriate prefab data.
Returns Result<ActiveCurves, HadronSdkError> Each CurveSide contains:

getCurveSlot

Decode a specific curve slot by type and index.
Returns Result<CurveSide, HadronSdkError>