@interest-protocol/vortex-sdk 12.0.4 → 13.0.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
@@ -39837,9 +39837,6 @@ class VortexAPI {
39837
39837
  if (args.op) {
39838
39838
  params.set('op', args.op);
39839
39839
  }
39840
- if (args.page) {
39841
- params.set('page', args.page.toString());
39842
- }
39843
39840
  if (args.limit) {
39844
39841
  params.set('limit', args.limit.toString());
39845
39842
  }
@@ -39850,20 +39847,23 @@ class VortexAPI {
39850
39847
  async getAllCommitments(args) {
39851
39848
  const sleepMs = Math.max(args.sleepMs ?? 200, 200);
39852
39849
  const allCommitments = [];
39853
- let page = 1;
39850
+ let index = args.index;
39854
39851
  let hasNext = true;
39855
39852
  while (hasNext) {
39856
39853
  const response = await this.getCommitments({
39857
39854
  ...args,
39858
- page,
39855
+ index,
39859
39856
  apiKey: args.apiKey,
39860
39857
  });
39861
39858
  allCommitments.push(...response.data.items);
39862
- hasNext = response.data.pagination.hasNext;
39863
- page++;
39864
- if (hasNext) {
39859
+ hasNext = response.data.hasNext;
39860
+ if (hasNext && response.data.items.length > 0) {
39861
+ index = response.data.items[response.data.items.length - 1].index + 1;
39865
39862
  await new Promise((resolve) => setTimeout(resolve, sleepMs));
39866
39863
  }
39864
+ else {
39865
+ hasNext = false;
39866
+ }
39867
39867
  }
39868
39868
  return allCommitments;
39869
39869
  }