@merkl/api 0.16.17 → 0.16.19

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 +410 -35
  2. package/dist/src/index.d.ts +82 -7
  3. package/dist/src/modules/v4/campaign/campaign.controller.d.ts +13 -1
  4. package/dist/src/modules/v4/campaign/campaign.service.d.ts +26 -2
  5. package/dist/src/modules/v4/computedValue/computedValue.repository.js +3 -0
  6. package/dist/src/modules/v4/enso/enso.service.js +4 -1
  7. package/dist/src/modules/v4/kyberzap/kyberzap.service.js +1 -1
  8. package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +40 -4
  9. package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +2 -2
  10. package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +108 -12
  11. package/dist/src/modules/v4/opportunity/subservices/getClammMetadata.service.js +3 -3
  12. package/dist/src/modules/v4/protocol/protocol.controller.d.ts +1 -0
  13. package/dist/src/modules/v4/protocol/protocol.model.d.ts +1 -0
  14. package/dist/src/modules/v4/protocol/protocol.model.js +1 -0
  15. package/dist/src/modules/v4/protocol/protocol.repository.js +5 -1
  16. package/dist/src/modules/v4/protocol/protocol.service.d.ts +0 -2
  17. package/dist/src/modules/v4/protocol/protocol.service.js +0 -38
  18. package/dist/src/modules/v4/router.d.ts +82 -7
  19. package/dist/src/modules/v4/token/token.controller.d.ts +28 -2
  20. package/dist/src/modules/v4/token/token.service.d.ts +71 -7
  21. package/dist/src/modules/v4/token/token.service.js +3 -3
  22. package/dist/src/utils/camelToKebabCase.d.ts +1 -0
  23. package/dist/src/utils/camelToKebabCase.js +3 -0
  24. package/dist/tsconfig.package.tsbuildinfo +1 -1
  25. package/package.json +1 -1
@@ -223,8 +223,20 @@ declare const app: Elysia<"", false, {
223
223
  name: string;
224
224
  status: "PAST" | "LIVE" | "SOON";
225
225
  action: import("../database/api/.generated").$Enums.OpportunityAction;
226
- tokens: any[];
227
- mainProtocol: "morpho" | "euler" | "ambient" | "arthswap" | "baseswap" | "camelot" | "crust" | "fenix" | "horiza" | "izumi" | "kim" | "pancakeswap-v3" | "quickswap-algebra" | "quickswap-uni" | "ramses" | "retro" | "stryke" | "stryke-pcs" | "stryke-sushi" | "sushiswap-v3" | "swapr" | "thruster" | "uniswap-v3" | "voltage" | "zero" | "koi" | "supswap-v3" | "zkswap" | "thirdtrade" | "uniswapv4" | "uniswap-v2" | "velodrome" | "aerodrome" | "balancer" | "curve" | "cross_curve" | "curveNPool" | "aura" | "akron" | "beefy" | "dragonswap" | "poolside" | "syncswap-v3" | "neptune" | "zkSwapThreePool" | "syncswap" | "rfx" | "radiant" | "aave" | "gearbox" | "compound" | "sturdy" | "frax" | "ionic" | "moonwell" | "fluid" | "silo" | "coumpound" | "dolomite" | "badger" | "ajna" | "layerbank" | "ion" | "venus" | "woofi" | "reactor_fusion" | "eigenlayer" | "vest" | "zerolend" | "hyperdrive" | "gamma" | "oku" | "hourglass" | "veda" | "kyo" | "sonex" | undefined;
226
+ tokens: ({
227
+ symbol: string;
228
+ name: string | null;
229
+ id: string;
230
+ icon: string;
231
+ chainId: number;
232
+ address: string;
233
+ decimals: number;
234
+ verified: boolean;
235
+ isTest: boolean;
236
+ } & {
237
+ price?: number | null | undefined;
238
+ })[];
239
+ mainProtocol: string | undefined;
228
240
  depositUrl: any;
229
241
  tags: string[];
230
242
  };
@@ -309,7 +321,19 @@ declare const app: Elysia<"", false, {
309
321
  };
310
322
  id: string;
311
323
  depositUrl: string | undefined;
312
- tokens: Token[];
324
+ tokens: ({
325
+ symbol: string;
326
+ name: string | null;
327
+ id: string;
328
+ icon: string;
329
+ chainId: number;
330
+ address: string;
331
+ decimals: number;
332
+ verified: boolean;
333
+ isTest: boolean;
334
+ } & {
335
+ price?: number | null | undefined;
336
+ })[];
313
337
  chain: {
314
338
  name: string;
315
339
  id: number;
@@ -596,7 +620,19 @@ declare const app: Elysia<"", false, {
596
620
  id: number;
597
621
  icon: string;
598
622
  };
599
- rewardToken: Token;
623
+ rewardToken: {
624
+ symbol: string;
625
+ name: string | null;
626
+ id: string;
627
+ icon: string;
628
+ chainId: number;
629
+ address: string;
630
+ decimals: number;
631
+ verified: boolean;
632
+ isTest: boolean;
633
+ } & {
634
+ price?: number | null | undefined;
635
+ };
600
636
  distributionChain: {
601
637
  name: string;
602
638
  id: number;
@@ -1076,7 +1112,19 @@ declare const app: Elysia<"", false, {
1076
1112
  id: number;
1077
1113
  icon: string;
1078
1114
  };
1079
- rewardToken: Token;
1115
+ rewardToken: {
1116
+ symbol: string;
1117
+ name: string | null;
1118
+ id: string;
1119
+ icon: string;
1120
+ chainId: number;
1121
+ address: string;
1122
+ decimals: number;
1123
+ verified: boolean;
1124
+ isTest: boolean;
1125
+ } & {
1126
+ price?: number | null | undefined;
1127
+ };
1080
1128
  distributionChain: {
1081
1129
  name: string;
1082
1130
  id: number;
@@ -1233,6 +1281,7 @@ declare const app: Elysia<"", false, {
1233
1281
  items?: number | undefined;
1234
1282
  tags?: string[] | undefined;
1235
1283
  page?: number | undefined;
1284
+ ids?: string[] | undefined;
1236
1285
  opportunityTag?: string | undefined;
1237
1286
  };
1238
1287
  headers: unknown;
@@ -1489,7 +1538,21 @@ declare const app: Elysia<"", false, {
1489
1538
  };
1490
1539
  headers: unknown;
1491
1540
  response: {
1492
- 200: any[];
1541
+ 200: ({
1542
+ symbol: string;
1543
+ name: string | null;
1544
+ id: string;
1545
+ icon: string;
1546
+ chainId: number;
1547
+ address: string;
1548
+ decimals: number;
1549
+ verified: boolean;
1550
+ isTest: boolean;
1551
+ } & {
1552
+ price?: number | null | undefined;
1553
+ } & {
1554
+ balance: bigint;
1555
+ })[];
1493
1556
  };
1494
1557
  };
1495
1558
  };
@@ -1511,7 +1574,19 @@ declare const app: Elysia<"", false, {
1511
1574
  };
1512
1575
  headers: unknown;
1513
1576
  response: {
1514
- 200: Token[];
1577
+ 200: ({
1578
+ symbol: string;
1579
+ name: string | null;
1580
+ id: string;
1581
+ icon: string;
1582
+ chainId: number;
1583
+ address: string;
1584
+ decimals: number;
1585
+ verified: boolean;
1586
+ isTest: boolean;
1587
+ } & {
1588
+ price?: number | null | undefined;
1589
+ })[];
1515
1590
  };
1516
1591
  };
1517
1592
  };
@@ -138,7 +138,19 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
138
138
  id: number;
139
139
  icon: string;
140
140
  };
141
- rewardToken: Token;
141
+ rewardToken: {
142
+ symbol: string;
143
+ name: string | null;
144
+ id: string;
145
+ icon: string;
146
+ chainId: number;
147
+ address: string;
148
+ decimals: number;
149
+ verified: boolean;
150
+ isTest: boolean;
151
+ } & {
152
+ price?: number | null | undefined;
153
+ };
142
154
  distributionChain: {
143
155
  name: string;
144
156
  id: number;
@@ -58,7 +58,19 @@ export declare abstract class CampaignService {
58
58
  id: number;
59
59
  icon: string;
60
60
  };
61
- rewardToken: Token;
61
+ rewardToken: {
62
+ symbol: string;
63
+ name: string | null;
64
+ id: string;
65
+ icon: string;
66
+ chainId: number;
67
+ address: string;
68
+ decimals: number;
69
+ verified: boolean;
70
+ isTest: boolean;
71
+ } & {
72
+ price?: number | null | undefined;
73
+ };
62
74
  distributionChain: {
63
75
  name: string;
64
76
  id: number;
@@ -193,7 +205,19 @@ export declare abstract class CampaignService {
193
205
  id: number;
194
206
  icon: string;
195
207
  };
196
- rewardToken: Token;
208
+ rewardToken: {
209
+ symbol: string;
210
+ name: string | null;
211
+ id: string;
212
+ icon: string;
213
+ chainId: number;
214
+ address: string;
215
+ decimals: number;
216
+ verified: boolean;
217
+ isTest: boolean;
218
+ } & {
219
+ price?: number | null | undefined;
220
+ };
197
221
  distributionChain: {
198
222
  name: string;
199
223
  id: number;
@@ -1,4 +1,5 @@
1
1
  import { apiDbClient } from "../../../utils/prisma";
2
+ import { UserRepository } from "../user/user.repository";
2
3
  export class ComputedValueRepository {
3
4
  static async findCampaignValue(params) {
4
5
  return await apiDbClient.campaignComputedValue.findUnique({
@@ -27,6 +28,8 @@ export class ComputedValueRepository {
27
28
  });
28
29
  }
29
30
  static async upsertUserComputedValues(data) {
31
+ // Make sure user foreign keys exist
32
+ await UserRepository.createMany(data.map(item => ({ address: item.address, tags: [] })));
30
33
  await apiDbClient.$transaction(data.map(item => {
31
34
  return apiDbClient.userComputedValue.upsert({
32
35
  where: {
@@ -28,7 +28,10 @@ export class EnsoService {
28
28
  .filter(p => query.chainId === undefined || p.chains.some(c => c.id === query.chainId))
29
29
  .map(p => EnsoService.getProtocolId(p.slug))
30
30
  .filter(id => id !== undefined);
31
- return await ProtocolService.findMany({ id: protocolIds });
31
+ return await ProtocolService.findMany({
32
+ id: protocolIds.length === 1 ? protocolIds[0] : undefined,
33
+ ids: protocolIds.length > 1 ? protocolIds : undefined,
34
+ });
32
35
  }
33
36
  static async getTokens(chainId, slug, identifier) {
34
37
  const tokens = await EnsoService.#fetch("/v1/tokens", {
@@ -1,6 +1,6 @@
1
1
  import { TokenService } from "../token/token.service";
2
2
  import { chainToKyberLabel, dexIdToProtocolId, } from "./kyberzap.model";
3
- const KYBERZAP = `https://zap-api.kyberswap.com/`;
3
+ const KYBERZAP = "https://zap-api.kyberswap.com/";
4
4
  export class KyberZapService {
5
5
  static async #fetch(route, params) {
6
6
  const res = await fetch(`${KYBERZAP}${chainToKyberLabel[params?.chainId] ?? ""}${route}?${params?.query ? new URLSearchParams(params?.query) : ""}`, {
@@ -78,8 +78,20 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
78
78
  name: string;
79
79
  status: "PAST" | "LIVE" | "SOON";
80
80
  action: import("../../../../database/api/.generated").$Enums.OpportunityAction;
81
- tokens: any[];
82
- mainProtocol: "morpho" | "euler" | "ambient" | "arthswap" | "baseswap" | "camelot" | "crust" | "fenix" | "horiza" | "izumi" | "kim" | "pancakeswap-v3" | "quickswap-algebra" | "quickswap-uni" | "ramses" | "retro" | "stryke" | "stryke-pcs" | "stryke-sushi" | "sushiswap-v3" | "swapr" | "thruster" | "uniswap-v3" | "voltage" | "zero" | "koi" | "supswap-v3" | "zkswap" | "thirdtrade" | "uniswapv4" | "uniswap-v2" | "velodrome" | "aerodrome" | "balancer" | "curve" | "cross_curve" | "curveNPool" | "aura" | "akron" | "beefy" | "dragonswap" | "poolside" | "syncswap-v3" | "neptune" | "zkSwapThreePool" | "syncswap" | "rfx" | "radiant" | "aave" | "gearbox" | "compound" | "sturdy" | "frax" | "ionic" | "moonwell" | "fluid" | "silo" | "coumpound" | "dolomite" | "badger" | "ajna" | "layerbank" | "ion" | "venus" | "woofi" | "reactor_fusion" | "eigenlayer" | "vest" | "zerolend" | "hyperdrive" | "gamma" | "oku" | "hourglass" | "veda" | "kyo" | "sonex" | undefined;
81
+ tokens: ({
82
+ symbol: string;
83
+ name: string | null;
84
+ id: string;
85
+ icon: string;
86
+ chainId: number;
87
+ address: string;
88
+ decimals: number;
89
+ verified: boolean;
90
+ isTest: boolean;
91
+ } & {
92
+ price?: number | null | undefined;
93
+ })[];
94
+ mainProtocol: string | undefined;
83
95
  depositUrl: any;
84
96
  tags: string[];
85
97
  };
@@ -164,7 +176,19 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
164
176
  };
165
177
  id: string;
166
178
  depositUrl: string | undefined;
167
- tokens: Token[];
179
+ tokens: ({
180
+ symbol: string;
181
+ name: string | null;
182
+ id: string;
183
+ icon: string;
184
+ chainId: number;
185
+ address: string;
186
+ decimals: number;
187
+ verified: boolean;
188
+ isTest: boolean;
189
+ } & {
190
+ price?: number | null | undefined;
191
+ })[];
168
192
  chain: {
169
193
  name: string;
170
194
  id: number;
@@ -451,7 +475,19 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
451
475
  id: number;
452
476
  icon: string;
453
477
  };
454
- rewardToken: Token;
478
+ rewardToken: {
479
+ symbol: string;
480
+ name: string | null;
481
+ id: string;
482
+ icon: string;
483
+ chainId: number;
484
+ address: string;
485
+ decimals: number;
486
+ verified: boolean;
487
+ isTest: boolean;
488
+ } & {
489
+ price?: number | null | undefined;
490
+ };
455
491
  distributionChain: {
456
492
  name: string;
457
493
  id: number;
@@ -1,7 +1,7 @@
1
1
  import { type AprRecord } from "../apr/apr.model";
2
2
  import { type Campaign } from "../campaign/campaign.model";
3
3
  import type { Resource } from "../prisma";
4
- import { type Protocol, type ProtocolId } from "../protocol/protocol.model";
4
+ import { type Protocol } from "../protocol/protocol.model";
5
5
  import { type DailyRewardsRecord } from "../reward/reward.model";
6
6
  import { type Token } from "../token/token.model";
7
7
  import { type TvlRecord } from "../tvl/tvl.model";
@@ -32,7 +32,7 @@ export type OpportunityMetadata = {
32
32
  chainId: number;
33
33
  address: string;
34
34
  }[];
35
- mainProtocol?: ProtocolId;
35
+ mainProtocol?: string;
36
36
  tags?: string[];
37
37
  };
38
38
  export type OpportunityUnique = {
@@ -34,7 +34,7 @@ export declare abstract class OpportunityService {
34
34
  name: string;
35
35
  status: "SOON";
36
36
  action: import("../../../../database/api/.generated").$Enums.OpportunityAction;
37
- mainProtocol: "morpho" | "euler" | "ambient" | "arthswap" | "baseswap" | "camelot" | "crust" | "fenix" | "horiza" | "izumi" | "kim" | "pancakeswap-v3" | "quickswap-algebra" | "quickswap-uni" | "ramses" | "retro" | "stryke" | "stryke-pcs" | "stryke-sushi" | "sushiswap-v3" | "swapr" | "thruster" | "uniswap-v3" | "voltage" | "zero" | "koi" | "supswap-v3" | "zkswap" | "thirdtrade" | "uniswapv4" | "uniswap-v2" | "velodrome" | "aerodrome" | "balancer" | "curve" | "cross_curve" | "curveNPool" | "aura" | "akron" | "beefy" | "dragonswap" | "poolside" | "syncswap-v3" | "neptune" | "zkSwapThreePool" | "syncswap" | "rfx" | "radiant" | "aave" | "gearbox" | "compound" | "sturdy" | "frax" | "ionic" | "moonwell" | "fluid" | "silo" | "coumpound" | "dolomite" | "badger" | "ajna" | "layerbank" | "ion" | "venus" | "woofi" | "reactor_fusion" | "eigenlayer" | "vest" | "zerolend" | "hyperdrive" | "gamma" | "oku" | "hourglass" | "veda" | "kyo" | "sonex" | undefined;
37
+ mainProtocol: string | undefined;
38
38
  depositUrl: any;
39
39
  tags: string[];
40
40
  }>;
@@ -46,8 +46,20 @@ export declare abstract class OpportunityService {
46
46
  name: string;
47
47
  status: "PAST" | "LIVE" | "SOON";
48
48
  action: import("../../../../database/api/.generated").$Enums.OpportunityAction;
49
- tokens: any[];
50
- mainProtocol: "morpho" | "euler" | "ambient" | "arthswap" | "baseswap" | "camelot" | "crust" | "fenix" | "horiza" | "izumi" | "kim" | "pancakeswap-v3" | "quickswap-algebra" | "quickswap-uni" | "ramses" | "retro" | "stryke" | "stryke-pcs" | "stryke-sushi" | "sushiswap-v3" | "swapr" | "thruster" | "uniswap-v3" | "voltage" | "zero" | "koi" | "supswap-v3" | "zkswap" | "thirdtrade" | "uniswapv4" | "uniswap-v2" | "velodrome" | "aerodrome" | "balancer" | "curve" | "cross_curve" | "curveNPool" | "aura" | "akron" | "beefy" | "dragonswap" | "poolside" | "syncswap-v3" | "neptune" | "zkSwapThreePool" | "syncswap" | "rfx" | "radiant" | "aave" | "gearbox" | "compound" | "sturdy" | "frax" | "ionic" | "moonwell" | "fluid" | "silo" | "coumpound" | "dolomite" | "badger" | "ajna" | "layerbank" | "ion" | "venus" | "woofi" | "reactor_fusion" | "eigenlayer" | "vest" | "zerolend" | "hyperdrive" | "gamma" | "oku" | "hourglass" | "veda" | "kyo" | "sonex" | undefined;
49
+ tokens: ({
50
+ symbol: string;
51
+ name: string | null;
52
+ id: string;
53
+ icon: string;
54
+ chainId: number;
55
+ address: string;
56
+ decimals: number;
57
+ verified: boolean;
58
+ isTest: boolean;
59
+ } & {
60
+ price?: number | null | undefined;
61
+ })[];
62
+ mainProtocol: string | undefined;
51
63
  depositUrl: any;
52
64
  tags: string[];
53
65
  }>;
@@ -71,7 +83,7 @@ export declare abstract class OpportunityService {
71
83
  verified: boolean;
72
84
  isTest: boolean;
73
85
  }[];
74
- mainProtocol: "morpho" | "euler" | "ambient" | "arthswap" | "baseswap" | "camelot" | "crust" | "fenix" | "horiza" | "izumi" | "kim" | "pancakeswap-v3" | "quickswap-algebra" | "quickswap-uni" | "ramses" | "retro" | "stryke" | "stryke-pcs" | "stryke-sushi" | "sushiswap-v3" | "swapr" | "thruster" | "uniswap-v3" | "voltage" | "zero" | "koi" | "supswap-v3" | "zkswap" | "thirdtrade" | "uniswapv4" | "uniswap-v2" | "velodrome" | "aerodrome" | "balancer" | "curve" | "cross_curve" | "curveNPool" | "aura" | "akron" | "beefy" | "dragonswap" | "poolside" | "syncswap-v3" | "neptune" | "zkSwapThreePool" | "syncswap" | "rfx" | "radiant" | "aave" | "gearbox" | "compound" | "sturdy" | "frax" | "ionic" | "moonwell" | "fluid" | "silo" | "coumpound" | "dolomite" | "badger" | "ajna" | "layerbank" | "ion" | "venus" | "woofi" | "reactor_fusion" | "eigenlayer" | "vest" | "zerolend" | "hyperdrive" | "gamma" | "oku" | "hourglass" | "veda" | "kyo" | "sonex" | undefined;
86
+ mainProtocol: string | undefined;
75
87
  depositUrl: string | undefined;
76
88
  tags: string[];
77
89
  }>;
@@ -86,8 +98,20 @@ export declare abstract class OpportunityService {
86
98
  name: string;
87
99
  status: "PAST" | "LIVE" | "SOON";
88
100
  action: import("../../../../database/api/.generated").$Enums.OpportunityAction;
89
- tokens: any[];
90
- mainProtocol: "morpho" | "euler" | "ambient" | "arthswap" | "baseswap" | "camelot" | "crust" | "fenix" | "horiza" | "izumi" | "kim" | "pancakeswap-v3" | "quickswap-algebra" | "quickswap-uni" | "ramses" | "retro" | "stryke" | "stryke-pcs" | "stryke-sushi" | "sushiswap-v3" | "swapr" | "thruster" | "uniswap-v3" | "voltage" | "zero" | "koi" | "supswap-v3" | "zkswap" | "thirdtrade" | "uniswapv4" | "uniswap-v2" | "velodrome" | "aerodrome" | "balancer" | "curve" | "cross_curve" | "curveNPool" | "aura" | "akron" | "beefy" | "dragonswap" | "poolside" | "syncswap-v3" | "neptune" | "zkSwapThreePool" | "syncswap" | "rfx" | "radiant" | "aave" | "gearbox" | "compound" | "sturdy" | "frax" | "ionic" | "moonwell" | "fluid" | "silo" | "coumpound" | "dolomite" | "badger" | "ajna" | "layerbank" | "ion" | "venus" | "woofi" | "reactor_fusion" | "eigenlayer" | "vest" | "zerolend" | "hyperdrive" | "gamma" | "oku" | "hourglass" | "veda" | "kyo" | "sonex" | undefined;
101
+ tokens: ({
102
+ symbol: string;
103
+ name: string | null;
104
+ id: string;
105
+ icon: string;
106
+ chainId: number;
107
+ address: string;
108
+ decimals: number;
109
+ verified: boolean;
110
+ isTest: boolean;
111
+ } & {
112
+ price?: number | null | undefined;
113
+ })[];
114
+ mainProtocol: string | undefined;
91
115
  depositUrl: any;
92
116
  tags: string[];
93
117
  }>;
@@ -190,7 +214,19 @@ export declare abstract class OpportunityService {
190
214
  id: number;
191
215
  icon: string;
192
216
  };
193
- rewardToken: Token;
217
+ rewardToken: {
218
+ symbol: string;
219
+ name: string | null;
220
+ id: string;
221
+ icon: string;
222
+ chainId: number;
223
+ address: string;
224
+ decimals: number;
225
+ verified: boolean;
226
+ isTest: boolean;
227
+ } & {
228
+ price?: number | null | undefined;
229
+ };
194
230
  distributionChain: {
195
231
  name: string;
196
232
  id: number;
@@ -282,7 +318,19 @@ export declare abstract class OpportunityService {
282
318
  };
283
319
  id: string;
284
320
  depositUrl: string | undefined;
285
- tokens: Token[];
321
+ tokens: ({
322
+ symbol: string;
323
+ name: string | null;
324
+ id: string;
325
+ icon: string;
326
+ chainId: number;
327
+ address: string;
328
+ decimals: number;
329
+ verified: boolean;
330
+ isTest: boolean;
331
+ } & {
332
+ price?: number | null | undefined;
333
+ })[];
286
334
  chain: {
287
335
  name: string;
288
336
  id: number;
@@ -358,7 +406,19 @@ export declare abstract class OpportunityService {
358
406
  };
359
407
  id: string;
360
408
  depositUrl: string | undefined;
361
- tokens: Token[];
409
+ tokens: ({
410
+ symbol: string;
411
+ name: string | null;
412
+ id: string;
413
+ icon: string;
414
+ chainId: number;
415
+ address: string;
416
+ decimals: number;
417
+ verified: boolean;
418
+ isTest: boolean;
419
+ } & {
420
+ price?: number | null | undefined;
421
+ })[];
362
422
  chain: {
363
423
  name: string;
364
424
  id: number;
@@ -389,7 +449,19 @@ export declare abstract class OpportunityService {
389
449
  id: number;
390
450
  icon: string;
391
451
  };
392
- rewardToken: Token;
452
+ rewardToken: {
453
+ symbol: string;
454
+ name: string | null;
455
+ id: string;
456
+ icon: string;
457
+ chainId: number;
458
+ address: string;
459
+ decimals: number;
460
+ verified: boolean;
461
+ isTest: boolean;
462
+ } & {
463
+ price?: number | null | undefined;
464
+ };
393
465
  distributionChain: {
394
466
  name: string;
395
467
  id: number;
@@ -484,7 +556,19 @@ export declare abstract class OpportunityService {
484
556
  };
485
557
  id: string;
486
558
  depositUrl: string | undefined;
487
- tokens: Token[];
559
+ tokens: ({
560
+ symbol: string;
561
+ name: string | null;
562
+ id: string;
563
+ icon: string;
564
+ chainId: number;
565
+ address: string;
566
+ decimals: number;
567
+ verified: boolean;
568
+ isTest: boolean;
569
+ } & {
570
+ price?: number | null | undefined;
571
+ })[];
488
572
  chain: {
489
573
  name: string;
490
574
  id: number;
@@ -511,7 +595,19 @@ export declare abstract class OpportunityService {
511
595
  static formatResponseBase(opportunity: LightOpportunityFromDB): {
512
596
  id: string;
513
597
  depositUrl: string | undefined;
514
- tokens: Token[];
598
+ tokens: ({
599
+ symbol: string;
600
+ name: string | null;
601
+ id: string;
602
+ icon: string;
603
+ chainId: number;
604
+ address: string;
605
+ decimals: number;
606
+ verified: boolean;
607
+ isTest: boolean;
608
+ } & {
609
+ price?: number | null | undefined;
610
+ })[];
515
611
  chain: {
516
612
  name: string;
517
613
  id: number;
@@ -1,7 +1,7 @@
1
+ import { camelToKebabCase } from "../../../../utils/camelToKebabCase";
1
2
  import { OpportunityAction } from "../../../../../database/api/.generated";
2
- import { ChainId, almName, ammName } from "@sdk";
3
+ import { AMM, ChainId, almName, ammName } from "@sdk";
3
4
  import { getAddress } from "viem";
4
- import { ProtocolService } from "../../protocol";
5
5
  export const getClammMetadata = (chainId, params) => {
6
6
  let platform = ammName(params.amm);
7
7
  if (platform === "BaseSwap") {
@@ -43,6 +43,6 @@ export const getClammMetadata = (chainId, params) => {
43
43
  { chainId, address: params.token0 },
44
44
  { chainId, address: params.token1 },
45
45
  ],
46
- mainProtocol: ProtocolService.getIdFromAmmV3(params.amm),
46
+ mainProtocol: camelToKebabCase(AMM[params.amm]),
47
47
  };
48
48
  };
@@ -23,6 +23,7 @@ export declare const ProtocolController: Elysia<"/protocols", false, {
23
23
  items?: number | undefined;
24
24
  tags?: string[] | undefined;
25
25
  page?: number | undefined;
26
+ ids?: string[] | undefined;
26
27
  opportunityTag?: string | undefined;
27
28
  };
28
29
  headers: unknown;
@@ -21,6 +21,7 @@ export declare const ProtocolResourceDto: import("@sinclair/typebox").TObject<{
21
21
  }>;
22
22
  export declare const GetProtocolsQueryDto: import("@sinclair/typebox").TObject<{
23
23
  id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
24
+ ids: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
24
25
  name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
25
26
  tags: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
26
27
  opportunityTag: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
@@ -94,6 +94,7 @@ export const ProtocolResourceDto = t.Object({
94
94
  });
95
95
  export const GetProtocolsQueryDto = t.Object({
96
96
  id: t.Optional(t.String({ description: "Filter results by name. Useful for searching a protocol to verify its integration" })),
97
+ ids: t.Optional(t.Array(t.String())),
97
98
  name: t.Optional(t.String({ description: "Search protocols by name" })),
98
99
  tags: t.Optional(t.Array(t.String())),
99
100
  opportunityTag: t.Optional(t.String({ description: "Filter by underlying opportunities' tag" })),
@@ -22,7 +22,11 @@ export class ProtocolRepository {
22
22
  static #transformQueryToPrismaFilters(query) {
23
23
  return {
24
24
  where: {
25
- id: query.id ? { contains: query.id, mode: "insensitive" } : undefined,
25
+ id: query.id
26
+ ? { contains: query.id, mode: "insensitive" }
27
+ : query.ids
28
+ ? { in: query.ids, mode: "insensitive" }
29
+ : undefined,
26
30
  tags: query.tags ? { hasEvery: query.tags } : undefined,
27
31
  name: query.name ? { contains: query.name, mode: "insensitive" } : undefined,
28
32
  OR: query.opportunityTag // The opportunity tag specified can be either at the protocol level or the opportunity level
@@ -1,7 +1,5 @@
1
- import { AMM as AMMV3 } from "@sdk";
2
1
  import type { CreateProtocolModel, GetProtocolsQueryModel, Protocol, ProtocolId, UpdateProtocolModel } from "./protocol.model";
3
2
  export declare abstract class ProtocolService {
4
- static getIdFromAmmV3(amm: AMMV3): ProtocolId;
5
3
  static findMany(query: GetProtocolsQueryModel): Promise<Protocol["model"][]>;
6
4
  static countMany(query: GetProtocolsQueryModel): Promise<number>;
7
5
  static getFromId(id: ProtocolId | string): Promise<Protocol["model"] | null>;
@@ -1,47 +1,9 @@
1
1
  import { ChainService } from "../chain/chain.service";
2
2
  import { TokenService } from "../token/token.service";
3
3
  import { log } from "../../../utils/logger";
4
- import { AMM as AMMV3 } from "@sdk";
5
4
  import { ProtocolRepository } from "./protocol.repository";
6
5
  // ─── Protocols Services ──────────────────────────────────────────────────────
7
6
  export class ProtocolService {
8
- static getIdFromAmmV3(amm) {
9
- return {
10
- [AMMV3.ARTHSWAP]: "arthswap",
11
- [AMMV3.BaseSwap]: "baseswap",
12
- [AMMV3.Camelot]: "camelot",
13
- [AMMV3.Crust]: "crust",
14
- [AMMV3.Fenix]: "fenix",
15
- [AMMV3.Horiza]: "horiza",
16
- [AMMV3.Izumi]: "izumi",
17
- [AMMV3.Kim]: "kim",
18
- [AMMV3.PancakeSwapV3]: "pancakeswap-v3",
19
- [AMMV3.QuickswapAlgebra]: "quickswap-algebra",
20
- [AMMV3.QuickswapUni]: "quickswap-uni",
21
- [AMMV3.Ramses]: "ramses",
22
- [AMMV3.Retro]: "retro",
23
- [AMMV3.Stryke]: "stryke",
24
- [AMMV3.StrykePCS]: "stryke-pcs",
25
- [AMMV3.StrykeSushi]: "stryke-sushi",
26
- [AMMV3.SushiSwapV3]: "sushiswap-v3",
27
- [AMMV3.Swapr]: "swapr",
28
- [AMMV3.Thruster]: "thruster",
29
- [AMMV3.UniswapV3]: "uniswap-v3",
30
- [AMMV3.Voltage]: "voltage",
31
- [AMMV3.ZERO]: "zero",
32
- [AMMV3.KOI]: "koi",
33
- [AMMV3.SupswapV3]: "supswap-v3",
34
- [AMMV3.AERODROME]: "aerodrome",
35
- [AMMV3.zkSwap]: "zkswap",
36
- [AMMV3.ThirdTrade]: "thirdtrade",
37
- [AMMV3.SyncswapV3]: "syncswap",
38
- [AMMV3.Neptune]: "neptune",
39
- [AMMV3.KYO]: "kyo",
40
- [AMMV3.Sonex]: "sonex",
41
- [AMMV3.QuickswapAlgebraV1_2]: "quickswap-algebra",
42
- [AMMV3.Velodrome]: "velodrome",
43
- }[amm];
44
- }
45
7
  static async findMany(query) {
46
8
  const protocols = await ProtocolRepository.findMany(query);
47
9
  const enrichedProtocols = protocols.map(({ MainOpportunities, ...protocol }) => ({