@merkl/api 0.16.9 → 0.16.11
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/constants.d.ts +13 -259
- package/dist/src/eden/index.d.ts +10 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +1 -0
- package/dist/src/modules/v4/campaign/campaign.repository.d.ts +3 -3
- package/dist/src/modules/v4/campaign/campaign.repository.js +5 -13
- package/dist/src/modules/v4/campaign/campaign.service.d.ts +14 -7
- package/dist/src/modules/v4/campaign/campaign.service.js +38 -32
- package/dist/src/modules/v4/dynamicData/dynamicData.service.d.ts +1 -1
- package/dist/src/modules/v4/dynamicData/dynamicData.service.js +3 -3
- package/dist/src/modules/v4/router.d.ts +2 -0
- package/dist/src/modules/v4/status/status.controller.d.ts +1 -0
- package/dist/src/modules/v4/status/status.repository.d.ts +10 -2
- package/dist/src/modules/v4/status/status.repository.js +23 -11
- package/dist/src/modules/v4/status/status.service.d.ts +1 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/src/constants.d.ts
CHANGED
@@ -31,7 +31,7 @@ export declare const DOPEX_OPTION_MARKET: {
|
|
31
31
|
[market: string]: string;
|
32
32
|
};
|
33
33
|
export declare const constantChain: {
|
34
|
-
[
|
34
|
+
[ChainId.MAINNET]: {
|
35
35
|
apw: string;
|
36
36
|
convexEndpoint: string;
|
37
37
|
crv: string;
|
@@ -55,28 +55,8 @@ export declare const constantChain: {
|
|
55
55
|
usdc: string;
|
56
56
|
weth: string;
|
57
57
|
wstETH: string;
|
58
|
-
|
59
|
-
|
60
|
-
convexProxy?: undefined;
|
61
|
-
crv2Pool?: undefined;
|
62
|
-
jeur?: undefined;
|
63
|
-
ram?: undefined;
|
64
|
-
sliz?: undefined;
|
65
|
-
mai?: undefined;
|
66
|
-
op?: undefined;
|
67
|
-
usdce?: undefined;
|
68
|
-
velo?: undefined;
|
69
|
-
veloV2?: undefined;
|
70
|
-
aero?: undefined;
|
71
|
-
am3CRV?: undefined;
|
72
|
-
amDAI?: undefined;
|
73
|
-
amUSDC?: undefined;
|
74
|
-
amUSDT?: undefined;
|
75
|
-
jrt?: undefined;
|
76
|
-
oretro?: undefined;
|
77
|
-
glcr?: undefined;
|
78
|
-
cake?: undefined;
|
79
|
-
} | {
|
58
|
+
};
|
59
|
+
[ChainId.ARBITRUM]: {
|
80
60
|
arb: string;
|
81
61
|
chr: string;
|
82
62
|
convexProxy: string;
|
@@ -90,38 +70,8 @@ export declare const constantChain: {
|
|
90
70
|
sliz: string;
|
91
71
|
stakeEndpoint: string;
|
92
72
|
usdc: string;
|
93
|
-
|
94
|
-
|
95
|
-
crv3?: undefined;
|
96
|
-
crvANGLESDANGLE?: undefined;
|
97
|
-
crvEURAEUROC?: undefined;
|
98
|
-
crvEURAEURe?: undefined;
|
99
|
-
crvEuropool?: undefined;
|
100
|
-
crvFRAX?: undefined;
|
101
|
-
crvFRAXEURA?: undefined;
|
102
|
-
crvLUSD3CRV?: undefined;
|
103
|
-
dai?: undefined;
|
104
|
-
fxs?: undefined;
|
105
|
-
morpho?: undefined;
|
106
|
-
rKP3R?: undefined;
|
107
|
-
sushi?: undefined;
|
108
|
-
weth?: undefined;
|
109
|
-
wstETH?: undefined;
|
110
|
-
mai?: undefined;
|
111
|
-
op?: undefined;
|
112
|
-
usdce?: undefined;
|
113
|
-
velo?: undefined;
|
114
|
-
veloV2?: undefined;
|
115
|
-
aero?: undefined;
|
116
|
-
am3CRV?: undefined;
|
117
|
-
amDAI?: undefined;
|
118
|
-
amUSDC?: undefined;
|
119
|
-
amUSDT?: undefined;
|
120
|
-
jrt?: undefined;
|
121
|
-
oretro?: undefined;
|
122
|
-
glcr?: undefined;
|
123
|
-
cake?: undefined;
|
124
|
-
} | {
|
73
|
+
};
|
74
|
+
[ChainId.OPTIMISM]: {
|
125
75
|
jeur: string;
|
126
76
|
mai: string;
|
127
77
|
op: string;
|
@@ -129,89 +79,12 @@ export declare const constantChain: {
|
|
129
79
|
usdce: string;
|
130
80
|
velo: string;
|
131
81
|
veloV2: string;
|
132
|
-
|
133
|
-
|
134
|
-
crv?: undefined;
|
135
|
-
crv3?: undefined;
|
136
|
-
crvANGLESDANGLE?: undefined;
|
137
|
-
crvEURAEUROC?: undefined;
|
138
|
-
crvEURAEURe?: undefined;
|
139
|
-
crvEuropool?: undefined;
|
140
|
-
crvFRAX?: undefined;
|
141
|
-
crvFRAXEURA?: undefined;
|
142
|
-
crvLUSD3CRV?: undefined;
|
143
|
-
cvx?: undefined;
|
144
|
-
dai?: undefined;
|
145
|
-
frax?: undefined;
|
146
|
-
fxs?: undefined;
|
147
|
-
morpho?: undefined;
|
148
|
-
rKP3R?: undefined;
|
149
|
-
sdt?: undefined;
|
150
|
-
stakeEndpoint?: undefined;
|
151
|
-
sushi?: undefined;
|
152
|
-
weth?: undefined;
|
153
|
-
wstETH?: undefined;
|
154
|
-
arb?: undefined;
|
155
|
-
chr?: undefined;
|
156
|
-
convexProxy?: undefined;
|
157
|
-
crv2Pool?: undefined;
|
158
|
-
ram?: undefined;
|
159
|
-
sliz?: undefined;
|
160
|
-
aero?: undefined;
|
161
|
-
am3CRV?: undefined;
|
162
|
-
amDAI?: undefined;
|
163
|
-
amUSDC?: undefined;
|
164
|
-
amUSDT?: undefined;
|
165
|
-
jrt?: undefined;
|
166
|
-
oretro?: undefined;
|
167
|
-
glcr?: undefined;
|
168
|
-
cake?: undefined;
|
169
|
-
} | {
|
82
|
+
};
|
83
|
+
[ChainId.BASE]: {
|
170
84
|
aero: string;
|
171
85
|
usdc: string;
|
172
|
-
|
173
|
-
|
174
|
-
crv?: undefined;
|
175
|
-
crv3?: undefined;
|
176
|
-
crvANGLESDANGLE?: undefined;
|
177
|
-
crvEURAEUROC?: undefined;
|
178
|
-
crvEURAEURe?: undefined;
|
179
|
-
crvEuropool?: undefined;
|
180
|
-
crvFRAX?: undefined;
|
181
|
-
crvFRAXEURA?: undefined;
|
182
|
-
crvLUSD3CRV?: undefined;
|
183
|
-
cvx?: undefined;
|
184
|
-
dai?: undefined;
|
185
|
-
frax?: undefined;
|
186
|
-
fxs?: undefined;
|
187
|
-
morpho?: undefined;
|
188
|
-
rKP3R?: undefined;
|
189
|
-
sdt?: undefined;
|
190
|
-
stakeEndpoint?: undefined;
|
191
|
-
sushi?: undefined;
|
192
|
-
weth?: undefined;
|
193
|
-
wstETH?: undefined;
|
194
|
-
arb?: undefined;
|
195
|
-
chr?: undefined;
|
196
|
-
convexProxy?: undefined;
|
197
|
-
crv2Pool?: undefined;
|
198
|
-
jeur?: undefined;
|
199
|
-
ram?: undefined;
|
200
|
-
sliz?: undefined;
|
201
|
-
mai?: undefined;
|
202
|
-
op?: undefined;
|
203
|
-
usdce?: undefined;
|
204
|
-
velo?: undefined;
|
205
|
-
veloV2?: undefined;
|
206
|
-
am3CRV?: undefined;
|
207
|
-
amDAI?: undefined;
|
208
|
-
amUSDC?: undefined;
|
209
|
-
amUSDT?: undefined;
|
210
|
-
jrt?: undefined;
|
211
|
-
oretro?: undefined;
|
212
|
-
glcr?: undefined;
|
213
|
-
cake?: undefined;
|
214
|
-
} | {
|
86
|
+
};
|
87
|
+
[ChainId.POLYGON]: {
|
215
88
|
am3CRV: string;
|
216
89
|
amDAI: string;
|
217
90
|
amUSDC: string;
|
@@ -220,132 +93,13 @@ export declare const constantChain: {
|
|
220
93
|
jrt: string;
|
221
94
|
oretro: string;
|
222
95
|
usdc: string;
|
223
|
-
|
224
|
-
|
225
|
-
crv?: undefined;
|
226
|
-
crv3?: undefined;
|
227
|
-
crvANGLESDANGLE?: undefined;
|
228
|
-
crvEURAEUROC?: undefined;
|
229
|
-
crvEURAEURe?: undefined;
|
230
|
-
crvEuropool?: undefined;
|
231
|
-
crvFRAX?: undefined;
|
232
|
-
crvFRAXEURA?: undefined;
|
233
|
-
crvLUSD3CRV?: undefined;
|
234
|
-
cvx?: undefined;
|
235
|
-
dai?: undefined;
|
236
|
-
frax?: undefined;
|
237
|
-
fxs?: undefined;
|
238
|
-
morpho?: undefined;
|
239
|
-
rKP3R?: undefined;
|
240
|
-
sdt?: undefined;
|
241
|
-
stakeEndpoint?: undefined;
|
242
|
-
sushi?: undefined;
|
243
|
-
weth?: undefined;
|
244
|
-
wstETH?: undefined;
|
245
|
-
arb?: undefined;
|
246
|
-
chr?: undefined;
|
247
|
-
convexProxy?: undefined;
|
248
|
-
crv2Pool?: undefined;
|
249
|
-
ram?: undefined;
|
250
|
-
sliz?: undefined;
|
251
|
-
mai?: undefined;
|
252
|
-
op?: undefined;
|
253
|
-
usdce?: undefined;
|
254
|
-
velo?: undefined;
|
255
|
-
veloV2?: undefined;
|
256
|
-
aero?: undefined;
|
257
|
-
glcr?: undefined;
|
258
|
-
cake?: undefined;
|
259
|
-
} | {
|
96
|
+
};
|
97
|
+
[ChainId.AVALANCHE]: {
|
260
98
|
glcr: string;
|
261
99
|
usdc: string;
|
262
|
-
|
263
|
-
|
264
|
-
crv?: undefined;
|
265
|
-
crv3?: undefined;
|
266
|
-
crvANGLESDANGLE?: undefined;
|
267
|
-
crvEURAEUROC?: undefined;
|
268
|
-
crvEURAEURe?: undefined;
|
269
|
-
crvEuropool?: undefined;
|
270
|
-
crvFRAX?: undefined;
|
271
|
-
crvFRAXEURA?: undefined;
|
272
|
-
crvLUSD3CRV?: undefined;
|
273
|
-
cvx?: undefined;
|
274
|
-
dai?: undefined;
|
275
|
-
frax?: undefined;
|
276
|
-
fxs?: undefined;
|
277
|
-
morpho?: undefined;
|
278
|
-
rKP3R?: undefined;
|
279
|
-
sdt?: undefined;
|
280
|
-
stakeEndpoint?: undefined;
|
281
|
-
sushi?: undefined;
|
282
|
-
weth?: undefined;
|
283
|
-
wstETH?: undefined;
|
284
|
-
arb?: undefined;
|
285
|
-
chr?: undefined;
|
286
|
-
convexProxy?: undefined;
|
287
|
-
crv2Pool?: undefined;
|
288
|
-
jeur?: undefined;
|
289
|
-
ram?: undefined;
|
290
|
-
sliz?: undefined;
|
291
|
-
mai?: undefined;
|
292
|
-
op?: undefined;
|
293
|
-
usdce?: undefined;
|
294
|
-
velo?: undefined;
|
295
|
-
veloV2?: undefined;
|
296
|
-
aero?: undefined;
|
297
|
-
am3CRV?: undefined;
|
298
|
-
amDAI?: undefined;
|
299
|
-
amUSDC?: undefined;
|
300
|
-
amUSDT?: undefined;
|
301
|
-
jrt?: undefined;
|
302
|
-
oretro?: undefined;
|
303
|
-
cake?: undefined;
|
304
|
-
} | {
|
100
|
+
};
|
101
|
+
[ChainId.BSC]: {
|
305
102
|
cake: string;
|
306
|
-
apw?: undefined;
|
307
|
-
convexEndpoint?: undefined;
|
308
|
-
crv?: undefined;
|
309
|
-
crv3?: undefined;
|
310
|
-
crvANGLESDANGLE?: undefined;
|
311
|
-
crvEURAEUROC?: undefined;
|
312
|
-
crvEURAEURe?: undefined;
|
313
|
-
crvEuropool?: undefined;
|
314
|
-
crvFRAX?: undefined;
|
315
|
-
crvFRAXEURA?: undefined;
|
316
|
-
crvLUSD3CRV?: undefined;
|
317
|
-
cvx?: undefined;
|
318
|
-
dai?: undefined;
|
319
|
-
frax?: undefined;
|
320
|
-
fxs?: undefined;
|
321
|
-
morpho?: undefined;
|
322
|
-
rKP3R?: undefined;
|
323
|
-
sdt?: undefined;
|
324
|
-
stakeEndpoint?: undefined;
|
325
|
-
sushi?: undefined;
|
326
|
-
usdc?: undefined;
|
327
|
-
weth?: undefined;
|
328
|
-
wstETH?: undefined;
|
329
|
-
arb?: undefined;
|
330
|
-
chr?: undefined;
|
331
|
-
convexProxy?: undefined;
|
332
|
-
crv2Pool?: undefined;
|
333
|
-
jeur?: undefined;
|
334
|
-
ram?: undefined;
|
335
|
-
sliz?: undefined;
|
336
|
-
mai?: undefined;
|
337
|
-
op?: undefined;
|
338
|
-
usdce?: undefined;
|
339
|
-
velo?: undefined;
|
340
|
-
veloV2?: undefined;
|
341
|
-
aero?: undefined;
|
342
|
-
am3CRV?: undefined;
|
343
|
-
amDAI?: undefined;
|
344
|
-
amUSDC?: undefined;
|
345
|
-
amUSDT?: undefined;
|
346
|
-
jrt?: undefined;
|
347
|
-
oretro?: undefined;
|
348
|
-
glcr?: undefined;
|
349
103
|
};
|
350
104
|
};
|
351
105
|
export declare const MAVERICK_ZKSYNC_BP_LENS_ADDRESS = "0xd32CE31CaC98CAC0631764B8286358c0606D87F9";
|
package/dist/src/eden/index.d.ts
CHANGED
@@ -1048,6 +1048,7 @@ declare const eden: {
|
|
1048
1048
|
campaignId: string;
|
1049
1049
|
CampaignStatus: {
|
1050
1050
|
computedUntil: bigint;
|
1051
|
+
processingStarted: bigint;
|
1051
1052
|
}[];
|
1052
1053
|
}[];
|
1053
1054
|
}>>;
|
@@ -2718,6 +2719,7 @@ declare const eden: {
|
|
2718
2719
|
};
|
2719
2720
|
Opportunity: {
|
2720
2721
|
name: string;
|
2722
|
+
type: string;
|
2721
2723
|
id: string;
|
2722
2724
|
};
|
2723
2725
|
CampaignStatus: {
|
@@ -4160,6 +4162,7 @@ declare const eden: {
|
|
4160
4162
|
campaignId: string;
|
4161
4163
|
CampaignStatus: {
|
4162
4164
|
computedUntil: bigint;
|
4165
|
+
processingStarted: bigint;
|
4163
4166
|
}[];
|
4164
4167
|
}[];
|
4165
4168
|
}>>;
|
@@ -5830,6 +5833,7 @@ declare const eden: {
|
|
5830
5833
|
};
|
5831
5834
|
Opportunity: {
|
5832
5835
|
name: string;
|
5836
|
+
type: string;
|
5833
5837
|
id: string;
|
5834
5838
|
};
|
5835
5839
|
CampaignStatus: {
|
@@ -8126,6 +8130,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
8126
8130
|
campaignId: string;
|
8127
8131
|
CampaignStatus: {
|
8128
8132
|
computedUntil: bigint;
|
8133
|
+
processingStarted: bigint;
|
8129
8134
|
}[];
|
8130
8135
|
}[];
|
8131
8136
|
};
|
@@ -10268,6 +10273,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
10268
10273
|
};
|
10269
10274
|
Opportunity: {
|
10270
10275
|
name: string;
|
10276
|
+
type: string;
|
10271
10277
|
id: string;
|
10272
10278
|
};
|
10273
10279
|
CampaignStatus: {
|
@@ -12735,6 +12741,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
12735
12741
|
campaignId: string;
|
12736
12742
|
CampaignStatus: {
|
12737
12743
|
computedUntil: bigint;
|
12744
|
+
processingStarted: bigint;
|
12738
12745
|
}[];
|
12739
12746
|
}[];
|
12740
12747
|
}>>;
|
@@ -14405,6 +14412,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
14405
14412
|
};
|
14406
14413
|
Opportunity: {
|
14407
14414
|
name: string;
|
14415
|
+
type: string;
|
14408
14416
|
id: string;
|
14409
14417
|
};
|
14410
14418
|
CampaignStatus: {
|
@@ -15847,6 +15855,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
15847
15855
|
campaignId: string;
|
15848
15856
|
CampaignStatus: {
|
15849
15857
|
computedUntil: bigint;
|
15858
|
+
processingStarted: bigint;
|
15850
15859
|
}[];
|
15851
15860
|
}[];
|
15852
15861
|
}>>;
|
@@ -17517,6 +17526,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
17517
17526
|
};
|
17518
17527
|
Opportunity: {
|
17519
17528
|
name: string;
|
17529
|
+
type: string;
|
17520
17530
|
id: string;
|
17521
17531
|
};
|
17522
17532
|
CampaignStatus: {
|
package/dist/src/index.d.ts
CHANGED
@@ -1204,6 +1204,7 @@ declare const app: Elysia<"", false, {
|
|
1204
1204
|
campaignId: string;
|
1205
1205
|
CampaignStatus: {
|
1206
1206
|
computedUntil: bigint;
|
1207
|
+
processingStarted: bigint;
|
1207
1208
|
}[];
|
1208
1209
|
}[];
|
1209
1210
|
};
|
@@ -3346,6 +3347,7 @@ declare const app: Elysia<"", false, {
|
|
3346
3347
|
};
|
3347
3348
|
Opportunity: {
|
3348
3349
|
name: string;
|
3350
|
+
type: string;
|
3349
3351
|
id: string;
|
3350
3352
|
};
|
3351
3353
|
CampaignStatus: {
|
@@ -107,9 +107,8 @@ export declare abstract class CampaignRepository {
|
|
107
107
|
mainParameter: string;
|
108
108
|
campaignParameters: import("database/engine/.generated/runtime/library").JsonValue;
|
109
109
|
}[]>;
|
110
|
-
static checkIfExist(
|
111
|
-
static
|
112
|
-
static findUnique(campaign: CampaignUnique): Promise<{
|
110
|
+
static checkIfExist(id: string): Promise<boolean>;
|
111
|
+
static findUnique(id: string): Promise<{
|
113
112
|
type: string;
|
114
113
|
id: string;
|
115
114
|
params: Prisma.JsonValue;
|
@@ -144,6 +143,7 @@ export declare abstract class CampaignRepository {
|
|
144
143
|
campaignId: string;
|
145
144
|
CampaignStatus: {
|
146
145
|
computedUntil: bigint;
|
146
|
+
processingStarted: bigint;
|
147
147
|
}[];
|
148
148
|
}[]>;
|
149
149
|
static findMany(query: GetCampaignQueryModel): Promise<({
|
@@ -195,17 +195,7 @@ export class CampaignRepository {
|
|
195
195
|
},
|
196
196
|
});
|
197
197
|
}
|
198
|
-
static async checkIfExist(
|
199
|
-
return !!(await apiDbClient.campaign.findFirst({
|
200
|
-
select: {
|
201
|
-
id: true,
|
202
|
-
},
|
203
|
-
where: {
|
204
|
-
id: CampaignService.hashId(campaign),
|
205
|
-
},
|
206
|
-
}));
|
207
|
-
}
|
208
|
-
static async checkIfIdExist(id) {
|
198
|
+
static async checkIfExist(id) {
|
209
199
|
return !!(await apiDbClient.campaign.findFirst({
|
210
200
|
select: {
|
211
201
|
id: true,
|
@@ -215,10 +205,10 @@ export class CampaignRepository {
|
|
215
205
|
},
|
216
206
|
}));
|
217
207
|
}
|
218
|
-
static async findUnique(
|
208
|
+
static async findUnique(id) {
|
219
209
|
return await apiDbClient.campaign.findUnique({
|
220
210
|
where: {
|
221
|
-
id
|
211
|
+
id,
|
222
212
|
},
|
223
213
|
});
|
224
214
|
}
|
@@ -247,6 +237,7 @@ export class CampaignRepository {
|
|
247
237
|
status: {
|
248
238
|
not: RunStatus.PROCESSING,
|
249
239
|
},
|
240
|
+
computedUntil: { lt: currentTime }, // more than 10 min ago
|
250
241
|
},
|
251
242
|
{
|
252
243
|
status: RunStatus.PROCESSING,
|
@@ -266,6 +257,7 @@ export class CampaignRepository {
|
|
266
257
|
take: 1,
|
267
258
|
select: {
|
268
259
|
computedUntil: true,
|
260
|
+
processingStarted: true,
|
269
261
|
},
|
270
262
|
},
|
271
263
|
},
|
@@ -19,6 +19,14 @@ export declare abstract class CampaignService {
|
|
19
19
|
opportunityId: string;
|
20
20
|
creatorAddress: string;
|
21
21
|
} | undefined>;
|
22
|
+
static createMany(campaigns: Omit<CreateCampaignModel, "id">[], upsert?: boolean): Promise<{
|
23
|
+
success: number;
|
24
|
+
fail: number;
|
25
|
+
}>;
|
26
|
+
/**
|
27
|
+
* @dev back-office function
|
28
|
+
* @dev deprecated should be replaced with a manual override
|
29
|
+
*/
|
22
30
|
static updateMetaData(campaign: Omit<UpdateMetaDataCampaignModel, "id">): Promise<{
|
23
31
|
type: string;
|
24
32
|
id: string;
|
@@ -34,11 +42,10 @@ export declare abstract class CampaignService {
|
|
34
42
|
opportunityId: string;
|
35
43
|
creatorAddress: string;
|
36
44
|
}>;
|
45
|
+
/**
|
46
|
+
* @dev back-office function
|
47
|
+
*/
|
37
48
|
static moveToOpportunity(campaign: Omit<UpdateCampaignModel, "id">, upsert?: boolean): Promise<string>;
|
38
|
-
static createMany(campaigns: Omit<CreateCampaignModel, "id">[], upsert?: boolean): Promise<{
|
39
|
-
success: number;
|
40
|
-
fail: number;
|
41
|
-
}>;
|
42
49
|
/**
|
43
50
|
* Get the list of campaigns satisfying the query
|
44
51
|
* @param query
|
@@ -103,9 +110,8 @@ export declare abstract class CampaignService {
|
|
103
110
|
*/
|
104
111
|
static countMany(query: GetCampaignQueryModel): Promise<number>;
|
105
112
|
static countLives(chainId: number): Promise<number>;
|
106
|
-
static checkIfExist(campaign: CampaignUnique): Promise<boolean>;
|
107
|
-
static
|
108
|
-
static findUnique(campaign: CampaignUnique): Promise<{
|
113
|
+
static checkIfExist(campaign: CampaignUnique | string): Promise<boolean>;
|
114
|
+
static findUnique(campaign: CampaignUnique | string): Promise<{
|
109
115
|
type: string;
|
110
116
|
id: string;
|
111
117
|
params: import("database/api/.generated/runtime/library").JsonValue;
|
@@ -140,6 +146,7 @@ export declare abstract class CampaignService {
|
|
140
146
|
campaignId: string;
|
141
147
|
CampaignStatus: {
|
142
148
|
computedUntil: bigint;
|
149
|
+
processingStarted: bigint;
|
143
150
|
}[];
|
144
151
|
}[]>;
|
145
152
|
static findNextCampaignToProcess(chainId: ChainId): Promise<{
|
@@ -26,6 +26,31 @@ export class CampaignService {
|
|
26
26
|
await OpportunityService.createFromCampaign(campaign);
|
27
27
|
return await CampaignRepository.upsert({ id, ...campaign });
|
28
28
|
}
|
29
|
+
static async createMany(campaigns, upsert = false) {
|
30
|
+
const failedToFetchMetadata = [];
|
31
|
+
const campaignsToInsert = [];
|
32
|
+
await Promise.all(campaigns.map(async (campaign) => {
|
33
|
+
const id = CampaignService.hashId({ distributionChain: campaign.chainId, campaignId: campaign.campaignId });
|
34
|
+
campaign.computeChainId = campaign.computeChainId === 0 ? campaign.chainId : campaign.computeChainId;
|
35
|
+
try {
|
36
|
+
if (upsert || !(await CampaignService.checkIfExist(id))) {
|
37
|
+
await OpportunityService.createFromCampaign(campaign);
|
38
|
+
campaignsToInsert.push({ id, ...campaign });
|
39
|
+
}
|
40
|
+
}
|
41
|
+
catch (err) {
|
42
|
+
log.error(`Cannot get Opportunity metadata for campaign ${campaign.campaignId} of type ${campaign.type}`, err);
|
43
|
+
failedToFetchMetadata.push(campaign);
|
44
|
+
}
|
45
|
+
}));
|
46
|
+
let { success, fail } = await CampaignRepository.upsertMany(campaignsToInsert);
|
47
|
+
fail += failedToFetchMetadata.length;
|
48
|
+
return { success, fail };
|
49
|
+
}
|
50
|
+
/**
|
51
|
+
* @dev back-office function
|
52
|
+
* @dev deprecated should be replaced with a manual override
|
53
|
+
*/
|
29
54
|
static async updateMetaData(campaign) {
|
30
55
|
const id = CampaignService.hashId({
|
31
56
|
distributionChain: campaign.distributionChain,
|
@@ -39,6 +64,9 @@ export class CampaignService {
|
|
39
64
|
const updatedParams = JSON.stringify(params);
|
40
65
|
return await CampaignRepository.updateMetaData(id, updatedParams);
|
41
66
|
}
|
67
|
+
/**
|
68
|
+
* @dev back-office function
|
69
|
+
*/
|
42
70
|
static async moveToOpportunity(campaign, upsert = false) {
|
43
71
|
const id = CampaignService.hashId({
|
44
72
|
distributionChain: campaign.distributionChain,
|
@@ -87,31 +115,6 @@ export class CampaignService {
|
|
87
115
|
// Return new opportunityId
|
88
116
|
return (await CampaignService.findUniqueOrThrow(campaign)).opportunityId;
|
89
117
|
}
|
90
|
-
static async createMany(campaigns, upsert = false) {
|
91
|
-
const failedToFetchMetadata = [];
|
92
|
-
const campaignsToInsert = [];
|
93
|
-
await Promise.all(campaigns.map(async (campaign) => {
|
94
|
-
const id = CampaignService.hashId({ distributionChain: campaign.chainId, campaignId: campaign.campaignId });
|
95
|
-
campaign.computeChainId = campaign.computeChainId === 0 ? campaign.chainId : campaign.computeChainId;
|
96
|
-
try {
|
97
|
-
if (upsert || !(await CampaignService.checkIfIdExist(id))) {
|
98
|
-
await OpportunityService.createFromCampaign(campaign);
|
99
|
-
campaignsToInsert.push({ id, ...campaign });
|
100
|
-
}
|
101
|
-
// } else {
|
102
|
-
// console.log("Updating status from campaign");
|
103
|
-
// await OpportunityService.updateStatusFromCampaign(campaign);
|
104
|
-
// }
|
105
|
-
}
|
106
|
-
catch (err) {
|
107
|
-
log.error(`Cannot get Opportunity metadata for campaign ${campaign.campaignId} of type ${campaign.type}`, err);
|
108
|
-
failedToFetchMetadata.push(campaign);
|
109
|
-
}
|
110
|
-
}));
|
111
|
-
let { success, fail } = await CampaignRepository.upsertMany(campaignsToInsert);
|
112
|
-
fail += failedToFetchMetadata.length;
|
113
|
-
return { success, fail };
|
114
|
-
}
|
115
118
|
/**
|
116
119
|
* Get the list of campaigns satisfying the query
|
117
120
|
* @param query
|
@@ -140,24 +143,27 @@ export class CampaignService {
|
|
140
143
|
return await CampaignRepository.countLives(chainId);
|
141
144
|
}
|
142
145
|
static async checkIfExist(campaign) {
|
143
|
-
|
144
|
-
|
145
|
-
static async checkIfIdExist(id) {
|
146
|
-
return await CampaignRepository.checkIfIdExist(id);
|
146
|
+
const id = typeof campaign === "string" ? campaign : CampaignService.hashId(campaign);
|
147
|
+
return await CampaignRepository.checkIfExist(id);
|
147
148
|
}
|
148
149
|
static async findUnique(campaign) {
|
149
|
-
|
150
|
+
const id = typeof campaign === "string" ? campaign : CampaignService.hashId(campaign);
|
151
|
+
return await CampaignRepository.findUnique(id);
|
150
152
|
}
|
151
153
|
static async findUniqueOrThrow(campaign) {
|
152
154
|
const id = typeof campaign === "string" ? campaign : CampaignService.hashId(campaign);
|
153
155
|
return await CampaignRepository.findUniqueOrThrow(id);
|
154
156
|
}
|
155
157
|
static async findCampaignsToProcess(distributionChainId) {
|
156
|
-
return (await CampaignRepository.findCampaignsToProcess(distributionChainId))
|
158
|
+
return (await CampaignRepository.findCampaignsToProcess(distributionChainId))
|
159
|
+
.filter(campaign => campaign.endTimestamp > campaign?.CampaignStatus?.[0]?.computedUntil)
|
160
|
+
?.sort((a, b) => Number(a.CampaignStatus?.[0]?.processingStarted - b.CampaignStatus?.[0]?.processingStarted));
|
157
161
|
}
|
158
162
|
static async findNextCampaignToProcess(chainId) {
|
159
163
|
const campaigns = await CampaignService.findCampaignsToProcess(chainId);
|
160
|
-
return {
|
164
|
+
return {
|
165
|
+
campaignId: campaigns?.[0]?.campaignId,
|
166
|
+
};
|
161
167
|
}
|
162
168
|
static async pickCampaignToProcess(chainId) {
|
163
169
|
const campaigns = await CampaignService.findCampaignsToProcess(chainId);
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { type ChainId } from "@sdk";
|
2
|
-
import {
|
2
|
+
import type { GetCampaignQueryModel } from "../campaign";
|
3
3
|
import type { FilledCampaignDtoModel, SimplifiedCampaignDtoModel } from "./dynamicData.model";
|
4
4
|
export declare class DynamicDataService {
|
5
5
|
#private;
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import { campaignsDynamicData } from "../../../libs/campaigns/campaignsDynamicData";
|
2
|
+
import { CampaignRepository } from "../campaign/campaign.repository";
|
3
|
+
import { CampaignService } from "../campaign/campaign.service";
|
4
|
+
import { OpportunityService } from "../opportunity/opportunity.service";
|
2
5
|
import { executeSimple } from "../../../utils/execute";
|
3
6
|
import { log } from "../../../utils/logger";
|
4
7
|
import { Campaign, NETWORK_LABELS } from "@sdk";
|
5
8
|
import { utils } from "ethers";
|
6
|
-
import { CampaignService } from "../campaign";
|
7
|
-
import { CampaignRepository } from "../campaign/campaign.repository";
|
8
|
-
import { OpportunityService } from "../opportunity";
|
9
9
|
export class DynamicDataService {
|
10
10
|
static async queryERC20DynamicData(chainId, tokenAddress, decimals = 18) {
|
11
11
|
const campaigns = [
|
@@ -1074,6 +1074,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1074
1074
|
campaignId: string;
|
1075
1075
|
CampaignStatus: {
|
1076
1076
|
computedUntil: bigint;
|
1077
|
+
processingStarted: bigint;
|
1077
1078
|
}[];
|
1078
1079
|
}[];
|
1079
1080
|
};
|
@@ -3216,6 +3217,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
3216
3217
|
};
|
3217
3218
|
Opportunity: {
|
3218
3219
|
name: string;
|
3220
|
+
type: string;
|
3219
3221
|
id: string;
|
3220
3222
|
};
|
3221
3223
|
CampaignStatus: {
|