@merkl/api 0.16.36 → 0.16.37

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.
@@ -54,7 +54,9 @@ export const opportunityUpdater = (app) => {
54
54
  await Redis.safeSet("OpportunitiesWithTest", opportunitiesWithTest);
55
55
  log.info("✅ opportunity cache updated successfully");
56
56
  await OpportunityConvertorService.setV3Opportunities(true, false, undefined, undefined);
57
+ log.info("✅ opportunity v3 cache updated successfully");
57
58
  await OpportunityConvertorService.setV3Opportunities(true, true, undefined, undefined);
59
+ log.info("✅ opportunity v3 test cache updated successfully");
58
60
  return new Response(JSON.stringify({
59
61
  status: "success",
60
62
  all: getUpdateBreakdown(opportunities),
@@ -130,13 +130,28 @@ export class OpportunityConvertorService {
130
130
  };
131
131
  }
132
132
  static async #extractV3Opportunities(showCampaigns, test, identifier, chainId) {
133
- const opportunities = await OpportunityService.findMany({
134
- items: 10_000, // HARDCODED LIMIT
135
- test,
136
- identifier,
137
- chainId,
138
- campaigns: true,
139
- });
133
+ let opportunities = [];
134
+ let page = 0;
135
+ while (true) {
136
+ try {
137
+ const opportunitiesPage = await OpportunityService.findMany({
138
+ items: 100, // HARDCODED LIMIT
139
+ page,
140
+ test,
141
+ identifier,
142
+ chainId,
143
+ campaigns: true,
144
+ });
145
+ console.log(page, opportunitiesPage.length);
146
+ opportunities = opportunities.concat(opportunitiesPage);
147
+ if (opportunitiesPage.length === 0)
148
+ break;
149
+ }
150
+ catch {
151
+ break;
152
+ }
153
+ page++;
154
+ }
140
155
  const res = {};
141
156
  for (const opportunity of opportunities) {
142
157
  const opportunityV3 = OpportunityConvertorService.convertV4toV3(opportunity, showCampaigns);