@hadron-fi/sdk 0.4.2 → 0.4.4

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
@@ -5,7 +5,7 @@ declare enum PoolState {
5
5
  Uninitialized = 0,
6
6
  Initialized = 1,
7
7
  Paused = 2,
8
- WithdrawOnly = 3
8
+ RejectSwaps = 3
9
9
  }
10
10
  declare enum OracleMode {
11
11
  /** Off-chain authority updates the oracle */
@@ -280,6 +280,7 @@ interface InitializeSpreadConfigParams {
280
280
  interface SpreadTriggerInput {
281
281
  account: PublicKey;
282
282
  spreadBps: number;
283
+ matchMode?: number;
283
284
  }
284
285
  interface UpdateSpreadConfigParams {
285
286
  triggers: SpreadTriggerInput[];
@@ -943,9 +944,9 @@ declare function buildUpdateSpreadConfig(admin: PublicKey, configPda: PublicKey,
943
944
  declare function buildSetPoolState(authority: PublicKey, configPda: PublicKey, params: SetPoolStateParams, programId?: PublicKey): TransactionInstruction;
944
945
  /**
945
946
  * Build an UpdateDeltaStaleness instruction.
946
- * Accounts: authority, config.
947
+ * Accounts: authority (quoting authority), config, curveMeta.
947
948
  */
948
- declare function buildUpdateDeltaStaleness(authority: PublicKey, configPda: PublicKey, params: UpdateDeltaStalenessParams, programId?: PublicKey): TransactionInstruction;
949
+ declare function buildUpdateDeltaStaleness(authority: PublicKey, configPda: PublicKey, curveMetaPda: PublicKey, params: UpdateDeltaStalenessParams, programId?: PublicKey): TransactionInstruction;
949
950
  /**
950
951
  * Build a ClosePool instruction.
951
952
  * Accounts: authority, config, midprice_oracle, curve_meta, curve_prefabs,
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ declare enum PoolState {
5
5
  Uninitialized = 0,
6
6
  Initialized = 1,
7
7
  Paused = 2,
8
- WithdrawOnly = 3
8
+ RejectSwaps = 3
9
9
  }
10
10
  declare enum OracleMode {
11
11
  /** Off-chain authority updates the oracle */
@@ -280,6 +280,7 @@ interface InitializeSpreadConfigParams {
280
280
  interface SpreadTriggerInput {
281
281
  account: PublicKey;
282
282
  spreadBps: number;
283
+ matchMode?: number;
283
284
  }
284
285
  interface UpdateSpreadConfigParams {
285
286
  triggers: SpreadTriggerInput[];
@@ -943,9 +944,9 @@ declare function buildUpdateSpreadConfig(admin: PublicKey, configPda: PublicKey,
943
944
  declare function buildSetPoolState(authority: PublicKey, configPda: PublicKey, params: SetPoolStateParams, programId?: PublicKey): TransactionInstruction;
944
945
  /**
945
946
  * Build an UpdateDeltaStaleness instruction.
946
- * Accounts: authority, config.
947
+ * Accounts: authority (quoting authority), config, curveMeta.
947
948
  */
948
- declare function buildUpdateDeltaStaleness(authority: PublicKey, configPda: PublicKey, params: UpdateDeltaStalenessParams, programId?: PublicKey): TransactionInstruction;
949
+ declare function buildUpdateDeltaStaleness(authority: PublicKey, configPda: PublicKey, curveMetaPda: PublicKey, params: UpdateDeltaStalenessParams, programId?: PublicKey): TransactionInstruction;
949
950
  /**
950
951
  * Build a ClosePool instruction.
951
952
  * Accounts: authority, config, midprice_oracle, curve_meta, curve_prefabs,
package/dist/index.js CHANGED
@@ -271,7 +271,7 @@ var PoolState = /* @__PURE__ */ ((PoolState3) => {
271
271
  PoolState3[PoolState3["Uninitialized"] = 0] = "Uninitialized";
272
272
  PoolState3[PoolState3["Initialized"] = 1] = "Initialized";
273
273
  PoolState3[PoolState3["Paused"] = 2] = "Paused";
274
- PoolState3[PoolState3["WithdrawOnly"] = 3] = "WithdrawOnly";
274
+ PoolState3[PoolState3["RejectSwaps"] = 3] = "RejectSwaps";
275
275
  return PoolState3;
276
276
  })(PoolState || {});
277
277
  var OracleMode = /* @__PURE__ */ ((OracleMode3) => {
@@ -422,7 +422,8 @@ function decodeSpreadConfig(data) {
422
422
  const off = triggersStart + i * SPREAD_TRIGGER_LEN;
423
423
  const account = new (0, _web3js.PublicKey)(buf.subarray(off, off + 32));
424
424
  const spreadBps = buf.readUInt16LE(off + 32);
425
- triggers.push({ account, spreadBps });
425
+ const matchMode = buf.readUInt8(off + 34);
426
+ triggers.push({ account, spreadBps, matchMode });
426
427
  }
427
428
  return { initialized, bump, numTriggers, admin, config, triggers };
428
429
  }
@@ -1254,7 +1255,7 @@ function buildInitializeSpreadConfig(payer, authority, configPda, params, progra
1254
1255
  function buildUpdateSpreadConfig(admin, configPda, params, programId = HADRON_PROGRAM_ID) {
1255
1256
  const [spreadConfigPda] = getSpreadConfigAddress(configPda, programId);
1256
1257
  const numTriggers = params.triggers.length;
1257
- const data = Buffer.alloc(1 + 1 + numTriggers * 34);
1258
+ const data = Buffer.alloc(1 + 1 + numTriggers * 35);
1258
1259
  let offset = 0;
1259
1260
  data.writeUInt8(Discriminator.UpdateSpreadConfig, offset);
1260
1261
  offset += 1;
@@ -1265,6 +1266,8 @@ function buildUpdateSpreadConfig(admin, configPda, params, programId = HADRON_PR
1265
1266
  offset += 32;
1266
1267
  data.writeUInt16LE(t.spreadBps, offset);
1267
1268
  offset += 2;
1269
+ data.writeUInt8(_nullishCoalesce(t.matchMode, () => ( 0)), offset);
1270
+ offset += 1;
1268
1271
  }
1269
1272
  return new (0, _web3js.TransactionInstruction)({
1270
1273
  programId,
@@ -1294,7 +1297,7 @@ function buildSetPoolState(authority, configPda, params, programId = HADRON_PROG
1294
1297
  data
1295
1298
  });
1296
1299
  }
1297
- function buildUpdateDeltaStaleness(authority, configPda, params, programId = HADRON_PROGRAM_ID) {
1300
+ function buildUpdateDeltaStaleness(authority, configPda, curveMetaPda, params, programId = HADRON_PROGRAM_ID) {
1298
1301
  const data = Buffer.alloc(1 + 1);
1299
1302
  data.writeUInt8(Discriminator.UpdateDeltaStaleness, 0);
1300
1303
  data.writeUInt8(params.deltaStaleness, 1);
@@ -1302,7 +1305,8 @@ function buildUpdateDeltaStaleness(authority, configPda, params, programId = HAD
1302
1305
  programId,
1303
1306
  keys: [
1304
1307
  { pubkey: authority, isSigner: true, isWritable: false },
1305
- { pubkey: configPda, isSigner: false, isWritable: true }
1308
+ { pubkey: configPda, isSigner: false, isWritable: true },
1309
+ { pubkey: curveMetaPda, isSigner: false, isWritable: false }
1306
1310
  ],
1307
1311
  data
1308
1312
  });
@@ -1732,6 +1736,7 @@ var Hadron = class _Hadron {
1732
1736
  return buildUpdateDeltaStaleness(
1733
1737
  authority,
1734
1738
  this.poolAddress,
1739
+ this.addresses.curveMeta,
1735
1740
  params,
1736
1741
  this.programId
1737
1742
  );