@merkl/api 0.20.97 → 0.20.99

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.
Files changed (25) hide show
  1. package/dist/src/eden/index.d.ts +337 -12
  2. package/dist/src/engine/campaignTVL/factory.js +2 -0
  3. package/dist/src/engine/campaignTVL/implementations/UniswapV4.d.ts +7 -0
  4. package/dist/src/engine/campaignTVL/implementations/UniswapV4.js +87 -0
  5. package/dist/src/index.d.ts +121 -4
  6. package/dist/src/jobs/update-dynamic-data.js +1 -1
  7. package/dist/src/modules/v4/campaign/campaign.test.controller.d.ts +36 -2
  8. package/dist/src/modules/v4/dynamicData/dynamicData.service.js +1 -11
  9. package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +36 -2
  10. package/dist/src/modules/v4/opportunity/opportunity.repository.js +2 -0
  11. package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +54 -3
  12. package/dist/src/modules/v4/opportunity/opportunity.service.js +1 -1
  13. package/dist/src/modules/v4/programPayload/programPayload.controller.d.ts +1 -0
  14. package/dist/src/modules/v4/programPayload/programPayload.model.d.ts +1 -0
  15. package/dist/src/modules/v4/programPayload/programPayload.model.js +1 -0
  16. package/dist/src/modules/v4/router.d.ts +121 -4
  17. package/dist/src/modules/v4/router.js +3 -1
  18. package/dist/src/modules/v4/turtle/turtle.controller.d.ts +68 -0
  19. package/dist/src/modules/v4/turtle/turtle.controller.js +20 -0
  20. package/dist/src/modules/v4/turtle/turtle.repository.d.ts +14 -0
  21. package/dist/src/modules/v4/turtle/turtle.repository.js +40 -0
  22. package/dist/src/modules/v4/turtle/turtle.service.d.ts +17 -0
  23. package/dist/src/modules/v4/turtle/turtle.service.js +28 -0
  24. package/dist/tsconfig.package.tsbuildinfo +1 -1
  25. package/package.json +1 -1
@@ -262,6 +262,23 @@ declare const app: Elysia<"", false, {
262
262
  };
263
263
  response: {
264
264
  200: {
265
+ id: string;
266
+ name: string;
267
+ type: string;
268
+ status: import("@db/api").$Enums.Status;
269
+ tags: string[];
270
+ identifier: string;
271
+ action: import("@db/api").$Enums.OpportunityAction;
272
+ manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
273
+ chainId: number;
274
+ depositUrl: string | null;
275
+ explorerAddress: string | null;
276
+ mainProtocolId: string | null;
277
+ tvl: number;
278
+ apr: number;
279
+ dailyRewards: number;
280
+ lastCampaignCreatedAt: Date;
281
+ } | {
265
282
  id: string;
266
283
  chainId: number;
267
284
  type: string;
@@ -288,7 +305,7 @@ declare const app: Elysia<"", false, {
288
305
  depositUrl: any;
289
306
  explorerAddress: string | undefined;
290
307
  tags: string[];
291
- };
308
+ } | null;
292
309
  };
293
310
  };
294
311
  };
@@ -309,6 +326,23 @@ declare const app: Elysia<"", false, {
309
326
  };
310
327
  response: {
311
328
  200: {
329
+ id: string;
330
+ name: string;
331
+ type: string;
332
+ status: import("@db/api").$Enums.Status;
333
+ tags: string[];
334
+ identifier: string;
335
+ action: import("@db/api").$Enums.OpportunityAction;
336
+ manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
337
+ chainId: number;
338
+ depositUrl: string | null;
339
+ explorerAddress: string | null;
340
+ mainProtocolId: string | null;
341
+ tvl: number;
342
+ apr: number;
343
+ dailyRewards: number;
344
+ lastCampaignCreatedAt: Date;
345
+ } | {
312
346
  id: string;
313
347
  chainId: number;
314
348
  type: string;
@@ -335,7 +369,7 @@ declare const app: Elysia<"", false, {
335
369
  depositUrl: any;
336
370
  explorerAddress: string | undefined;
337
371
  tags: string[];
338
- };
372
+ } | null;
339
373
  };
340
374
  };
341
375
  };
@@ -1972,6 +2006,23 @@ declare const app: Elysia<"", false, {
1972
2006
  };
1973
2007
  response: {
1974
2008
  200: {
2009
+ id: string;
2010
+ name: string;
2011
+ type: string;
2012
+ status: import("@db/api").$Enums.Status;
2013
+ tags: string[];
2014
+ identifier: string;
2015
+ action: import("@db/api").$Enums.OpportunityAction;
2016
+ manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
2017
+ chainId: number;
2018
+ depositUrl: string | null;
2019
+ explorerAddress: string | null;
2020
+ mainProtocolId: string | null;
2021
+ tvl: number;
2022
+ apr: number;
2023
+ dailyRewards: number;
2024
+ lastCampaignCreatedAt: Date;
2025
+ } | {
1975
2026
  id: string;
1976
2027
  chainId: number;
1977
2028
  type: string;
@@ -1998,7 +2049,7 @@ declare const app: Elysia<"", false, {
1998
2049
  depositUrl: any;
1999
2050
  explorerAddress: string | undefined;
2000
2051
  tags: string[];
2001
- };
2052
+ } | null;
2002
2053
  };
2003
2054
  };
2004
2055
  };
@@ -2018,6 +2069,23 @@ declare const app: Elysia<"", false, {
2018
2069
  };
2019
2070
  response: {
2020
2071
  200: {
2072
+ id: string;
2073
+ name: string;
2074
+ type: string;
2075
+ status: import("@db/api").$Enums.Status;
2076
+ tags: string[];
2077
+ identifier: string;
2078
+ action: import("@db/api").$Enums.OpportunityAction;
2079
+ manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
2080
+ chainId: number;
2081
+ depositUrl: string | null;
2082
+ explorerAddress: string | null;
2083
+ mainProtocolId: string | null;
2084
+ tvl: number;
2085
+ apr: number;
2086
+ dailyRewards: number;
2087
+ lastCampaignCreatedAt: Date;
2088
+ } | {
2021
2089
  id: string;
2022
2090
  chainId: number;
2023
2091
  type: string;
@@ -2044,7 +2112,7 @@ declare const app: Elysia<"", false, {
2044
2112
  depositUrl: any;
2045
2113
  explorerAddress: string | undefined;
2046
2114
  tags: string[];
2047
- };
2115
+ } | null;
2048
2116
  };
2049
2117
  };
2050
2118
  };
@@ -4572,6 +4640,7 @@ declare const app: Elysia<"", false, {
4572
4640
  blacklist?: string[] | undefined;
4573
4641
  poolAddress?: string | undefined;
4574
4642
  contract?: string | undefined;
4643
+ tokenId?: string | undefined;
4575
4644
  marketId?: string | undefined;
4576
4645
  strategy?: string | undefined;
4577
4646
  poolId?: string | undefined;
@@ -5130,6 +5199,54 @@ declare const app: Elysia<"", false, {
5130
5199
  };
5131
5200
  };
5132
5201
  };
5202
+ } & {
5203
+ v4: {
5204
+ turtle: {
5205
+ tac: {
5206
+ total: {
5207
+ get: {
5208
+ body: unknown;
5209
+ params: {};
5210
+ query: unknown;
5211
+ headers: unknown;
5212
+ response: {
5213
+ 200: {
5214
+ total: number;
5215
+ breakdown: {
5216
+ [key: string]: number;
5217
+ };
5218
+ };
5219
+ };
5220
+ };
5221
+ };
5222
+ };
5223
+ };
5224
+ } & {
5225
+ turtle: {
5226
+ tac: {
5227
+ ":address": {
5228
+ get: {
5229
+ body: unknown;
5230
+ params: {
5231
+ address: string;
5232
+ };
5233
+ query: unknown;
5234
+ headers: unknown;
5235
+ response: {
5236
+ 200: {
5237
+ [x: string]: {
5238
+ vaultSymbol: string;
5239
+ balance: number;
5240
+ maxBalance: number;
5241
+ turtle: number;
5242
+ };
5243
+ };
5244
+ };
5245
+ };
5246
+ };
5247
+ };
5248
+ };
5249
+ };
5133
5250
  } & {
5134
5251
  v3: {
5135
5252
  app: {
@@ -49,7 +49,7 @@ const main = async () => {
49
49
  // 4. Update the status of the opportunities associated to live campaigns
50
50
  await OpportunityService.updateMany(liveOpportunityIds, { status: "LIVE" });
51
51
  // 5. Update records for all live campaigns
52
- const liveCampaigns = (await CampaignService.findMany({ chainId, status: "LIVE", test: true, withOpportunity: true })).map(campaign => OpportunityConvertorService.convertV4CampaignToV3(CampaignEnum[campaign.type], campaign, campaign.Opportunity.identifier));
52
+ const liveCampaigns = (await CampaignService.findMany({ chainId, status: "LIVE", test: true, withOpportunity: true, items: 10_000 })).map(campaign => OpportunityConvertorService.convertV4CampaignToV3(CampaignEnum[campaign.type], campaign, campaign.Opportunity.identifier));
53
53
  for (const type of new Set(liveCampaigns.map(c => c.campaignType))) {
54
54
  await DynamicDataService.update(chainId, type, liveCampaigns.filter(c => c.campaignType === type));
55
55
  }
@@ -104,6 +104,23 @@ export declare const CampaignTestController: Elysia<"/campaigns", false, {
104
104
  };
105
105
  response: {
106
106
  200: {
107
+ id: string;
108
+ name: string;
109
+ type: string;
110
+ status: import("@db/api").$Enums.Status;
111
+ tags: string[];
112
+ identifier: string;
113
+ action: import("@db/api").$Enums.OpportunityAction;
114
+ manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
115
+ chainId: number;
116
+ depositUrl: string | null;
117
+ explorerAddress: string | null;
118
+ mainProtocolId: string | null;
119
+ tvl: number;
120
+ apr: number;
121
+ dailyRewards: number;
122
+ lastCampaignCreatedAt: Date;
123
+ } | {
107
124
  id: string;
108
125
  chainId: number;
109
126
  type: string;
@@ -130,7 +147,7 @@ export declare const CampaignTestController: Elysia<"/campaigns", false, {
130
147
  depositUrl: any;
131
148
  explorerAddress: string | undefined;
132
149
  tags: string[];
133
- };
150
+ } | null;
134
151
  };
135
152
  };
136
153
  };
@@ -150,6 +167,23 @@ export declare const CampaignTestController: Elysia<"/campaigns", false, {
150
167
  };
151
168
  response: {
152
169
  200: {
170
+ id: string;
171
+ name: string;
172
+ type: string;
173
+ status: import("@db/api").$Enums.Status;
174
+ tags: string[];
175
+ identifier: string;
176
+ action: import("@db/api").$Enums.OpportunityAction;
177
+ manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
178
+ chainId: number;
179
+ depositUrl: string | null;
180
+ explorerAddress: string | null;
181
+ mainProtocolId: string | null;
182
+ tvl: number;
183
+ apr: number;
184
+ dailyRewards: number;
185
+ lastCampaignCreatedAt: Date;
186
+ } | {
153
187
  id: string;
154
188
  chainId: number;
155
189
  type: string;
@@ -176,7 +210,7 @@ export declare const CampaignTestController: Elysia<"/campaigns", false, {
176
210
  depositUrl: any;
177
211
  explorerAddress: string | undefined;
178
212
  tags: string[];
179
- };
213
+ } | null;
180
214
  };
181
215
  };
182
216
  };
@@ -172,17 +172,7 @@ export class DynamicDataService {
172
172
  await OpportunityRepository.updateDynamicData(opportunityId, apr, tvl, dailyRewards);
173
173
  }
174
174
  catch (err) {
175
- throw new HttpError("Failed to update dynamic data", 500, {
176
- err,
177
- opportunityId,
178
- campaigns: Object.values(entry[1]),
179
- dynamicData: bigintToString({
180
- campaignId: Object.values(entry[1])[0].campaignId,
181
- apr,
182
- tvl,
183
- dailyRewards,
184
- }),
185
- });
175
+ log.error(`failed to update dynamic data for ${opportunityId}`, err);
186
176
  }
187
177
  dynamicDataArray.push(bigintToString({ campaignId: Object.values(entry[1])[0].campaignId, apr, tvl, dailyRewards }));
188
178
  }
@@ -117,6 +117,23 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
117
117
  };
118
118
  response: {
119
119
  200: {
120
+ id: string;
121
+ name: string;
122
+ type: string;
123
+ status: import("@db/api").$Enums.Status;
124
+ tags: string[];
125
+ identifier: string;
126
+ action: import("@db/api").$Enums.OpportunityAction;
127
+ manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
128
+ chainId: number;
129
+ depositUrl: string | null;
130
+ explorerAddress: string | null;
131
+ mainProtocolId: string | null;
132
+ tvl: number;
133
+ apr: number;
134
+ dailyRewards: number;
135
+ lastCampaignCreatedAt: Date;
136
+ } | {
120
137
  id: string;
121
138
  chainId: number;
122
139
  type: string;
@@ -143,7 +160,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
143
160
  depositUrl: any;
144
161
  explorerAddress: string | undefined;
145
162
  tags: string[];
146
- };
163
+ } | null;
147
164
  };
148
165
  };
149
166
  };
@@ -164,6 +181,23 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
164
181
  };
165
182
  response: {
166
183
  200: {
184
+ id: string;
185
+ name: string;
186
+ type: string;
187
+ status: import("@db/api").$Enums.Status;
188
+ tags: string[];
189
+ identifier: string;
190
+ action: import("@db/api").$Enums.OpportunityAction;
191
+ manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
192
+ chainId: number;
193
+ depositUrl: string | null;
194
+ explorerAddress: string | null;
195
+ mainProtocolId: string | null;
196
+ tvl: number;
197
+ apr: number;
198
+ dailyRewards: number;
199
+ lastCampaignCreatedAt: Date;
200
+ } | {
167
201
  id: string;
168
202
  chainId: number;
169
203
  type: string;
@@ -190,7 +224,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
190
224
  depositUrl: any;
191
225
  explorerAddress: string | undefined;
192
226
  tags: string[];
193
- };
227
+ } | null;
194
228
  };
195
229
  };
196
230
  };
@@ -202,6 +202,7 @@ export class OpportunityRepository {
202
202
  name: !previousOpportunity?.manualOverrides.includes("name") ? newOpp.name : previousOpportunity.name,
203
203
  status: newOpp.status,
204
204
  type: newOpp.type,
205
+ tags: newOpp.tags,
205
206
  depositUrl: !previousOpportunity?.manualOverrides.includes("depositUrl")
206
207
  ? newOpp.depositUrl
207
208
  : previousOpportunity.depositUrl,
@@ -228,6 +229,7 @@ export class OpportunityRepository {
228
229
  name: !previousOpportunity?.manualOverrides.includes("name") ? newOpp.name : undefined,
229
230
  status: newOpp.status,
230
231
  type: newOpp.type,
232
+ tags: newOpp.tags,
231
233
  depositUrl: !previousOpportunity?.manualOverrides.includes("depositUrl") ? newOpp.depositUrl : undefined,
232
234
  explorerAddress: !previousOpportunity?.manualOverrides.includes("explorerAddress")
233
235
  ? newOpp.explorerAddress
@@ -25,6 +25,23 @@ export declare abstract class OpportunityService {
25
25
  lastCampaignCreatedAt: Date;
26
26
  }>;
27
27
  static deleteOverrides(id: string, overridesToDelete: OpportunityManualOverride[]): Promise<{
28
+ id: string;
29
+ name: string;
30
+ type: string;
31
+ status: import("@db/api").$Enums.Status;
32
+ tags: string[];
33
+ identifier: string;
34
+ action: import("@db/api").$Enums.OpportunityAction;
35
+ manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
36
+ chainId: number;
37
+ depositUrl: string | null;
38
+ explorerAddress: string | null;
39
+ mainProtocolId: string | null;
40
+ tvl: number;
41
+ apr: number;
42
+ dailyRewards: number;
43
+ lastCampaignCreatedAt: Date;
44
+ } | {
28
45
  id: string;
29
46
  chainId: number;
30
47
  type: string;
@@ -51,7 +68,7 @@ export declare abstract class OpportunityService {
51
68
  depositUrl: any;
52
69
  explorerAddress: string | undefined;
53
70
  tags: string[];
54
- }>;
71
+ } | null>;
55
72
  /**
56
73
  * create an opportunity without campaigns
57
74
  * @param newOpp the new opportunity to create
@@ -81,6 +98,23 @@ export declare abstract class OpportunityService {
81
98
  * @returns the opportunity entity computed
82
99
  */
83
100
  static createFromCampaign(campaign: Omit<CreateCampaignModel, "id">, upsert?: boolean, dryRun?: boolean): Promise<{
101
+ id: string;
102
+ name: string;
103
+ type: string;
104
+ status: import("@db/api").$Enums.Status;
105
+ tags: string[];
106
+ identifier: string;
107
+ action: import("@db/api").$Enums.OpportunityAction;
108
+ manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
109
+ chainId: number;
110
+ depositUrl: string | null;
111
+ explorerAddress: string | null;
112
+ mainProtocolId: string | null;
113
+ tvl: number;
114
+ apr: number;
115
+ dailyRewards: number;
116
+ lastCampaignCreatedAt: Date;
117
+ } | {
84
118
  id: string;
85
119
  chainId: number;
86
120
  type: string;
@@ -107,11 +141,28 @@ export declare abstract class OpportunityService {
107
141
  depositUrl: any;
108
142
  explorerAddress: string | undefined;
109
143
  tags: string[];
110
- }>;
144
+ } | null>;
111
145
  /**
112
146
  * deletes and recreates an opportunity with fresh data
113
147
  */
114
148
  static recreate(opportunityId: string, campaignId?: string): Promise<{
149
+ id: string;
150
+ name: string;
151
+ type: string;
152
+ status: import("@db/api").$Enums.Status;
153
+ tags: string[];
154
+ identifier: string;
155
+ action: import("@db/api").$Enums.OpportunityAction;
156
+ manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
157
+ chainId: number;
158
+ depositUrl: string | null;
159
+ explorerAddress: string | null;
160
+ mainProtocolId: string | null;
161
+ tvl: number;
162
+ apr: number;
163
+ dailyRewards: number;
164
+ lastCampaignCreatedAt: Date;
165
+ } | {
115
166
  id: string;
116
167
  chainId: number;
117
168
  type: string;
@@ -138,7 +189,7 @@ export declare abstract class OpportunityService {
138
189
  depositUrl: any;
139
190
  explorerAddress: string | undefined;
140
191
  tags: string[];
141
- }>;
192
+ } | null>;
142
193
  /**
143
194
  * Finds opportunities based on filters of its campaigns
144
195
  * @notice campaigns are filtered as well
@@ -94,7 +94,7 @@ export class OpportunityService {
94
94
  tags,
95
95
  };
96
96
  if (!dryRun)
97
- await OpportunityRepository.create(opportunity, upsert);
97
+ return await OpportunityRepository.create(opportunity, upsert);
98
98
  return opportunity;
99
99
  }
100
100
  /**
@@ -195,6 +195,7 @@ export declare const ProgramPayloadController: Elysia<"/program-payload", false,
195
195
  blacklist?: string[] | undefined;
196
196
  poolAddress?: string | undefined;
197
197
  contract?: string | undefined;
198
+ tokenId?: string | undefined;
198
199
  marketId?: string | undefined;
199
200
  strategy?: string | undefined;
200
201
  poolId?: string | undefined;
@@ -28,6 +28,7 @@ export declare const SinglePayloadInputDto: import("@sinclair/typebox").TObject<
28
28
  computeChainId: import("@sinclair/typebox").TNumber;
29
29
  creator: import("@sinclair/typebox").TString;
30
30
  hooks: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{}>>>;
31
+ tokenId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
31
32
  whitelist: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
32
33
  blacklist: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
33
34
  campaignType: import("@sinclair/typebox").TNumber;
@@ -29,6 +29,7 @@ export const SinglePayloadInputDto = t.Object({
29
29
  computeChainId: t.Numeric({ description: "Chain ID used for computation" }),
30
30
  creator: t.String({ description: "Address of the campaign creator" }),
31
31
  hooks: t.Optional(t.Array(t.Object({}))),
32
+ tokenId: t.Optional(t.String({ description: "Token ID for the campaign" })),
32
33
  whitelist: t.Optional(t.Array(t.String({ description: "List of addresses allowed to participate" }))),
33
34
  blacklist: t.Optional(t.Array(t.String({ description: "List of addresses not allowed to participate" }))),
34
35
  campaignType: t.Numeric({ description: "Type of the campaign 1 : ERC20, 2: CLAMM , ..." }),