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