@hadron-fi/sdk 0.1.0 → 0.3.0

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
@@ -92,7 +92,7 @@ interface DecodedCurveUpdates {
92
92
  ops: CurveUpdateOp[];
93
93
  }
94
94
  interface CurvePoint {
95
- xIn: bigint;
95
+ amountIn: bigint;
96
96
  priceFactorQ32: bigint;
97
97
  interpolation: Interpolation;
98
98
  params: Uint8Array;
@@ -109,7 +109,7 @@ interface CurveUpdateOp {
109
109
  opKind: CurveUpdateOpKind;
110
110
  pointIndex: number;
111
111
  interpolation: Interpolation;
112
- xIn: bigint;
112
+ amountIn: bigint;
113
113
  priceFactorQ32: bigint;
114
114
  params: Uint8Array;
115
115
  }
@@ -146,7 +146,7 @@ interface SwapParams {
146
146
  expiration?: number;
147
147
  }
148
148
  interface SetCurvePointInput {
149
- xIn: bigint;
149
+ amountIn: bigint;
150
150
  /** Price factor as floating point (e.g. 0.99). Converted to Q32 internally. */
151
151
  priceFactor: number;
152
152
  interpolation?: Interpolation;
@@ -450,7 +450,7 @@ declare const Discriminator: {
450
450
  };
451
451
  /** Per-point data in SetCurve/SetRiskCurve: u64 + u64 + u8 + 4 params = 21 bytes */
452
452
  declare const POINT_DATA_SIZE = 21;
453
- /** Per-op data in SubmitCurveUpdates: curve_type(1)+op_kind(1)+point_index(1)+interp(1)+x_in(8)+price(8)+params(4) = 24 bytes */
453
+ /** Per-op data in SubmitCurveUpdates: curve_type(1)+op_kind(1)+point_index(1)+interp(1)+amount_in(8)+price(8)+params(4) = 24 bytes */
454
454
  declare const CURVE_UPDATE_OP_SIZE = 24;
455
455
  /** Compute CurvePrefabs account size for given pool parameters. */
456
456
  declare function curvePrefabsSize(maxSlots: number, maxPoints: number): number;
package/dist/index.d.ts CHANGED
@@ -92,7 +92,7 @@ interface DecodedCurveUpdates {
92
92
  ops: CurveUpdateOp[];
93
93
  }
94
94
  interface CurvePoint {
95
- xIn: bigint;
95
+ amountIn: bigint;
96
96
  priceFactorQ32: bigint;
97
97
  interpolation: Interpolation;
98
98
  params: Uint8Array;
@@ -109,7 +109,7 @@ interface CurveUpdateOp {
109
109
  opKind: CurveUpdateOpKind;
110
110
  pointIndex: number;
111
111
  interpolation: Interpolation;
112
- xIn: bigint;
112
+ amountIn: bigint;
113
113
  priceFactorQ32: bigint;
114
114
  params: Uint8Array;
115
115
  }
@@ -146,7 +146,7 @@ interface SwapParams {
146
146
  expiration?: number;
147
147
  }
148
148
  interface SetCurvePointInput {
149
- xIn: bigint;
149
+ amountIn: bigint;
150
150
  /** Price factor as floating point (e.g. 0.99). Converted to Q32 internally. */
151
151
  priceFactor: number;
152
152
  interpolation?: Interpolation;
@@ -450,7 +450,7 @@ declare const Discriminator: {
450
450
  };
451
451
  /** Per-point data in SetCurve/SetRiskCurve: u64 + u64 + u8 + 4 params = 21 bytes */
452
452
  declare const POINT_DATA_SIZE = 21;
453
- /** Per-op data in SubmitCurveUpdates: curve_type(1)+op_kind(1)+point_index(1)+interp(1)+x_in(8)+price(8)+params(4) = 24 bytes */
453
+ /** Per-op data in SubmitCurveUpdates: curve_type(1)+op_kind(1)+point_index(1)+interp(1)+amount_in(8)+price(8)+params(4) = 24 bytes */
454
454
  declare const CURVE_UPDATE_OP_SIZE = 24;
455
455
  /** Compute CurvePrefabs account size for given pool parameters. */
456
456
  declare function curvePrefabsSize(maxSlots: number, maxPoints: number): number;
package/dist/index.js CHANGED
@@ -327,7 +327,7 @@ function decodeCurveUpdates(data) {
327
327
  opKind: buf.readUInt8(opOffset + 1),
328
328
  pointIndex: buf.readUInt8(opOffset + 2),
329
329
  interpolation: buf.readUInt8(opOffset + 3),
330
- xIn: buf.readBigUInt64LE(opOffset + 4),
330
+ amountIn: buf.readBigUInt64LE(opOffset + 4),
331
331
  priceFactorQ32: buf.readBigUInt64LE(opOffset + 12),
332
332
  params: new Uint8Array(buf.subarray(opOffset + 20, opOffset + 24))
333
333
  });
@@ -348,7 +348,7 @@ function decodeCurveSide(data, curveType, slot, maxSlots, maxPoints) {
348
348
  for (let i = 0; i < n; i++) {
349
349
  const pOff = pointsStart + i * CURVE_POINT_LEN;
350
350
  points.push({
351
- xIn: buf.readBigUInt64LE(pOff),
351
+ amountIn: buf.readBigUInt64LE(pOff),
352
352
  priceFactorQ32: buf.readBigUInt64LE(pOff + 8),
353
353
  interpolation: buf.readUInt8(pOff + 16),
354
354
  params: new Uint8Array(buf.subarray(pOff + 17, pOff + 21))
@@ -664,7 +664,7 @@ function buildSetCurve(authority, curveMetaPda, curvePrefabsPda, params, program
664
664
  data.writeUInt8(xMode, offset);
665
665
  offset += 1;
666
666
  for (const p of params.points) {
667
- data.writeBigUInt64LE(p.xIn, offset);
667
+ data.writeBigUInt64LE(p.amountIn, offset);
668
668
  offset += 8;
669
669
  data.writeBigUInt64LE(toQ32(p.priceFactor), offset);
670
670
  offset += 8;
@@ -897,7 +897,7 @@ function buildSubmitCurveUpdates(authority, curveUpdatesPda, ops, programId = HA
897
897
  offset += 1;
898
898
  data.writeUInt8(op.interpolation, offset);
899
899
  offset += 1;
900
- data.writeBigUInt64LE(op.xIn, offset);
900
+ data.writeBigUInt64LE(op.amountIn, offset);
901
901
  offset += 8;
902
902
  data.writeBigUInt64LE(op.priceFactorQ32, offset);
903
903
  offset += 8;