@merkl/api 0.20.114 → 0.20.116

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 (58) hide show
  1. package/dist/database/api/.generated/drizzle/schema.d.ts +17 -0
  2. package/dist/database/api/.generated/drizzle/schema.js +1 -0
  3. package/dist/database/api/.generated/drizzle/schema.ts +1 -0
  4. package/dist/database/api/.generated/edge.js +4 -3
  5. package/dist/database/api/.generated/index-browser.js +1 -0
  6. package/dist/database/api/.generated/index.d.ts +58 -1
  7. package/dist/database/api/.generated/index.js +4 -3
  8. package/dist/database/api/.generated/package.json +1 -1
  9. package/dist/database/api/.generated/schema.prisma +1 -0
  10. package/dist/database/api/.generated/wasm.js +1 -0
  11. package/dist/src/eden/index.d.ts +121 -3
  12. package/dist/src/engine/deprecated/dynamicData/factory.js +1 -0
  13. package/dist/src/engine/deprecated/dynamicData/implementations/ERC721.js +4 -2
  14. package/dist/src/engine/deprecated/dynamicData/implementations/ERCMultiToken.js +4 -2
  15. package/dist/src/engine/deprecated/dynamicData/implementations/Erc20.js +4 -2
  16. package/dist/src/engine/deprecated/dynamicData/implementations/EventBased.js +1 -1
  17. package/dist/src/engine/deprecated/dynamicData/utils/getFixedApr.d.ts +0 -1
  18. package/dist/src/engine/deprecated/dynamicData/utils/getFixedApr.js +0 -8
  19. package/dist/src/engine/deprecated/erc20SubTypeProcessors/subtypesRound1.js +3 -8
  20. package/dist/src/engine/implementations/EigenLayer/tvl.d.ts +7 -0
  21. package/dist/src/engine/implementations/EigenLayer/tvl.js +60 -0
  22. package/dist/src/engine/implementations/Erc20/subTypes/factories.js +6 -0
  23. package/dist/src/engine/implementations/Erc20/subTypes/implementations/gearbox/tvl.js +1 -1
  24. package/dist/src/engine/implementations/Erc20/subTypes/implementations/superlend/metadata.d.ts +17 -0
  25. package/dist/src/engine/implementations/Erc20/subTypes/implementations/superlend/metadata.js +29 -0
  26. package/dist/src/engine/implementations/Erc20/subTypes/implementations/superlend/tvl.d.ts +6 -0
  27. package/dist/src/engine/implementations/Erc20/subTypes/implementations/superlend/tvl.js +48 -0
  28. package/dist/src/engine/implementations/Erc20/tvl.js +1 -1
  29. package/dist/src/engine/metadata/factory.js +1 -0
  30. package/dist/src/engine/tvl/factory.js +2 -0
  31. package/dist/src/index.d.ts +41 -1
  32. package/dist/src/modules/v4/campaign/campaign.controller.d.ts +4 -0
  33. package/dist/src/modules/v4/campaign/campaign.model.d.ts +2 -0
  34. package/dist/src/modules/v4/campaign/campaign.repository.d.ts +4 -0
  35. package/dist/src/modules/v4/campaign/campaign.service.d.ts +9 -0
  36. package/dist/src/modules/v4/campaign/campaign.service.js +4 -2
  37. package/dist/src/modules/v4/campaign/campaign.test.controller.d.ts +3 -1
  38. package/dist/src/modules/v4/campaign/campaign.test.controller.js +14 -3
  39. package/dist/src/modules/v4/dynamicData/dynamicData.service.js +7 -7
  40. package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +21 -0
  41. package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +10 -0
  42. package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +13 -0
  43. package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +25 -0
  44. package/dist/src/modules/v4/reward/reward.model.d.ts +4 -0
  45. package/dist/src/modules/v4/reward/reward.repository.d.ts +2 -0
  46. package/dist/src/modules/v4/reward/reward.service.d.ts +14 -0
  47. package/dist/src/modules/v4/router.d.ts +41 -1
  48. package/dist/src/modules/v4/token/token.controller.d.ts +9 -0
  49. package/dist/src/modules/v4/token/token.model.d.ts +3 -0
  50. package/dist/src/modules/v4/token/token.model.js +3 -0
  51. package/dist/src/modules/v4/token/token.repository.d.ts +4 -0
  52. package/dist/src/modules/v4/token/token.service.d.ts +33 -0
  53. package/dist/src/modules/v4/token/token.service.js +20 -0
  54. package/dist/src/modules/v4/user/user.controller.d.ts +4 -0
  55. package/dist/src/utils/parseDistributionType.d.ts +1 -0
  56. package/dist/src/utils/parseDistributionType.js +16 -0
  57. package/dist/tsconfig.package.tsbuildinfo +1 -1
  58. package/package.json +1 -1
@@ -36,6 +36,7 @@ export declare abstract class TokenRepository {
36
36
  verified: boolean;
37
37
  isTest: boolean;
38
38
  isPoint: boolean;
39
+ isPreTGE: boolean;
39
40
  isNative: boolean;
40
41
  price: number | null;
41
42
  }[]>;
@@ -51,6 +52,7 @@ export declare abstract class TokenRepository {
51
52
  verified: boolean;
52
53
  isTest: boolean;
53
54
  isPoint: boolean;
55
+ isPreTGE: boolean;
54
56
  isNative: boolean;
55
57
  price: number | null;
56
58
  }[]>;
@@ -71,6 +73,7 @@ export declare abstract class TokenRepository {
71
73
  verified: boolean;
72
74
  isTest: boolean;
73
75
  isPoint: boolean;
76
+ isPreTGE: boolean;
74
77
  isNative: boolean;
75
78
  price: number | null;
76
79
  }>;
@@ -108,6 +111,7 @@ export declare abstract class TokenRepository {
108
111
  verified: boolean;
109
112
  isTest: boolean;
110
113
  isPoint: boolean;
114
+ isPreTGE: boolean;
111
115
  isNative: boolean;
112
116
  price: number | null;
113
117
  }>;
@@ -27,6 +27,7 @@ export declare abstract class TokenService {
27
27
  verified: boolean;
28
28
  isTest: boolean;
29
29
  isPoint: boolean;
30
+ isPreTGE: boolean;
30
31
  isNative: boolean;
31
32
  } & {
32
33
  price?: number | null | undefined;
@@ -49,6 +50,7 @@ export declare abstract class TokenService {
49
50
  verified: boolean;
50
51
  isTest: boolean;
51
52
  isPoint: boolean;
53
+ isPreTGE: boolean;
52
54
  isNative: boolean;
53
55
  } & {
54
56
  price?: number | null | undefined;
@@ -68,6 +70,7 @@ export declare abstract class TokenService {
68
70
  verified: boolean;
69
71
  isTest: boolean;
70
72
  isPoint: boolean;
73
+ isPreTGE: boolean;
71
74
  isNative: boolean;
72
75
  } & {
73
76
  price?: number | null | undefined;
@@ -110,6 +113,28 @@ export declare abstract class TokenService {
110
113
  verified: boolean;
111
114
  isTest: boolean;
112
115
  isPoint: boolean;
116
+ isPreTGE: boolean;
117
+ isNative: boolean;
118
+ } & {
119
+ price?: number | null | undefined;
120
+ }>;
121
+ /**
122
+ * Read token from database, tries to fill it if unexistant
123
+ * @param chainId
124
+ * @param address
125
+ */
126
+ static findUniqueFillOrThrow(token: TokenUnique): Promise<{
127
+ symbol: string;
128
+ id: string;
129
+ name: string | null;
130
+ icon: string;
131
+ address: string;
132
+ chainId: number;
133
+ decimals: number;
134
+ verified: boolean;
135
+ isTest: boolean;
136
+ isPoint: boolean;
137
+ isPreTGE: boolean;
113
138
  isNative: boolean;
114
139
  } & {
115
140
  price?: number | null | undefined;
@@ -137,6 +162,7 @@ export declare abstract class TokenService {
137
162
  verified: boolean;
138
163
  isTest: boolean;
139
164
  isPoint: boolean;
165
+ isPreTGE: boolean;
140
166
  isNative: boolean;
141
167
  } & {
142
168
  price?: number | null | undefined;
@@ -157,6 +183,7 @@ export declare abstract class TokenService {
157
183
  verified: boolean;
158
184
  isTest: boolean;
159
185
  isPoint: boolean;
186
+ isPreTGE: boolean;
160
187
  isNative: boolean;
161
188
  } & {
162
189
  price?: number | null | undefined;
@@ -173,6 +200,7 @@ export declare abstract class TokenService {
173
200
  verified: boolean;
174
201
  isTest: boolean;
175
202
  isPoint: boolean;
203
+ isPreTGE: boolean;
176
204
  isNative: boolean;
177
205
  } & {
178
206
  price?: number | null | undefined;
@@ -213,6 +241,7 @@ export declare abstract class TokenService {
213
241
  verified: boolean;
214
242
  isTest: boolean;
215
243
  isPoint: boolean;
244
+ isPreTGE: boolean;
216
245
  isNative: boolean;
217
246
  } & {
218
247
  price?: number | null | undefined;
@@ -230,6 +259,7 @@ export declare abstract class TokenService {
230
259
  verified: boolean;
231
260
  isTest: boolean;
232
261
  isPoint: boolean;
262
+ isPreTGE: boolean;
233
263
  isNative: boolean;
234
264
  price: number | null;
235
265
  }[]>;
@@ -245,6 +275,7 @@ export declare abstract class TokenService {
245
275
  verified: boolean;
246
276
  isTest: boolean;
247
277
  isPoint: boolean;
278
+ isPreTGE: boolean;
248
279
  isNative: boolean;
249
280
  price: number | null;
250
281
  }>;
@@ -260,6 +291,7 @@ export declare abstract class TokenService {
260
291
  verified: boolean;
261
292
  isTest: boolean;
262
293
  isPoint: boolean;
294
+ isPreTGE: boolean;
263
295
  isNative: boolean;
264
296
  price: number | null;
265
297
  }>;
@@ -280,6 +312,7 @@ export declare abstract class TokenService {
280
312
  verified: boolean;
281
313
  isTest: boolean;
282
314
  isPoint: boolean;
315
+ isPreTGE: boolean;
283
316
  isNative: boolean;
284
317
  price: number | null;
285
318
  }>;
@@ -102,6 +102,7 @@ export class TokenService {
102
102
  verified: false,
103
103
  isTest: false,
104
104
  isPoint: false,
105
+ isPreTGE: false,
105
106
  isNative: false,
106
107
  }, onchainData),
107
108
  };
@@ -163,6 +164,25 @@ export class TokenService {
163
164
  const id = typeof token === "string" ? token : TokenService.hashId(token);
164
165
  return await TokenRepository.findUniqueOrThrow(id);
165
166
  }
167
+ /**
168
+ * Read token from database, tries to fill it if unexistant
169
+ * @param chainId
170
+ * @param address
171
+ */
172
+ static async findUniqueFillOrThrow(token) {
173
+ const id = TokenService.hashId(token);
174
+ let result = await TokenRepository.findUnique(id);
175
+ if (!result) {
176
+ await TokenService.fillAndCreate({
177
+ chainId: token.chainId,
178
+ address: token.address,
179
+ verified: false,
180
+ icon: "",
181
+ });
182
+ result = await TokenRepository.findUniqueOrThrow(id);
183
+ }
184
+ return result;
185
+ }
166
186
  /**
167
187
  * Checks if two tokens are the same based on chainId/address combo
168
188
  * @param a token
@@ -133,6 +133,7 @@ export declare const UserController: Elysia<"/users", false, {
133
133
  verified: boolean;
134
134
  isTest: boolean;
135
135
  isPoint: boolean;
136
+ isPreTGE: boolean;
136
137
  isNative: boolean;
137
138
  price: number | null;
138
139
  };
@@ -156,6 +157,7 @@ export declare const UserController: Elysia<"/users", false, {
156
157
  verified: boolean;
157
158
  isTest: boolean;
158
159
  isPoint: boolean;
160
+ isPreTGE: boolean;
159
161
  isNative: boolean;
160
162
  price: number | null;
161
163
  }[];
@@ -254,6 +256,7 @@ export declare const UserController: Elysia<"/users", false, {
254
256
  verified: boolean;
255
257
  isTest: boolean;
256
258
  isPoint: boolean;
259
+ isPreTGE: boolean;
257
260
  isNative: boolean;
258
261
  price: number | null;
259
262
  };
@@ -277,6 +280,7 @@ export declare const UserController: Elysia<"/users", false, {
277
280
  verified: boolean;
278
281
  isTest: boolean;
279
282
  isPoint: boolean;
283
+ isPreTGE: boolean;
280
284
  isNative: boolean;
281
285
  price: number | null;
282
286
  }[];
@@ -0,0 +1 @@
1
+ export declare const parseDistributionType: (params: object) => "DUTCH_AUCTION" | "FIX_REWARD_VALUE_PER_LIQUIDITY_VALUE" | "FIX_REWARD_AMOUNT_PER_LIQUIDITY_VALUE" | "FIX_REWARD_VALUE_PER_LIQUIDITY_AMOUNT" | "FIX_REWARD_AMOUNT_PER_LIQUIDITY_AMOUNT";
@@ -0,0 +1,16 @@
1
+ import { DistributionType } from "@db/api";
2
+ export const parseDistributionType = (params) => {
3
+ if ("targetTokenPricing" in params && "rewardTokenPricing" in params && "apr" in params) {
4
+ if (params.targetTokenPricing && params.rewardTokenPricing) {
5
+ return DistributionType.FIX_REWARD_VALUE_PER_LIQUIDITY_VALUE;
6
+ }
7
+ if (params.rewardTokenPricing) {
8
+ return DistributionType.FIX_REWARD_VALUE_PER_LIQUIDITY_AMOUNT;
9
+ }
10
+ if (params.targetTokenPricing) {
11
+ return DistributionType.FIX_REWARD_AMOUNT_PER_LIQUIDITY_VALUE;
12
+ }
13
+ return DistributionType.FIX_REWARD_AMOUNT_PER_LIQUIDITY_AMOUNT;
14
+ }
15
+ return DistributionType.DUTCH_AUCTION;
16
+ };