@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.
- package/dist/src/eden/index.d.ts +410 -35
- package/dist/src/index.d.ts +82 -7
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +13 -1
- package/dist/src/modules/v4/campaign/campaign.service.d.ts +26 -2
- package/dist/src/modules/v4/computedValue/computedValue.repository.js +3 -0
- package/dist/src/modules/v4/enso/enso.service.js +4 -1
- package/dist/src/modules/v4/kyberzap/kyberzap.service.js +1 -1
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +40 -4
- package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +2 -2
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +108 -12
- package/dist/src/modules/v4/opportunity/subservices/getClammMetadata.service.js +3 -3
- package/dist/src/modules/v4/protocol/protocol.controller.d.ts +1 -0
- package/dist/src/modules/v4/protocol/protocol.model.d.ts +1 -0
- package/dist/src/modules/v4/protocol/protocol.model.js +1 -0
- package/dist/src/modules/v4/protocol/protocol.repository.js +5 -1
- package/dist/src/modules/v4/protocol/protocol.service.d.ts +0 -2
- package/dist/src/modules/v4/protocol/protocol.service.js +0 -38
- package/dist/src/modules/v4/router.d.ts +82 -7
- package/dist/src/modules/v4/token/token.controller.d.ts +28 -2
- package/dist/src/modules/v4/token/token.service.d.ts +71 -7
- package/dist/src/modules/v4/token/token.service.js +3 -3
- package/dist/src/utils/camelToKebabCase.d.ts +1 -0
- package/dist/src/utils/camelToKebabCase.js +3 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/src/index.d.ts
CHANGED
@@ -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:
|
227
|
-
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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({
|
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 =
|
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:
|
82
|
-
|
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:
|
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:
|
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
|
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?:
|
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:
|
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:
|
50
|
-
|
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:
|
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:
|
90
|
-
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
46
|
+
mainProtocol: camelToKebabCase(AMM[params.amm]),
|
47
47
|
};
|
48
48
|
};
|
@@ -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
|
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 }) => ({
|