@merkl/api 0.14.5 → 0.14.7

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.
@@ -16,6 +16,10 @@ const gcsClient = new S3Client({
16
16
  let file = gcsClient.file(`rewards/${process.env.CHAIN_ID}-${process.env.ROOT}`);
17
17
  if (!(await file.exists()))
18
18
  file = gcsClient.file(`rewards/${process.env.CHAIN_ID}-${process.env.ROOT}.gz`);
19
+ if (!(await file.exists())) {
20
+ log.error("rewards", "File does not exist.");
21
+ process.exit(0);
22
+ }
19
23
  const failedBatches = [];
20
24
  // ─── Extract ─────────────────────────────────────────────────────────────────
21
25
  const extract = async () => {
@@ -6,6 +6,7 @@ import { OpportunityService } from "../opportunity";
6
6
  import { InvalidParameter } from "../../../utils/error";
7
7
  import { executeSimple } from "../../../utils/execute";
8
8
  import { log } from "../../../utils/logger";
9
+ import { apiDbClient } from "../../../utils/prisma";
9
10
  import { NETWORK_LABELS, } from "@sdk";
10
11
  import { utils } from "ethers";
11
12
  import moment from "moment";
@@ -151,6 +152,17 @@ export class CampaignService {
151
152
  return await CampaignRepository.findUniqueOrThrow(id);
152
153
  }
153
154
  static async findCampaignsToProcess(distributionChainId) {
155
+ await apiDbClient.campaignStatus.updateMany({
156
+ data: {
157
+ status: "SUCCESS",
158
+ },
159
+ where: {
160
+ Campaign: {
161
+ distributionChainId: 324,
162
+ },
163
+ status: "PROCESSING",
164
+ },
165
+ });
154
166
  return (await CampaignRepository.findCampaignsToProcess(distributionChainId)).filter(campaign => campaign.endTimestamp > campaign?.CampaignStatus?.[0]?.computedUntil);
155
167
  }
156
168
  static async findNextCampaignToProcess(chainId) {