@interest-protocol/vortex-sdk 7.4.0 → 7.5.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.mjs CHANGED
@@ -39241,7 +39241,8 @@ const getUnspentUtxosWithApi = async ({ commitments, vortexKeypair, vortexSdk, v
39241
39241
  invariant(normalizeStructTag(commitment.coinType) ===
39242
39242
  normalizeStructTag(vortexObject.coinType), 'Commitment coin type does not match vortex pool coin type');
39243
39243
  try {
39244
- const utxo = vortexKeypair.decryptUtxo(commitment.encryptedOutput);
39244
+ const encryptedOutputHex = toHex(Uint8Array.from(commitment.encryptedOutput));
39245
+ const utxo = vortexKeypair.decryptUtxo(encryptedOutputHex);
39245
39246
  allUtxos.push(utxo);
39246
39247
  }
39247
39248
  catch {
@@ -39851,13 +39852,13 @@ class VortexAPI {
39851
39852
  }
39852
39853
  async getPools(args = {}) {
39853
39854
  const params = new URLSearchParams();
39854
- if (args.page !== undefined) {
39855
+ if (args.page) {
39855
39856
  params.set('page', args.page.toString());
39856
39857
  }
39857
- if (args.limit !== undefined) {
39858
+ if (args.limit) {
39858
39859
  params.set('limit', args.limit.toString());
39859
39860
  }
39860
- if (args.coinType !== undefined) {
39861
+ if (args.coinType) {
39861
39862
  params.set('coin_type', args.coinType);
39862
39863
  }
39863
39864
  const query = params.toString();
@@ -39871,19 +39872,31 @@ class VortexAPI {
39871
39872
  coin_type: args.coinType,
39872
39873
  index: args.index.toString(),
39873
39874
  });
39874
- if (args.op !== undefined) {
39875
+ if (args.op) {
39875
39876
  params.set('op', args.op);
39876
39877
  }
39877
- if (args.page !== undefined) {
39878
+ if (args.page) {
39878
39879
  params.set('page', args.page.toString());
39879
39880
  }
39880
- if (args.limit !== undefined) {
39881
+ if (args.limit) {
39881
39882
  params.set('limit', args.limit.toString());
39882
39883
  }
39883
39884
  const response = await __classPrivateFieldGet(this, _VortexAPI_instances, "m", _VortexAPI_get).call(this, `/api/v1/commitments?${params.toString()}`);
39884
39885
  __classPrivateFieldGet(this, _VortexAPI_instances, "m", _VortexAPI_assertSuccess).call(this, response);
39885
39886
  return response;
39886
39887
  }
39888
+ async getAllCommitments(args) {
39889
+ const allCommitments = [];
39890
+ let page = 1;
39891
+ let hasNext = true;
39892
+ while (hasNext) {
39893
+ const response = await this.getCommitments({ ...args, page });
39894
+ allCommitments.push(...response.data.items);
39895
+ hasNext = response.data.pagination.hasNext;
39896
+ page++;
39897
+ }
39898
+ return allCommitments;
39899
+ }
39887
39900
  async getMerklePath(args) {
39888
39901
  const response = await __classPrivateFieldGet(this, _VortexAPI_instances, "m", _VortexAPI_post).call(this, '/api/v1/merkle/path', {
39889
39902
  coin_type: args.coinType,