@hadron-fi/sdk 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -65,7 +65,8 @@ interface DecodedMidpriceOracle {
65
65
  authority: PublicKey;
66
66
  sequence: bigint;
67
67
  midpriceQ32: bigint;
68
- baseSpreadQ32: bigint;
68
+ /** Spread as a discount factor in Q32 (e.g. toQ32(0.9995) = 5 bps). */
69
+ spreadFactorQ32: bigint;
69
70
  lastUpdateSlot: bigint;
70
71
  }
71
72
  interface DecodedCurveMeta {
@@ -217,12 +218,14 @@ interface UpdateMidpriceParams {
217
218
  sequence?: bigint;
218
219
  }
219
220
  interface UpdateBaseSpreadParams {
220
- baseSpreadQ32: bigint;
221
+ /** Spread as a discount factor in Q32 (e.g. toQ32(0.9995) = 5 bps). */
222
+ spreadFactorQ32: bigint;
221
223
  sequence?: bigint;
222
224
  }
223
225
  interface UpdateMidpriceAndBaseSpreadParams {
224
226
  midpriceQ32: bigint;
225
- baseSpreadQ32: bigint;
227
+ /** Spread as a discount factor in Q32 (e.g. toQ32(0.9995) = 5 bps). */
228
+ spreadFactorQ32: bigint;
226
229
  sequence?: bigint;
227
230
  }
228
231
  interface SwitchCurveParams {
@@ -386,8 +389,10 @@ declare class Hadron {
386
389
  refetchStates(): Promise<void>;
387
390
  /** Get midprice as a floating-point number. */
388
391
  getMidprice(): number;
389
- /** Get base spread as a floating-point number. */
390
- getBaseSpread(): number;
392
+ /** Get spread factor as a floating-point number (e.g. 0.9995 = 5 bps). */
393
+ getSpreadFactor(): number;
394
+ /** Get spread in basis points (e.g. 5 for a 0.9995 factor). */
395
+ getSpreadBps(): number;
391
396
  /** Get the currently active curve slot indices. */
392
397
  getActiveCurveSlots(): {
393
398
  priceBid: number;
@@ -692,6 +697,10 @@ declare function toQ32(value: number): bigint;
692
697
  declare function fromQ32(q32: bigint): number;
693
698
  /** Convert a percentage (0.0 to 1.0) to Q32.32. */
694
699
  declare function pctToQ32(pct: number): bigint;
700
+ /** Convert basis points to a spread factor in Q32 (e.g. 5 bps → toQ32(0.9995)). */
701
+ declare function spreadBpsToQ32(bps: number): bigint;
702
+ /** Convert a spread factor in Q32 to basis points (e.g. toQ32(0.9995) → 5). */
703
+ declare function spreadQ32ToBps(q32: bigint): number;
695
704
 
696
705
  /**
697
706
  * Get the ATA address, and optionally return a create instruction if it doesn't exist.
@@ -867,4 +876,4 @@ declare function buildUpdateDeltaStaleness(authority: PublicKey, configPda: Publ
867
876
  */
868
877
  declare function buildClosePool(authority: PublicKey, configPda: PublicKey, midpriceOraclePda: PublicKey, curveMetaPda: PublicKey, curvePrefabsPda: PublicKey, curveUpdatesPda: PublicKey, vaultX: PublicKey, vaultY: PublicKey, tokenProgramX: PublicKey, tokenProgramY: PublicKey, spreadConfigInitialized?: boolean, programId?: PublicKey): TransactionInstruction;
869
878
 
870
- export { ABSOLUTE_MAX_CURVE_POINTS, ABSOLUTE_MAX_PREFAB_SLOTS, type AllocateCurvePrefabsParams, type AmendOrderParams, CONFIG_SEED, CONFIG_SIZE, CURVE_META_SEED, CURVE_META_SIZE, CURVE_POINT_LEN, CURVE_PREFABS_SEED, CURVE_SIDE_HEADER, CURVE_UPDATES_SEED, CURVE_UPDATES_SIZE, CURVE_UPDATE_OP_SIZE, type CancelOrderParams, type CurvePoint, type CurveSide, CurveType, type CurveUpdateOp, CurveUpdateOpKind, CurveXMode, DEFAULT_MAX_CURVE_POINTS, DEFAULT_MAX_PREFAB_SLOTS, type DecodedConfig, type DecodedCurveMeta, type DecodedCurveUpdates, type DecodedFeeConfig, type DecodedMidpriceOracle, type DecodedSpreadConfig, type DepositParams, Discriminator, FEE_CONFIG_SEED, FEE_CONFIG_SIZE, HADRON_PROGRAM_ID, Hadron, HadronOrderbook, type InitializeFeeConfigParams, type InitializeParams, type InitializeSpreadConfigParams, Interpolation, MAX_CURVE_UPDATE_OPS, MAX_SETCURVE_POINTS, MIDPRICE_ORACLE_SEED, MIDPRICE_ORACLE_SIZE, type NominateAuthorityParams, OracleMode, type OrderSide, type OrderbookLevel, type OrderbookState, POINT_DATA_SIZE, type PlaceOrderParams, type PoolAddresses, PoolState, Q32_ONE, RiskMode, type RotateFeeAdminParams, SPREAD_CONFIG_SEED, type SetCurveBothParams, type SetCurveParams, type SetCurvePointInput, type SetPoolStateParams, type SetQuotingAuthorityParams, type SetRiskCurveAbsoluteBothParams, type SetRiskCurveAbsoluteParams, type SetRiskCurveAbsolutePointInput, type SetRiskCurveBothParams, type SetRiskCurveParams, type SetRiskCurvePointInput, Side, type SpreadTriggerInput, type StagedOrder, type SwapParams, type SwitchCurveParams, type UpdateBaseSpreadParams, type UpdateDeltaStalenessParams, type UpdateFeeConfigParams, type UpdateMidpriceAndBaseSpreadParams, type UpdateMidpriceParams, type UpdateSpreadConfigParams, type WithdrawParams, buildAcceptAuthority, buildAllocateCurvePrefabs, buildApplyCurveUpdates, buildClosePool, buildDeposit, buildInitialize, buildInitializeFeeConfig, buildInitializeSpreadConfig, buildNominateAuthority, buildRotateFeeAdmin, buildSetCurve, buildSetCurveBoth, buildSetPoolState, buildSetQuotingAuthority, buildSetRiskCurve, buildSetRiskCurveAbsolute, buildSetRiskCurveAbsoluteBoth, buildSetRiskCurveBoth, buildSubmitCurveUpdates, buildSwapExactIn, buildSwitchPriceCurve, buildSwitchRiskCurve, buildUpdateBaseSpread, buildUpdateDeltaStaleness, buildUpdateFeeConfig, buildUpdateMidprice, buildUpdateMidpriceAndBaseSpread, buildUpdateSpreadConfig, buildWithdraw, curvePrefabsSize, decodeActiveCurves, decodeConfig, decodeCurveMeta, decodeCurveSide, decodeCurveUpdates, decodeFeeConfig, decodeMidpriceOracle, decodeSpreadConfig, derivePoolAddresses, fromQ32, getConfigAddress, getCurveMetaAddress, getCurvePrefabsAddress, getCurveUpdatesAddress, getFeeConfigAddress, getMidpriceOracleAddress, getOrCreateAta, getSpreadConfigAddress, isSlotInitialized, pctToQ32, toQ32 };
879
+ export { ABSOLUTE_MAX_CURVE_POINTS, ABSOLUTE_MAX_PREFAB_SLOTS, type AllocateCurvePrefabsParams, type AmendOrderParams, CONFIG_SEED, CONFIG_SIZE, CURVE_META_SEED, CURVE_META_SIZE, CURVE_POINT_LEN, CURVE_PREFABS_SEED, CURVE_SIDE_HEADER, CURVE_UPDATES_SEED, CURVE_UPDATES_SIZE, CURVE_UPDATE_OP_SIZE, type CancelOrderParams, type CurvePoint, type CurveSide, CurveType, type CurveUpdateOp, CurveUpdateOpKind, CurveXMode, DEFAULT_MAX_CURVE_POINTS, DEFAULT_MAX_PREFAB_SLOTS, type DecodedConfig, type DecodedCurveMeta, type DecodedCurveUpdates, type DecodedFeeConfig, type DecodedMidpriceOracle, type DecodedSpreadConfig, type DepositParams, Discriminator, FEE_CONFIG_SEED, FEE_CONFIG_SIZE, HADRON_PROGRAM_ID, Hadron, HadronOrderbook, type InitializeFeeConfigParams, type InitializeParams, type InitializeSpreadConfigParams, Interpolation, MAX_CURVE_UPDATE_OPS, MAX_SETCURVE_POINTS, MIDPRICE_ORACLE_SEED, MIDPRICE_ORACLE_SIZE, type NominateAuthorityParams, OracleMode, type OrderSide, type OrderbookLevel, type OrderbookState, POINT_DATA_SIZE, type PlaceOrderParams, type PoolAddresses, PoolState, Q32_ONE, RiskMode, type RotateFeeAdminParams, SPREAD_CONFIG_SEED, type SetCurveBothParams, type SetCurveParams, type SetCurvePointInput, type SetPoolStateParams, type SetQuotingAuthorityParams, type SetRiskCurveAbsoluteBothParams, type SetRiskCurveAbsoluteParams, type SetRiskCurveAbsolutePointInput, type SetRiskCurveBothParams, type SetRiskCurveParams, type SetRiskCurvePointInput, Side, type SpreadTriggerInput, type StagedOrder, type SwapParams, type SwitchCurveParams, type UpdateBaseSpreadParams, type UpdateDeltaStalenessParams, type UpdateFeeConfigParams, type UpdateMidpriceAndBaseSpreadParams, type UpdateMidpriceParams, type UpdateSpreadConfigParams, type WithdrawParams, buildAcceptAuthority, buildAllocateCurvePrefabs, buildApplyCurveUpdates, buildClosePool, buildDeposit, buildInitialize, buildInitializeFeeConfig, buildInitializeSpreadConfig, buildNominateAuthority, buildRotateFeeAdmin, buildSetCurve, buildSetCurveBoth, buildSetPoolState, buildSetQuotingAuthority, buildSetRiskCurve, buildSetRiskCurveAbsolute, buildSetRiskCurveAbsoluteBoth, buildSetRiskCurveBoth, buildSubmitCurveUpdates, buildSwapExactIn, buildSwitchPriceCurve, buildSwitchRiskCurve, buildUpdateBaseSpread, buildUpdateDeltaStaleness, buildUpdateFeeConfig, buildUpdateMidprice, buildUpdateMidpriceAndBaseSpread, buildUpdateSpreadConfig, buildWithdraw, curvePrefabsSize, decodeActiveCurves, decodeConfig, decodeCurveMeta, decodeCurveSide, decodeCurveUpdates, decodeFeeConfig, decodeMidpriceOracle, decodeSpreadConfig, derivePoolAddresses, fromQ32, getConfigAddress, getCurveMetaAddress, getCurvePrefabsAddress, getCurveUpdatesAddress, getFeeConfigAddress, getMidpriceOracleAddress, getOrCreateAta, getSpreadConfigAddress, isSlotInitialized, pctToQ32, spreadBpsToQ32, spreadQ32ToBps, toQ32 };
package/dist/index.d.ts CHANGED
@@ -65,7 +65,8 @@ interface DecodedMidpriceOracle {
65
65
  authority: PublicKey;
66
66
  sequence: bigint;
67
67
  midpriceQ32: bigint;
68
- baseSpreadQ32: bigint;
68
+ /** Spread as a discount factor in Q32 (e.g. toQ32(0.9995) = 5 bps). */
69
+ spreadFactorQ32: bigint;
69
70
  lastUpdateSlot: bigint;
70
71
  }
71
72
  interface DecodedCurveMeta {
@@ -217,12 +218,14 @@ interface UpdateMidpriceParams {
217
218
  sequence?: bigint;
218
219
  }
219
220
  interface UpdateBaseSpreadParams {
220
- baseSpreadQ32: bigint;
221
+ /** Spread as a discount factor in Q32 (e.g. toQ32(0.9995) = 5 bps). */
222
+ spreadFactorQ32: bigint;
221
223
  sequence?: bigint;
222
224
  }
223
225
  interface UpdateMidpriceAndBaseSpreadParams {
224
226
  midpriceQ32: bigint;
225
- baseSpreadQ32: bigint;
227
+ /** Spread as a discount factor in Q32 (e.g. toQ32(0.9995) = 5 bps). */
228
+ spreadFactorQ32: bigint;
226
229
  sequence?: bigint;
227
230
  }
228
231
  interface SwitchCurveParams {
@@ -386,8 +389,10 @@ declare class Hadron {
386
389
  refetchStates(): Promise<void>;
387
390
  /** Get midprice as a floating-point number. */
388
391
  getMidprice(): number;
389
- /** Get base spread as a floating-point number. */
390
- getBaseSpread(): number;
392
+ /** Get spread factor as a floating-point number (e.g. 0.9995 = 5 bps). */
393
+ getSpreadFactor(): number;
394
+ /** Get spread in basis points (e.g. 5 for a 0.9995 factor). */
395
+ getSpreadBps(): number;
391
396
  /** Get the currently active curve slot indices. */
392
397
  getActiveCurveSlots(): {
393
398
  priceBid: number;
@@ -692,6 +697,10 @@ declare function toQ32(value: number): bigint;
692
697
  declare function fromQ32(q32: bigint): number;
693
698
  /** Convert a percentage (0.0 to 1.0) to Q32.32. */
694
699
  declare function pctToQ32(pct: number): bigint;
700
+ /** Convert basis points to a spread factor in Q32 (e.g. 5 bps → toQ32(0.9995)). */
701
+ declare function spreadBpsToQ32(bps: number): bigint;
702
+ /** Convert a spread factor in Q32 to basis points (e.g. toQ32(0.9995) → 5). */
703
+ declare function spreadQ32ToBps(q32: bigint): number;
695
704
 
696
705
  /**
697
706
  * Get the ATA address, and optionally return a create instruction if it doesn't exist.
@@ -867,4 +876,4 @@ declare function buildUpdateDeltaStaleness(authority: PublicKey, configPda: Publ
867
876
  */
868
877
  declare function buildClosePool(authority: PublicKey, configPda: PublicKey, midpriceOraclePda: PublicKey, curveMetaPda: PublicKey, curvePrefabsPda: PublicKey, curveUpdatesPda: PublicKey, vaultX: PublicKey, vaultY: PublicKey, tokenProgramX: PublicKey, tokenProgramY: PublicKey, spreadConfigInitialized?: boolean, programId?: PublicKey): TransactionInstruction;
869
878
 
870
- export { ABSOLUTE_MAX_CURVE_POINTS, ABSOLUTE_MAX_PREFAB_SLOTS, type AllocateCurvePrefabsParams, type AmendOrderParams, CONFIG_SEED, CONFIG_SIZE, CURVE_META_SEED, CURVE_META_SIZE, CURVE_POINT_LEN, CURVE_PREFABS_SEED, CURVE_SIDE_HEADER, CURVE_UPDATES_SEED, CURVE_UPDATES_SIZE, CURVE_UPDATE_OP_SIZE, type CancelOrderParams, type CurvePoint, type CurveSide, CurveType, type CurveUpdateOp, CurveUpdateOpKind, CurveXMode, DEFAULT_MAX_CURVE_POINTS, DEFAULT_MAX_PREFAB_SLOTS, type DecodedConfig, type DecodedCurveMeta, type DecodedCurveUpdates, type DecodedFeeConfig, type DecodedMidpriceOracle, type DecodedSpreadConfig, type DepositParams, Discriminator, FEE_CONFIG_SEED, FEE_CONFIG_SIZE, HADRON_PROGRAM_ID, Hadron, HadronOrderbook, type InitializeFeeConfigParams, type InitializeParams, type InitializeSpreadConfigParams, Interpolation, MAX_CURVE_UPDATE_OPS, MAX_SETCURVE_POINTS, MIDPRICE_ORACLE_SEED, MIDPRICE_ORACLE_SIZE, type NominateAuthorityParams, OracleMode, type OrderSide, type OrderbookLevel, type OrderbookState, POINT_DATA_SIZE, type PlaceOrderParams, type PoolAddresses, PoolState, Q32_ONE, RiskMode, type RotateFeeAdminParams, SPREAD_CONFIG_SEED, type SetCurveBothParams, type SetCurveParams, type SetCurvePointInput, type SetPoolStateParams, type SetQuotingAuthorityParams, type SetRiskCurveAbsoluteBothParams, type SetRiskCurveAbsoluteParams, type SetRiskCurveAbsolutePointInput, type SetRiskCurveBothParams, type SetRiskCurveParams, type SetRiskCurvePointInput, Side, type SpreadTriggerInput, type StagedOrder, type SwapParams, type SwitchCurveParams, type UpdateBaseSpreadParams, type UpdateDeltaStalenessParams, type UpdateFeeConfigParams, type UpdateMidpriceAndBaseSpreadParams, type UpdateMidpriceParams, type UpdateSpreadConfigParams, type WithdrawParams, buildAcceptAuthority, buildAllocateCurvePrefabs, buildApplyCurveUpdates, buildClosePool, buildDeposit, buildInitialize, buildInitializeFeeConfig, buildInitializeSpreadConfig, buildNominateAuthority, buildRotateFeeAdmin, buildSetCurve, buildSetCurveBoth, buildSetPoolState, buildSetQuotingAuthority, buildSetRiskCurve, buildSetRiskCurveAbsolute, buildSetRiskCurveAbsoluteBoth, buildSetRiskCurveBoth, buildSubmitCurveUpdates, buildSwapExactIn, buildSwitchPriceCurve, buildSwitchRiskCurve, buildUpdateBaseSpread, buildUpdateDeltaStaleness, buildUpdateFeeConfig, buildUpdateMidprice, buildUpdateMidpriceAndBaseSpread, buildUpdateSpreadConfig, buildWithdraw, curvePrefabsSize, decodeActiveCurves, decodeConfig, decodeCurveMeta, decodeCurveSide, decodeCurveUpdates, decodeFeeConfig, decodeMidpriceOracle, decodeSpreadConfig, derivePoolAddresses, fromQ32, getConfigAddress, getCurveMetaAddress, getCurvePrefabsAddress, getCurveUpdatesAddress, getFeeConfigAddress, getMidpriceOracleAddress, getOrCreateAta, getSpreadConfigAddress, isSlotInitialized, pctToQ32, toQ32 };
879
+ export { ABSOLUTE_MAX_CURVE_POINTS, ABSOLUTE_MAX_PREFAB_SLOTS, type AllocateCurvePrefabsParams, type AmendOrderParams, CONFIG_SEED, CONFIG_SIZE, CURVE_META_SEED, CURVE_META_SIZE, CURVE_POINT_LEN, CURVE_PREFABS_SEED, CURVE_SIDE_HEADER, CURVE_UPDATES_SEED, CURVE_UPDATES_SIZE, CURVE_UPDATE_OP_SIZE, type CancelOrderParams, type CurvePoint, type CurveSide, CurveType, type CurveUpdateOp, CurveUpdateOpKind, CurveXMode, DEFAULT_MAX_CURVE_POINTS, DEFAULT_MAX_PREFAB_SLOTS, type DecodedConfig, type DecodedCurveMeta, type DecodedCurveUpdates, type DecodedFeeConfig, type DecodedMidpriceOracle, type DecodedSpreadConfig, type DepositParams, Discriminator, FEE_CONFIG_SEED, FEE_CONFIG_SIZE, HADRON_PROGRAM_ID, Hadron, HadronOrderbook, type InitializeFeeConfigParams, type InitializeParams, type InitializeSpreadConfigParams, Interpolation, MAX_CURVE_UPDATE_OPS, MAX_SETCURVE_POINTS, MIDPRICE_ORACLE_SEED, MIDPRICE_ORACLE_SIZE, type NominateAuthorityParams, OracleMode, type OrderSide, type OrderbookLevel, type OrderbookState, POINT_DATA_SIZE, type PlaceOrderParams, type PoolAddresses, PoolState, Q32_ONE, RiskMode, type RotateFeeAdminParams, SPREAD_CONFIG_SEED, type SetCurveBothParams, type SetCurveParams, type SetCurvePointInput, type SetPoolStateParams, type SetQuotingAuthorityParams, type SetRiskCurveAbsoluteBothParams, type SetRiskCurveAbsoluteParams, type SetRiskCurveAbsolutePointInput, type SetRiskCurveBothParams, type SetRiskCurveParams, type SetRiskCurvePointInput, Side, type SpreadTriggerInput, type StagedOrder, type SwapParams, type SwitchCurveParams, type UpdateBaseSpreadParams, type UpdateDeltaStalenessParams, type UpdateFeeConfigParams, type UpdateMidpriceAndBaseSpreadParams, type UpdateMidpriceParams, type UpdateSpreadConfigParams, type WithdrawParams, buildAcceptAuthority, buildAllocateCurvePrefabs, buildApplyCurveUpdates, buildClosePool, buildDeposit, buildInitialize, buildInitializeFeeConfig, buildInitializeSpreadConfig, buildNominateAuthority, buildRotateFeeAdmin, buildSetCurve, buildSetCurveBoth, buildSetPoolState, buildSetQuotingAuthority, buildSetRiskCurve, buildSetRiskCurveAbsolute, buildSetRiskCurveAbsoluteBoth, buildSetRiskCurveBoth, buildSubmitCurveUpdates, buildSwapExactIn, buildSwitchPriceCurve, buildSwitchRiskCurve, buildUpdateBaseSpread, buildUpdateDeltaStaleness, buildUpdateFeeConfig, buildUpdateMidprice, buildUpdateMidpriceAndBaseSpread, buildUpdateSpreadConfig, buildWithdraw, curvePrefabsSize, decodeActiveCurves, decodeConfig, decodeCurveMeta, decodeCurveSide, decodeCurveUpdates, decodeFeeConfig, decodeMidpriceOracle, decodeSpreadConfig, derivePoolAddresses, fromQ32, getConfigAddress, getCurveMetaAddress, getCurvePrefabsAddress, getCurveUpdatesAddress, getFeeConfigAddress, getMidpriceOracleAddress, getOrCreateAta, getSpreadConfigAddress, isSlotInitialized, pctToQ32, spreadBpsToQ32, spreadQ32ToBps, toQ32 };
package/dist/index.js CHANGED
@@ -166,6 +166,12 @@ function fromQ32(q32) {
166
166
  function pctToQ32(pct) {
167
167
  return toQ32(pct);
168
168
  }
169
+ function spreadBpsToQ32(bps) {
170
+ return toQ32(1 - bps / 1e4);
171
+ }
172
+ function spreadQ32ToBps(q32) {
173
+ return (1 - fromQ32(q32)) * 1e4;
174
+ }
169
175
 
170
176
  // src/accounts/index.ts
171
177
 
@@ -275,9 +281,9 @@ function decodeMidpriceOracle(data) {
275
281
  const authority = new (0, _web3js.PublicKey)(buf.subarray(0, 32));
276
282
  const sequence = buf.readBigUInt64LE(32);
277
283
  const midpriceQ32 = buf.readBigUInt64LE(40);
278
- const baseSpreadQ32 = buf.readBigUInt64LE(48);
284
+ const spreadFactorQ32 = buf.readBigUInt64LE(48);
279
285
  const lastUpdateSlot = buf.length >= MIDPRICE_ORACLE_SIZE ? buf.readBigUInt64LE(56) : 0n;
280
- return { authority, sequence, midpriceQ32, baseSpreadQ32, lastUpdateSlot };
286
+ return { authority, sequence, midpriceQ32, spreadFactorQ32, lastUpdateSlot };
281
287
  }
282
288
  function decodeCurveMeta(data) {
283
289
  const buf = Buffer.from(data);
@@ -850,7 +856,7 @@ function buildUpdateBaseSpread(authority, midpriceOraclePda, params, programId =
850
856
  const data = Buffer.alloc(1 + 8 + 8);
851
857
  data.writeUInt8(Discriminator.UpdateBaseSpread, 0);
852
858
  data.writeBigUInt64LE(_nullishCoalesce(params.sequence, () => ( 0n)), 1);
853
- data.writeBigUInt64LE(params.baseSpreadQ32, 9);
859
+ data.writeBigUInt64LE(params.spreadFactorQ32, 9);
854
860
  return new (0, _web3js.TransactionInstruction)({
855
861
  programId,
856
862
  keys: [
@@ -866,7 +872,7 @@ function buildUpdateMidpriceAndBaseSpread(authority, midpriceOraclePda, params,
866
872
  data.writeUInt8(Discriminator.UpdateMidpriceAndBaseSpread, 0);
867
873
  data.writeBigUInt64LE(_nullishCoalesce(params.sequence, () => ( 0n)), 1);
868
874
  data.writeBigUInt64LE(params.midpriceQ32, 9);
869
- data.writeBigUInt64LE(params.baseSpreadQ32, 17);
875
+ data.writeBigUInt64LE(params.spreadFactorQ32, 17);
870
876
  return new (0, _web3js.TransactionInstruction)({
871
877
  programId,
872
878
  keys: [
@@ -1321,9 +1327,13 @@ var Hadron = class _Hadron {
1321
1327
  getMidprice() {
1322
1328
  return fromQ32(this.oracle.midpriceQ32);
1323
1329
  }
1324
- /** Get base spread as a floating-point number. */
1325
- getBaseSpread() {
1326
- return fromQ32(this.oracle.baseSpreadQ32);
1330
+ /** Get spread factor as a floating-point number (e.g. 0.9995 = 5 bps). */
1331
+ getSpreadFactor() {
1332
+ return fromQ32(this.oracle.spreadFactorQ32);
1333
+ }
1334
+ /** Get spread in basis points (e.g. 5 for a 0.9995 factor). */
1335
+ getSpreadBps() {
1336
+ return (1 - fromQ32(this.oracle.spreadFactorQ32)) * 1e4;
1327
1337
  }
1328
1338
  /** Get the currently active curve slot indices. */
1329
1339
  getActiveCurveSlots() {
@@ -2301,5 +2311,7 @@ async function getOrCreateAta(connection, mint, owner, payer, tokenProgram = _sp
2301
2311
 
2302
2312
 
2303
2313
 
2304
- exports.ABSOLUTE_MAX_CURVE_POINTS = ABSOLUTE_MAX_CURVE_POINTS; exports.ABSOLUTE_MAX_PREFAB_SLOTS = ABSOLUTE_MAX_PREFAB_SLOTS; exports.CONFIG_SEED = CONFIG_SEED; exports.CONFIG_SIZE = CONFIG_SIZE; exports.CURVE_META_SEED = CURVE_META_SEED; exports.CURVE_META_SIZE = CURVE_META_SIZE; exports.CURVE_POINT_LEN = CURVE_POINT_LEN; exports.CURVE_PREFABS_SEED = CURVE_PREFABS_SEED; exports.CURVE_SIDE_HEADER = CURVE_SIDE_HEADER; exports.CURVE_UPDATES_SEED = CURVE_UPDATES_SEED; exports.CURVE_UPDATES_SIZE = CURVE_UPDATES_SIZE; exports.CURVE_UPDATE_OP_SIZE = CURVE_UPDATE_OP_SIZE; exports.CurveType = CurveType; exports.CurveUpdateOpKind = CurveUpdateOpKind; exports.CurveXMode = CurveXMode; exports.DEFAULT_MAX_CURVE_POINTS = DEFAULT_MAX_CURVE_POINTS; exports.DEFAULT_MAX_PREFAB_SLOTS = DEFAULT_MAX_PREFAB_SLOTS; exports.Discriminator = Discriminator; exports.FEE_CONFIG_SEED = FEE_CONFIG_SEED; exports.FEE_CONFIG_SIZE = FEE_CONFIG_SIZE; exports.HADRON_PROGRAM_ID = HADRON_PROGRAM_ID; exports.Hadron = Hadron; exports.HadronOrderbook = HadronOrderbook; exports.Interpolation = Interpolation; exports.MAX_CURVE_UPDATE_OPS = MAX_CURVE_UPDATE_OPS; exports.MAX_SETCURVE_POINTS = MAX_SETCURVE_POINTS; exports.MIDPRICE_ORACLE_SEED = MIDPRICE_ORACLE_SEED; exports.MIDPRICE_ORACLE_SIZE = MIDPRICE_ORACLE_SIZE; exports.OracleMode = OracleMode; exports.POINT_DATA_SIZE = POINT_DATA_SIZE; exports.PoolState = PoolState; exports.Q32_ONE = Q32_ONE; exports.RiskMode = RiskMode; exports.SPREAD_CONFIG_SEED = SPREAD_CONFIG_SEED; exports.Side = Side; exports.buildAcceptAuthority = buildAcceptAuthority; exports.buildAllocateCurvePrefabs = buildAllocateCurvePrefabs; exports.buildApplyCurveUpdates = buildApplyCurveUpdates; exports.buildClosePool = buildClosePool; exports.buildDeposit = buildDeposit; exports.buildInitialize = buildInitialize; exports.buildInitializeFeeConfig = buildInitializeFeeConfig; exports.buildInitializeSpreadConfig = buildInitializeSpreadConfig; exports.buildNominateAuthority = buildNominateAuthority; exports.buildRotateFeeAdmin = buildRotateFeeAdmin; exports.buildSetCurve = buildSetCurve; exports.buildSetCurveBoth = buildSetCurveBoth; exports.buildSetPoolState = buildSetPoolState; exports.buildSetQuotingAuthority = buildSetQuotingAuthority; exports.buildSetRiskCurve = buildSetRiskCurve; exports.buildSetRiskCurveAbsolute = buildSetRiskCurveAbsolute; exports.buildSetRiskCurveAbsoluteBoth = buildSetRiskCurveAbsoluteBoth; exports.buildSetRiskCurveBoth = buildSetRiskCurveBoth; exports.buildSubmitCurveUpdates = buildSubmitCurveUpdates; exports.buildSwapExactIn = buildSwapExactIn; exports.buildSwitchPriceCurve = buildSwitchPriceCurve; exports.buildSwitchRiskCurve = buildSwitchRiskCurve; exports.buildUpdateBaseSpread = buildUpdateBaseSpread; exports.buildUpdateDeltaStaleness = buildUpdateDeltaStaleness; exports.buildUpdateFeeConfig = buildUpdateFeeConfig; exports.buildUpdateMidprice = buildUpdateMidprice; exports.buildUpdateMidpriceAndBaseSpread = buildUpdateMidpriceAndBaseSpread; exports.buildUpdateSpreadConfig = buildUpdateSpreadConfig; exports.buildWithdraw = buildWithdraw; exports.curvePrefabsSize = curvePrefabsSize; exports.decodeActiveCurves = decodeActiveCurves; exports.decodeConfig = decodeConfig; exports.decodeCurveMeta = decodeCurveMeta; exports.decodeCurveSide = decodeCurveSide; exports.decodeCurveUpdates = decodeCurveUpdates; exports.decodeFeeConfig = decodeFeeConfig; exports.decodeMidpriceOracle = decodeMidpriceOracle; exports.decodeSpreadConfig = decodeSpreadConfig; exports.derivePoolAddresses = derivePoolAddresses; exports.fromQ32 = fromQ32; exports.getConfigAddress = getConfigAddress; exports.getCurveMetaAddress = getCurveMetaAddress; exports.getCurvePrefabsAddress = getCurvePrefabsAddress; exports.getCurveUpdatesAddress = getCurveUpdatesAddress; exports.getFeeConfigAddress = getFeeConfigAddress; exports.getMidpriceOracleAddress = getMidpriceOracleAddress; exports.getOrCreateAta = getOrCreateAta; exports.getSpreadConfigAddress = getSpreadConfigAddress; exports.isSlotInitialized = isSlotInitialized; exports.pctToQ32 = pctToQ32; exports.toQ32 = toQ32;
2314
+
2315
+
2316
+ exports.ABSOLUTE_MAX_CURVE_POINTS = ABSOLUTE_MAX_CURVE_POINTS; exports.ABSOLUTE_MAX_PREFAB_SLOTS = ABSOLUTE_MAX_PREFAB_SLOTS; exports.CONFIG_SEED = CONFIG_SEED; exports.CONFIG_SIZE = CONFIG_SIZE; exports.CURVE_META_SEED = CURVE_META_SEED; exports.CURVE_META_SIZE = CURVE_META_SIZE; exports.CURVE_POINT_LEN = CURVE_POINT_LEN; exports.CURVE_PREFABS_SEED = CURVE_PREFABS_SEED; exports.CURVE_SIDE_HEADER = CURVE_SIDE_HEADER; exports.CURVE_UPDATES_SEED = CURVE_UPDATES_SEED; exports.CURVE_UPDATES_SIZE = CURVE_UPDATES_SIZE; exports.CURVE_UPDATE_OP_SIZE = CURVE_UPDATE_OP_SIZE; exports.CurveType = CurveType; exports.CurveUpdateOpKind = CurveUpdateOpKind; exports.CurveXMode = CurveXMode; exports.DEFAULT_MAX_CURVE_POINTS = DEFAULT_MAX_CURVE_POINTS; exports.DEFAULT_MAX_PREFAB_SLOTS = DEFAULT_MAX_PREFAB_SLOTS; exports.Discriminator = Discriminator; exports.FEE_CONFIG_SEED = FEE_CONFIG_SEED; exports.FEE_CONFIG_SIZE = FEE_CONFIG_SIZE; exports.HADRON_PROGRAM_ID = HADRON_PROGRAM_ID; exports.Hadron = Hadron; exports.HadronOrderbook = HadronOrderbook; exports.Interpolation = Interpolation; exports.MAX_CURVE_UPDATE_OPS = MAX_CURVE_UPDATE_OPS; exports.MAX_SETCURVE_POINTS = MAX_SETCURVE_POINTS; exports.MIDPRICE_ORACLE_SEED = MIDPRICE_ORACLE_SEED; exports.MIDPRICE_ORACLE_SIZE = MIDPRICE_ORACLE_SIZE; exports.OracleMode = OracleMode; exports.POINT_DATA_SIZE = POINT_DATA_SIZE; exports.PoolState = PoolState; exports.Q32_ONE = Q32_ONE; exports.RiskMode = RiskMode; exports.SPREAD_CONFIG_SEED = SPREAD_CONFIG_SEED; exports.Side = Side; exports.buildAcceptAuthority = buildAcceptAuthority; exports.buildAllocateCurvePrefabs = buildAllocateCurvePrefabs; exports.buildApplyCurveUpdates = buildApplyCurveUpdates; exports.buildClosePool = buildClosePool; exports.buildDeposit = buildDeposit; exports.buildInitialize = buildInitialize; exports.buildInitializeFeeConfig = buildInitializeFeeConfig; exports.buildInitializeSpreadConfig = buildInitializeSpreadConfig; exports.buildNominateAuthority = buildNominateAuthority; exports.buildRotateFeeAdmin = buildRotateFeeAdmin; exports.buildSetCurve = buildSetCurve; exports.buildSetCurveBoth = buildSetCurveBoth; exports.buildSetPoolState = buildSetPoolState; exports.buildSetQuotingAuthority = buildSetQuotingAuthority; exports.buildSetRiskCurve = buildSetRiskCurve; exports.buildSetRiskCurveAbsolute = buildSetRiskCurveAbsolute; exports.buildSetRiskCurveAbsoluteBoth = buildSetRiskCurveAbsoluteBoth; exports.buildSetRiskCurveBoth = buildSetRiskCurveBoth; exports.buildSubmitCurveUpdates = buildSubmitCurveUpdates; exports.buildSwapExactIn = buildSwapExactIn; exports.buildSwitchPriceCurve = buildSwitchPriceCurve; exports.buildSwitchRiskCurve = buildSwitchRiskCurve; exports.buildUpdateBaseSpread = buildUpdateBaseSpread; exports.buildUpdateDeltaStaleness = buildUpdateDeltaStaleness; exports.buildUpdateFeeConfig = buildUpdateFeeConfig; exports.buildUpdateMidprice = buildUpdateMidprice; exports.buildUpdateMidpriceAndBaseSpread = buildUpdateMidpriceAndBaseSpread; exports.buildUpdateSpreadConfig = buildUpdateSpreadConfig; exports.buildWithdraw = buildWithdraw; exports.curvePrefabsSize = curvePrefabsSize; exports.decodeActiveCurves = decodeActiveCurves; exports.decodeConfig = decodeConfig; exports.decodeCurveMeta = decodeCurveMeta; exports.decodeCurveSide = decodeCurveSide; exports.decodeCurveUpdates = decodeCurveUpdates; exports.decodeFeeConfig = decodeFeeConfig; exports.decodeMidpriceOracle = decodeMidpriceOracle; exports.decodeSpreadConfig = decodeSpreadConfig; exports.derivePoolAddresses = derivePoolAddresses; exports.fromQ32 = fromQ32; exports.getConfigAddress = getConfigAddress; exports.getCurveMetaAddress = getCurveMetaAddress; exports.getCurvePrefabsAddress = getCurvePrefabsAddress; exports.getCurveUpdatesAddress = getCurveUpdatesAddress; exports.getFeeConfigAddress = getFeeConfigAddress; exports.getMidpriceOracleAddress = getMidpriceOracleAddress; exports.getOrCreateAta = getOrCreateAta; exports.getSpreadConfigAddress = getSpreadConfigAddress; exports.isSlotInitialized = isSlotInitialized; exports.pctToQ32 = pctToQ32; exports.spreadBpsToQ32 = spreadBpsToQ32; exports.spreadQ32ToBps = spreadQ32ToBps; exports.toQ32 = toQ32;
2305
2317
  //# sourceMappingURL=index.js.map