@merkl/api 0.15.37 → 0.15.38
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/src/eden/index.d.ts +5 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/modules/v4/campaign/campaign.repository.d.ts +1 -0
- package/dist/src/modules/v4/campaign/campaign.repository.js +14 -0
- package/dist/src/modules/v4/campaign/campaign.service.d.ts +1 -0
- package/dist/src/modules/v4/campaign/campaign.service.js +3 -0
- package/dist/src/modules/v4/router.d.ts +1 -0
- package/dist/src/modules/v4/status/status.controller.d.ts +1 -0
- package/dist/src/modules/v4/status/status.service.d.ts +1 -0
- package/dist/src/modules/v4/status/status.service.js +7 -2
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/src/eden/index.d.ts
CHANGED
@@ -2721,6 +2721,7 @@ declare const eden: {
|
|
2721
2721
|
distributionCreator: string;
|
2722
2722
|
endOfDisputePeriod: number;
|
2723
2723
|
disputer: string;
|
2724
|
+
liveCampaigns: number;
|
2724
2725
|
delayed: Awaited<ReturnType<typeof import("../modules/v4/status").StatusService.findManyDelay>>;
|
2725
2726
|
};
|
2726
2727
|
};
|
@@ -5805,6 +5806,7 @@ declare const eden: {
|
|
5805
5806
|
distributionCreator: string;
|
5806
5807
|
endOfDisputePeriod: number;
|
5807
5808
|
disputer: string;
|
5809
|
+
liveCampaigns: number;
|
5808
5810
|
delayed: Awaited<ReturnType<typeof import("../modules/v4/status").StatusService.findManyDelay>>;
|
5809
5811
|
};
|
5810
5812
|
};
|
@@ -10218,6 +10220,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
10218
10220
|
distributionCreator: string;
|
10219
10221
|
endOfDisputePeriod: number;
|
10220
10222
|
disputer: string;
|
10223
|
+
liveCampaigns: number;
|
10221
10224
|
delayed: Awaited<ReturnType<typeof import("../modules/v4/status").StatusService.findManyDelay>>;
|
10222
10225
|
};
|
10223
10226
|
};
|
@@ -14322,6 +14325,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
14322
14325
|
distributionCreator: string;
|
14323
14326
|
endOfDisputePeriod: number;
|
14324
14327
|
disputer: string;
|
14328
|
+
liveCampaigns: number;
|
14325
14329
|
delayed: Awaited<ReturnType<typeof import("../modules/v4/status").StatusService.findManyDelay>>;
|
14326
14330
|
};
|
14327
14331
|
};
|
@@ -17406,6 +17410,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
17406
17410
|
distributionCreator: string;
|
17407
17411
|
endOfDisputePeriod: number;
|
17408
17412
|
disputer: string;
|
17413
|
+
liveCampaigns: number;
|
17409
17414
|
delayed: Awaited<ReturnType<typeof import("../modules/v4/status").StatusService.findManyDelay>>;
|
17410
17415
|
};
|
17411
17416
|
};
|
package/dist/src/index.d.ts
CHANGED
@@ -3352,6 +3352,7 @@ declare const app: Elysia<"", false, {
|
|
3352
3352
|
distributionCreator: string;
|
3353
3353
|
endOfDisputePeriod: number;
|
3354
3354
|
disputer: string;
|
3355
|
+
liveCampaigns: number;
|
3355
3356
|
delayed: Awaited<ReturnType<typeof import("./modules/v4/status").StatusService.findManyDelay>>;
|
3356
3357
|
};
|
3357
3358
|
};
|
@@ -194,6 +194,7 @@ export declare abstract class CampaignRepository {
|
|
194
194
|
creatorAddress: string;
|
195
195
|
})[]>;
|
196
196
|
static countMany(query: GetCampaignQueryModel): Promise<number>;
|
197
|
+
static countLives(chainId: number): Promise<number>;
|
197
198
|
static findManyCampaignId(chainId: ChainId): Promise<{
|
198
199
|
campaignId: string;
|
199
200
|
}[]>;
|
@@ -299,6 +299,20 @@ export class CampaignRepository {
|
|
299
299
|
const args = CampaignRepository.transformQueryToPrismaFilters(query);
|
300
300
|
return await apiDbClient.campaign.count(args);
|
301
301
|
}
|
302
|
+
static async countLives(chainId) {
|
303
|
+
const now = moment().unix();
|
304
|
+
return await apiDbClient.campaign.count({
|
305
|
+
where: {
|
306
|
+
distributionChainId: chainId,
|
307
|
+
endTimestamp: {
|
308
|
+
gte: now,
|
309
|
+
},
|
310
|
+
startTimestamp: {
|
311
|
+
lte: now,
|
312
|
+
},
|
313
|
+
},
|
314
|
+
});
|
315
|
+
}
|
302
316
|
static async findManyCampaignId(chainId) {
|
303
317
|
return await apiDbClient.campaign.findMany({
|
304
318
|
select: {
|
@@ -98,6 +98,7 @@ export declare abstract class CampaignService {
|
|
98
98
|
* @returns the number of campaigns
|
99
99
|
*/
|
100
100
|
static countMany(query: GetCampaignQueryModel): Promise<number>;
|
101
|
+
static countLives(chainId: number): Promise<number>;
|
101
102
|
static checkIfExist(campaign: CampaignUnique): Promise<boolean>;
|
102
103
|
static checkIfIdExist(id: string): Promise<boolean>;
|
103
104
|
static findUnique(campaign: CampaignUnique): Promise<{
|
@@ -137,6 +137,9 @@ export class CampaignService {
|
|
137
137
|
}
|
138
138
|
return await CampaignRepository.countMany(query);
|
139
139
|
}
|
140
|
+
static async countLives(chainId) {
|
141
|
+
return await CampaignRepository.countLives(chainId);
|
142
|
+
}
|
140
143
|
static async checkIfExist(campaign) {
|
141
144
|
return await CampaignRepository.checkIfExist(campaign);
|
142
145
|
}
|
@@ -3222,6 +3222,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
3222
3222
|
distributionCreator: string;
|
3223
3223
|
endOfDisputePeriod: number;
|
3224
3224
|
disputer: string;
|
3225
|
+
liveCampaigns: number;
|
3225
3226
|
delayed: Awaited<ReturnType<typeof import("./status").StatusService.findManyDelay>>;
|
3226
3227
|
};
|
3227
3228
|
};
|
@@ -171,6 +171,7 @@ export declare const StatusController: Elysia<"/campaign-status", false, {
|
|
171
171
|
distributionCreator: string;
|
172
172
|
endOfDisputePeriod: number;
|
173
173
|
disputer: string;
|
174
|
+
liveCampaigns: number;
|
174
175
|
delayed: Awaited<ReturnType<typeof StatusService.findManyDelay>>;
|
175
176
|
};
|
176
177
|
};
|
@@ -45,6 +45,7 @@ export declare class StatusService {
|
|
45
45
|
distributionCreator: string;
|
46
46
|
endOfDisputePeriod: number;
|
47
47
|
disputer: string;
|
48
|
+
liveCampaigns: number;
|
48
49
|
delayed: Awaited<ReturnType<typeof StatusService.findManyDelay>>;
|
49
50
|
}>>;
|
50
51
|
static findManyDelay(query: DelayModel): Promise<{
|
@@ -57,11 +57,15 @@ export class StatusService {
|
|
57
57
|
}
|
58
58
|
static async findUpdatesAndDelays() {
|
59
59
|
const merklRoots = await MerklRootService.fetchAll();
|
60
|
-
const delayedCampaignPromises =
|
60
|
+
const delayedCampaignPromises = Promise.allSettled(Object.keys(merklRoots).map(chainId => StatusService.findManyDelay({ chainId: Number.parseInt(chainId), delayLowerBound: 8 * HOUR })));
|
61
|
+
const liveCampaignPromises = await Promise.allSettled(Object.keys(merklRoots).map(chainId => CampaignService.countLives(Number.parseInt(chainId))));
|
62
|
+
const delayedCampaignArray = await delayedCampaignPromises;
|
63
|
+
const liveCampaignArray = await liveCampaignPromises;
|
61
64
|
const res = {};
|
62
65
|
for (const [index, chainIdString] of Object.keys(merklRoots).entries()) {
|
63
66
|
const chainId = Number.parseInt(chainIdString);
|
64
|
-
const delayedCampaigns =
|
67
|
+
const delayedCampaigns = delayedCampaignArray[index].status === "rejected" ? [] : delayedCampaignArray[index].value;
|
68
|
+
const liveCampaigns = liveCampaignArray[index].status === "rejected" ? 0 : liveCampaignArray[index].value;
|
65
69
|
if (!registry(chainId)?.Merkl?.DistributionCreator ||
|
66
70
|
!registry(chainId)?.Merkl?.Distributor ||
|
67
71
|
!registry(chainId)?.AngleLabs) {
|
@@ -78,6 +82,7 @@ export class StatusService {
|
|
78
82
|
adminUrl,
|
79
83
|
distributor: registry(chainId)?.Merkl?.Distributor,
|
80
84
|
distributionCreator: registry(chainId)?.Merkl?.DistributionCreator,
|
85
|
+
liveCampaigns,
|
81
86
|
delayed: delayedCampaigns,
|
82
87
|
};
|
83
88
|
}
|