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