@merkl/api 0.10.169 → 0.10.171
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/database/api/.generated/edge.js +6 -3
- package/dist/database/api/.generated/index-browser.js +3 -0
- package/dist/database/api/.generated/index.d.ts +113 -0
- package/dist/database/api/.generated/index.js +6 -3
- package/dist/database/api/.generated/package.json +1 -1
- package/dist/database/api/.generated/schema.prisma +17 -15
- package/dist/database/api/.generated/wasm.js +3 -0
- package/dist/src/eden/index.d.ts +147 -45
- package/dist/src/index.d.ts +49 -15
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/factoryFinder.js +2 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.d.ts +3 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.js +8 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/PendleYTProcessor.d.ts +29 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/PendleYTProcessor.js +31 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/TempestVaultProcessor.d.ts +3 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/TempestVaultProcessor.js +36 -7
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/processorMapping.js +3 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1RefactoFinal.js +1 -1
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +5 -1
- package/dist/src/modules/v4/campaign/campaign.model.d.ts +1 -0
- package/dist/src/modules/v4/campaign/campaign.model.js +1 -0
- package/dist/src/modules/v4/campaign/campaign.repository.d.ts +2 -0
- package/dist/src/modules/v4/campaign/campaign.repository.js +3 -1
- package/dist/src/modules/v4/campaign/campaign.service.d.ts +6 -2
- package/dist/src/modules/v4/campaign/campaign.service.js +2 -1
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +27 -10
- package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +2 -1
- package/dist/src/modules/v4/opportunity/opportunity.model.js +1 -0
- package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +26 -4
- package/dist/src/modules/v4/opportunity/opportunity.repository.js +2 -0
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +50 -24
- package/dist/src/modules/v4/opportunity/opportunity.service.js +2 -1
- package/dist/src/modules/v4/price/price.controller.js +1 -1
- package/dist/src/modules/v4/price/price.service.d.ts +1 -1
- package/dist/src/modules/v4/price/price.service.js +3 -3
- package/dist/src/modules/v4/reward/reward.repository.d.ts +4 -0
- package/dist/src/modules/v4/reward/reward.service.d.ts +22 -0
- package/dist/src/modules/v4/router.d.ts +49 -15
- package/dist/src/modules/v4/token/token.controller.d.ts +9 -4
- package/dist/src/modules/v4/token/token.model.d.ts +2 -1
- package/dist/src/modules/v4/token/token.model.js +1 -0
- package/dist/src/modules/v4/token/token.repository.d.ts +13 -1
- package/dist/src/modules/v4/token/token.repository.js +2 -0
- package/dist/src/modules/v4/token/token.service.d.ts +12 -4
- package/dist/src/modules/v4/token/token.service.js +11 -2
- package/dist/src/modules/v4/user/user.controller.d.ts +8 -0
- package/dist/src/routes/v3/blacklist.d.ts +49 -15
- package/dist/src/routes/v3/campaigns.d.ts +49 -15
- package/dist/src/routes/v3/campaignsInfo.d.ts +49 -15
- package/dist/src/routes/v3/multiChainPositions.d.ts +49 -15
- package/dist/src/routes/v3/opportunity.d.ts +49 -15
- package/dist/src/routes/v3/positions.d.ts +49 -15
- package/dist/src/routes/v3/rewards.d.ts +49 -15
- package/dist/src/routes/v3/updates.d.ts +49 -15
- package/dist/src/routes/v3/userRewards.d.ts +49 -15
- package/dist/src/utils/decodeCalls.js +4 -1
- package/dist/src/utils/encodeCalls.js +4 -1
- package/dist/src/utils/generateCardName.js +2 -0
- package/dist/src/utils/prices/services/erc4626Service.js +7 -1
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -92,14 +92,16 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
92
92
|
address: string;
|
93
93
|
icon: string;
|
94
94
|
decimals: number;
|
95
|
+
displaySymbol: string;
|
95
96
|
verified: boolean;
|
97
|
+
isTest: boolean;
|
96
98
|
price: number | null;
|
97
99
|
};
|
98
100
|
amount: bigint;
|
99
101
|
}[];
|
100
102
|
};
|
101
103
|
id: string;
|
102
|
-
tokens: {
|
104
|
+
tokens: ({
|
103
105
|
symbol: string;
|
104
106
|
name: string | null;
|
105
107
|
id: string;
|
@@ -108,8 +110,10 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
108
110
|
icon: string;
|
109
111
|
decimals: number;
|
110
112
|
verified: boolean;
|
111
|
-
|
112
|
-
}
|
113
|
+
isTest: boolean;
|
114
|
+
} & {
|
115
|
+
price?: number | null | undefined;
|
116
|
+
})[];
|
113
117
|
chain: {
|
114
118
|
name: string;
|
115
119
|
id: number;
|
@@ -191,14 +195,16 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
191
195
|
address: string;
|
192
196
|
icon: string;
|
193
197
|
decimals: number;
|
198
|
+
displaySymbol: string;
|
194
199
|
verified: boolean;
|
200
|
+
isTest: boolean;
|
195
201
|
price: number | null;
|
196
202
|
};
|
197
203
|
amount: bigint;
|
198
204
|
}[];
|
199
205
|
};
|
200
206
|
id: string;
|
201
|
-
tokens: {
|
207
|
+
tokens: ({
|
202
208
|
symbol: string;
|
203
209
|
name: string | null;
|
204
210
|
id: string;
|
@@ -207,8 +213,10 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
207
213
|
icon: string;
|
208
214
|
decimals: number;
|
209
215
|
verified: boolean;
|
210
|
-
|
211
|
-
}
|
216
|
+
isTest: boolean;
|
217
|
+
} & {
|
218
|
+
price?: number | null | undefined;
|
219
|
+
})[];
|
212
220
|
chain: {
|
213
221
|
name: string;
|
214
222
|
id: number;
|
@@ -248,7 +256,9 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
248
256
|
icon: string;
|
249
257
|
decimals: number;
|
250
258
|
verified: boolean;
|
251
|
-
|
259
|
+
isTest: boolean;
|
260
|
+
} & {
|
261
|
+
price?: number | null | undefined;
|
252
262
|
};
|
253
263
|
distributionChain: {
|
254
264
|
name: string;
|
@@ -300,6 +310,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
300
310
|
action?: string | undefined;
|
301
311
|
mainProtocolId?: string | undefined;
|
302
312
|
order?: undefined;
|
313
|
+
test?: boolean | undefined;
|
303
314
|
minimumTvl?: number | undefined;
|
304
315
|
};
|
305
316
|
headers: unknown;
|
@@ -345,14 +356,16 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
345
356
|
address: string;
|
346
357
|
icon: string;
|
347
358
|
decimals: number;
|
359
|
+
displaySymbol: string;
|
348
360
|
verified: boolean;
|
361
|
+
isTest: boolean;
|
349
362
|
price: number | null;
|
350
363
|
};
|
351
364
|
amount: bigint;
|
352
365
|
}[];
|
353
366
|
};
|
354
367
|
id: string;
|
355
|
-
tokens: {
|
368
|
+
tokens: ({
|
356
369
|
symbol: string;
|
357
370
|
name: string | null;
|
358
371
|
id: string;
|
@@ -361,8 +374,10 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
361
374
|
icon: string;
|
362
375
|
decimals: number;
|
363
376
|
verified: boolean;
|
364
|
-
|
365
|
-
}
|
377
|
+
isTest: boolean;
|
378
|
+
} & {
|
379
|
+
price?: number | null | undefined;
|
380
|
+
})[];
|
366
381
|
chain: {
|
367
382
|
name: string;
|
368
383
|
id: number;
|
@@ -409,6 +424,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
409
424
|
action?: string | undefined;
|
410
425
|
mainProtocolId?: string | undefined;
|
411
426
|
order?: undefined;
|
427
|
+
test?: boolean | undefined;
|
412
428
|
minimumTvl?: number | undefined;
|
413
429
|
};
|
414
430
|
headers: unknown;
|
@@ -439,6 +455,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
439
455
|
action?: string | undefined;
|
440
456
|
mainProtocolId?: string | undefined;
|
441
457
|
order?: undefined;
|
458
|
+
test?: boolean | undefined;
|
442
459
|
minimumTvl?: number | undefined;
|
443
460
|
};
|
444
461
|
headers: unknown;
|
@@ -53,6 +53,7 @@ export declare const GetOpportunitiesQueryDto: import("@sinclair/typebox").TObje
|
|
53
53
|
INVALID: "INVALID";
|
54
54
|
}>, import("@sinclair/typebox").TRegExp]>>;
|
55
55
|
tags: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
56
|
+
test: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
56
57
|
minimumTvl: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
57
58
|
tokens: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
58
59
|
status: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TEnum<{
|
@@ -111,7 +112,7 @@ export declare const CreateOpportunityDto: import("@sinclair/typebox").TObject<{
|
|
111
112
|
export declare const OpportunityAggregateFieldDto: import("@sinclair/typebox").TObject<{
|
112
113
|
field: import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<"dailyRewards">[]>;
|
113
114
|
}>;
|
114
|
-
export type
|
115
|
+
export type GetOpportunitiesQueryModel = typeof GetOpportunitiesQueryDto.static;
|
115
116
|
export type CreateOpportunityModel = typeof CreateOpportunityDto.static & {
|
116
117
|
id: string;
|
117
118
|
};
|
@@ -15,6 +15,7 @@ export const GetOpportunitiesQueryDto = t.Object({
|
|
15
15
|
//TODO: find a systemic way of handling query param arrays
|
16
16
|
action: t.Optional(t.Union([t.Enum(OpportunityAction), t.RegExp(/^(POOL|HOLD|DROP|LEND|BORROW)+(,(POOL|HOLD|DROP|LEND|BORROW)+)*$/)])),
|
17
17
|
tags: t.Optional(t.String()),
|
18
|
+
test: t.Optional(t.Boolean()),
|
18
19
|
minimumTvl: t.Optional(t.Number()),
|
19
20
|
tokens: t.Optional(t.String({ title: "Symbol" })),
|
20
21
|
status: t.Optional(t.Union([t.Enum(Status), t.RegExp(/^(LIVE|PAST|SOON)+(,(LIVE|PAST|SOON)+)*$/)])),
|
@@ -3,7 +3,7 @@ import type { MerklChainId } from "@sdk";
|
|
3
3
|
import { type AprRecord } from "../apr";
|
4
4
|
import { type DailyRewardsRecord } from "../reward";
|
5
5
|
import { type TvlRecord } from "../tvl";
|
6
|
-
import type { CreateOpportunityModel,
|
6
|
+
import type { CreateOpportunityModel, GetOpportunitiesQueryModel } from "./opportunity.model";
|
7
7
|
export declare abstract class OpportunityRepository {
|
8
8
|
#private;
|
9
9
|
static create(newOpp: CreateOpportunityModel): Promise<void>;
|
@@ -21,7 +21,9 @@ export declare abstract class OpportunityRepository {
|
|
21
21
|
address: string;
|
22
22
|
icon: string;
|
23
23
|
decimals: number;
|
24
|
+
displaySymbol: string;
|
24
25
|
verified: boolean;
|
26
|
+
isTest: boolean;
|
25
27
|
price: number | null;
|
26
28
|
}[];
|
27
29
|
Protocols: {
|
@@ -82,7 +84,9 @@ export declare abstract class OpportunityRepository {
|
|
82
84
|
address: string;
|
83
85
|
icon: string;
|
84
86
|
decimals: number;
|
87
|
+
displaySymbol: string;
|
85
88
|
verified: boolean;
|
89
|
+
isTest: boolean;
|
86
90
|
price: number | null;
|
87
91
|
};
|
88
92
|
CampaignStatus: {
|
@@ -145,7 +149,9 @@ export declare abstract class OpportunityRepository {
|
|
145
149
|
address: string;
|
146
150
|
icon: string;
|
147
151
|
decimals: number;
|
152
|
+
displaySymbol: string;
|
148
153
|
verified: boolean;
|
154
|
+
isTest: boolean;
|
149
155
|
price: number | null;
|
150
156
|
};
|
151
157
|
CampaignStatus: {
|
@@ -179,7 +185,9 @@ export declare abstract class OpportunityRepository {
|
|
179
185
|
address: string;
|
180
186
|
icon: string;
|
181
187
|
decimals: number;
|
188
|
+
displaySymbol: string;
|
182
189
|
verified: boolean;
|
190
|
+
isTest: boolean;
|
183
191
|
price: number | null;
|
184
192
|
}[];
|
185
193
|
Protocols: {
|
@@ -240,7 +248,9 @@ export declare abstract class OpportunityRepository {
|
|
240
248
|
address: string;
|
241
249
|
icon: string;
|
242
250
|
decimals: number;
|
251
|
+
displaySymbol: string;
|
243
252
|
verified: boolean;
|
253
|
+
isTest: boolean;
|
244
254
|
price: number | null;
|
245
255
|
};
|
246
256
|
CampaignStatus: {
|
@@ -288,7 +298,9 @@ export declare abstract class OpportunityRepository {
|
|
288
298
|
address: string;
|
289
299
|
icon: string;
|
290
300
|
decimals: number;
|
301
|
+
displaySymbol: string;
|
291
302
|
verified: boolean;
|
303
|
+
isTest: boolean;
|
292
304
|
price: number | null;
|
293
305
|
};
|
294
306
|
} & {
|
@@ -320,7 +332,7 @@ export declare abstract class OpportunityRepository {
|
|
320
332
|
apr: number;
|
321
333
|
dailyRewards: number;
|
322
334
|
})[]>;
|
323
|
-
static findMany(query:
|
335
|
+
static findMany(query: GetOpportunitiesQueryModel): Promise<({
|
324
336
|
Chain: {
|
325
337
|
name: string;
|
326
338
|
id: number;
|
@@ -334,7 +346,9 @@ export declare abstract class OpportunityRepository {
|
|
334
346
|
address: string;
|
335
347
|
icon: string;
|
336
348
|
decimals: number;
|
349
|
+
displaySymbol: string;
|
337
350
|
verified: boolean;
|
351
|
+
isTest: boolean;
|
338
352
|
price: number | null;
|
339
353
|
}[];
|
340
354
|
Protocols: {
|
@@ -395,7 +409,9 @@ export declare abstract class OpportunityRepository {
|
|
395
409
|
address: string;
|
396
410
|
icon: string;
|
397
411
|
decimals: number;
|
412
|
+
displaySymbol: string;
|
398
413
|
verified: boolean;
|
414
|
+
isTest: boolean;
|
399
415
|
price: number | null;
|
400
416
|
};
|
401
417
|
CampaignStatus: {
|
@@ -458,7 +474,9 @@ export declare abstract class OpportunityRepository {
|
|
458
474
|
address: string;
|
459
475
|
icon: string;
|
460
476
|
decimals: number;
|
477
|
+
displaySymbol: string;
|
461
478
|
verified: boolean;
|
479
|
+
isTest: boolean;
|
462
480
|
price: number | null;
|
463
481
|
};
|
464
482
|
CampaignStatus: {
|
@@ -492,7 +510,9 @@ export declare abstract class OpportunityRepository {
|
|
492
510
|
address: string;
|
493
511
|
icon: string;
|
494
512
|
decimals: number;
|
513
|
+
displaySymbol: string;
|
495
514
|
verified: boolean;
|
515
|
+
isTest: boolean;
|
496
516
|
price: number | null;
|
497
517
|
}[];
|
498
518
|
Protocols: {
|
@@ -553,7 +573,9 @@ export declare abstract class OpportunityRepository {
|
|
553
573
|
address: string;
|
554
574
|
icon: string;
|
555
575
|
decimals: number;
|
576
|
+
displaySymbol: string;
|
556
577
|
verified: boolean;
|
578
|
+
isTest: boolean;
|
557
579
|
price: number | null;
|
558
580
|
};
|
559
581
|
CampaignStatus: {
|
@@ -591,7 +613,7 @@ export declare abstract class OpportunityRepository {
|
|
591
613
|
apr: number;
|
592
614
|
dailyRewards: number;
|
593
615
|
})[]>;
|
594
|
-
static countMany(query:
|
616
|
+
static countMany(query: GetOpportunitiesQueryModel): Promise<number>;
|
595
617
|
static getAllIdsForDynamicOpp(): Promise<{
|
596
618
|
id: string;
|
597
619
|
}[]>;
|
@@ -679,7 +701,7 @@ export declare abstract class OpportunityRepository {
|
|
679
701
|
apr: number;
|
680
702
|
dailyRewards: number;
|
681
703
|
}>;
|
682
|
-
static aggregateSum(field: keyof Prisma.OpportunitySumAggregateInputType, query:
|
704
|
+
static aggregateSum(field: keyof Prisma.OpportunitySumAggregateInputType, query: GetOpportunitiesQueryModel): Promise<{
|
683
705
|
sum: never;
|
684
706
|
}>;
|
685
707
|
}
|
@@ -129,6 +129,7 @@ export class OpportunityRepository {
|
|
129
129
|
const protocols = query.mainProtocolId?.split(",");
|
130
130
|
const sort = (query.sort === "rewards" ? "dailyRewards" : query.sort) ?? "dailyRewards";
|
131
131
|
const order = query.order ?? "desc";
|
132
|
+
const test = query.test ?? false;
|
132
133
|
const noFilters = Object.values(filters).every(v => v === undefined);
|
133
134
|
const tokensFilters = tokens?.map(symbol => ({
|
134
135
|
Tokens: { some: { symbol: { equals: symbol, mode: "insensitive" } } },
|
@@ -154,6 +155,7 @@ export class OpportunityRepository {
|
|
154
155
|
status: !status ? undefined : { in: status },
|
155
156
|
},
|
156
157
|
{ mainProtocolId: !protocols ? undefined : { in: protocols } },
|
158
|
+
{ Campaigns: test ? undefined : { some: { RewardToken: { isTest: false } } } },
|
157
159
|
],
|
158
160
|
},
|
159
161
|
};
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { type CreateCampaignModel } from "../campaign";
|
2
2
|
import { Prisma } from "../../../../database/api/.generated";
|
3
3
|
import { type ChainId, type MerklChainId } from "@sdk";
|
4
|
-
import type { CreateOpportunityModel,
|
4
|
+
import type { CreateOpportunityModel, GetOpportunitiesQueryModel, LightOpportunityFromDB, OpportunityMetadata, OpportunityUnique } from "./opportunity.model";
|
5
5
|
import { OpportunityRepository } from "./opportunity.repository";
|
6
6
|
export declare abstract class OpportunityService {
|
7
7
|
static hashId(opportunity: OpportunityUnique): string;
|
@@ -60,14 +60,16 @@ export declare abstract class OpportunityService {
|
|
60
60
|
address: string;
|
61
61
|
icon: string;
|
62
62
|
decimals: number;
|
63
|
+
displaySymbol: string;
|
63
64
|
verified: boolean;
|
65
|
+
isTest: boolean;
|
64
66
|
price: number | null;
|
65
67
|
};
|
66
68
|
amount: bigint;
|
67
69
|
}[];
|
68
70
|
};
|
69
71
|
id: string;
|
70
|
-
tokens: {
|
72
|
+
tokens: ({
|
71
73
|
symbol: string;
|
72
74
|
name: string | null;
|
73
75
|
id: string;
|
@@ -76,8 +78,10 @@ export declare abstract class OpportunityService {
|
|
76
78
|
icon: string;
|
77
79
|
decimals: number;
|
78
80
|
verified: boolean;
|
79
|
-
|
80
|
-
}
|
81
|
+
isTest: boolean;
|
82
|
+
} & {
|
83
|
+
price?: number | null | undefined;
|
84
|
+
})[];
|
81
85
|
chain: {
|
82
86
|
name: string;
|
83
87
|
id: number;
|
@@ -118,7 +122,9 @@ export declare abstract class OpportunityService {
|
|
118
122
|
icon: string;
|
119
123
|
decimals: number;
|
120
124
|
verified: boolean;
|
121
|
-
|
125
|
+
isTest: boolean;
|
126
|
+
} & {
|
127
|
+
price?: number | null | undefined;
|
122
128
|
};
|
123
129
|
distributionChain: {
|
124
130
|
name: string;
|
@@ -188,14 +194,16 @@ export declare abstract class OpportunityService {
|
|
188
194
|
address: string;
|
189
195
|
icon: string;
|
190
196
|
decimals: number;
|
197
|
+
displaySymbol: string;
|
191
198
|
verified: boolean;
|
199
|
+
isTest: boolean;
|
192
200
|
price: number | null;
|
193
201
|
};
|
194
202
|
amount: bigint;
|
195
203
|
}[];
|
196
204
|
};
|
197
205
|
id: string;
|
198
|
-
tokens: {
|
206
|
+
tokens: ({
|
199
207
|
symbol: string;
|
200
208
|
name: string | null;
|
201
209
|
id: string;
|
@@ -204,8 +212,10 @@ export declare abstract class OpportunityService {
|
|
204
212
|
icon: string;
|
205
213
|
decimals: number;
|
206
214
|
verified: boolean;
|
207
|
-
|
208
|
-
}
|
215
|
+
isTest: boolean;
|
216
|
+
} & {
|
217
|
+
price?: number | null | undefined;
|
218
|
+
})[];
|
209
219
|
chain: {
|
210
220
|
name: string;
|
211
221
|
id: number;
|
@@ -235,7 +245,7 @@ export declare abstract class OpportunityService {
|
|
235
245
|
* @param query
|
236
246
|
* @returns A list of opportunities
|
237
247
|
*/
|
238
|
-
static getMany(query:
|
248
|
+
static getMany(query: GetOpportunitiesQueryModel): Promise<({
|
239
249
|
aprRecord: {
|
240
250
|
cumulated: number;
|
241
251
|
timestamp: bigint;
|
@@ -276,14 +286,16 @@ export declare abstract class OpportunityService {
|
|
276
286
|
address: string;
|
277
287
|
icon: string;
|
278
288
|
decimals: number;
|
289
|
+
displaySymbol: string;
|
279
290
|
verified: boolean;
|
291
|
+
isTest: boolean;
|
280
292
|
price: number | null;
|
281
293
|
};
|
282
294
|
amount: bigint;
|
283
295
|
}[];
|
284
296
|
};
|
285
297
|
id: string;
|
286
|
-
tokens: {
|
298
|
+
tokens: ({
|
287
299
|
symbol: string;
|
288
300
|
name: string | null;
|
289
301
|
id: string;
|
@@ -292,8 +304,10 @@ export declare abstract class OpportunityService {
|
|
292
304
|
icon: string;
|
293
305
|
decimals: number;
|
294
306
|
verified: boolean;
|
295
|
-
|
296
|
-
}
|
307
|
+
isTest: boolean;
|
308
|
+
} & {
|
309
|
+
price?: number | null | undefined;
|
310
|
+
})[];
|
297
311
|
chain: {
|
298
312
|
name: string;
|
299
313
|
id: number;
|
@@ -359,14 +373,16 @@ export declare abstract class OpportunityService {
|
|
359
373
|
address: string;
|
360
374
|
icon: string;
|
361
375
|
decimals: number;
|
376
|
+
displaySymbol: string;
|
362
377
|
verified: boolean;
|
378
|
+
isTest: boolean;
|
363
379
|
price: number | null;
|
364
380
|
};
|
365
381
|
amount: bigint;
|
366
382
|
}[];
|
367
383
|
};
|
368
384
|
id: string;
|
369
|
-
tokens: {
|
385
|
+
tokens: ({
|
370
386
|
symbol: string;
|
371
387
|
name: string | null;
|
372
388
|
id: string;
|
@@ -375,8 +391,10 @@ export declare abstract class OpportunityService {
|
|
375
391
|
icon: string;
|
376
392
|
decimals: number;
|
377
393
|
verified: boolean;
|
378
|
-
|
379
|
-
}
|
394
|
+
isTest: boolean;
|
395
|
+
} & {
|
396
|
+
price?: number | null | undefined;
|
397
|
+
})[];
|
380
398
|
chain: {
|
381
399
|
name: string;
|
382
400
|
id: number;
|
@@ -417,7 +435,9 @@ export declare abstract class OpportunityService {
|
|
417
435
|
icon: string;
|
418
436
|
decimals: number;
|
419
437
|
verified: boolean;
|
420
|
-
|
438
|
+
isTest: boolean;
|
439
|
+
} & {
|
440
|
+
price?: number | null | undefined;
|
421
441
|
};
|
422
442
|
distributionChain: {
|
423
443
|
name: string;
|
@@ -455,7 +475,7 @@ export declare abstract class OpportunityService {
|
|
455
475
|
* @param query
|
456
476
|
* @returns the number of opportunities
|
457
477
|
*/
|
458
|
-
static countMany(query:
|
478
|
+
static countMany(query: GetOpportunitiesQueryModel): Promise<number>;
|
459
479
|
static formatResponse(opportunity: Awaited<ReturnType<typeof OpportunityRepository.findUniqueOrThrow>>): {
|
460
480
|
aprRecord: {
|
461
481
|
cumulated: number;
|
@@ -497,14 +517,16 @@ export declare abstract class OpportunityService {
|
|
497
517
|
address: string;
|
498
518
|
icon: string;
|
499
519
|
decimals: number;
|
520
|
+
displaySymbol: string;
|
500
521
|
verified: boolean;
|
522
|
+
isTest: boolean;
|
501
523
|
price: number | null;
|
502
524
|
};
|
503
525
|
amount: bigint;
|
504
526
|
}[];
|
505
527
|
};
|
506
528
|
id: string;
|
507
|
-
tokens: {
|
529
|
+
tokens: ({
|
508
530
|
symbol: string;
|
509
531
|
name: string | null;
|
510
532
|
id: string;
|
@@ -513,8 +535,10 @@ export declare abstract class OpportunityService {
|
|
513
535
|
icon: string;
|
514
536
|
decimals: number;
|
515
537
|
verified: boolean;
|
516
|
-
|
517
|
-
}
|
538
|
+
isTest: boolean;
|
539
|
+
} & {
|
540
|
+
price?: number | null | undefined;
|
541
|
+
})[];
|
518
542
|
chain: {
|
519
543
|
name: string;
|
520
544
|
id: number;
|
@@ -541,7 +565,7 @@ export declare abstract class OpportunityService {
|
|
541
565
|
} | null;
|
542
566
|
static formatResponseBase(opportunity: LightOpportunityFromDB): {
|
543
567
|
id: string;
|
544
|
-
tokens: {
|
568
|
+
tokens: ({
|
545
569
|
symbol: string;
|
546
570
|
name: string | null;
|
547
571
|
id: string;
|
@@ -550,8 +574,10 @@ export declare abstract class OpportunityService {
|
|
550
574
|
icon: string;
|
551
575
|
decimals: number;
|
552
576
|
verified: boolean;
|
553
|
-
|
554
|
-
}
|
577
|
+
isTest: boolean;
|
578
|
+
} & {
|
579
|
+
price?: number | null | undefined;
|
580
|
+
})[];
|
555
581
|
chain: {
|
556
582
|
name: string;
|
557
583
|
id: number;
|
@@ -576,7 +602,7 @@ export declare abstract class OpportunityService {
|
|
576
602
|
apr: number;
|
577
603
|
dailyRewards: number;
|
578
604
|
};
|
579
|
-
static aggregate(query:
|
605
|
+
static aggregate(query: GetOpportunitiesQueryModel, field: keyof Prisma.OpportunitySumAggregateInputType): Promise<{
|
580
606
|
sum: never;
|
581
607
|
}>;
|
582
608
|
}
|
@@ -6,6 +6,7 @@ import { record } from "@elysiajs/opentelemetry";
|
|
6
6
|
import { Campaign } from "@sdk";
|
7
7
|
import { CacheService } from "../cache";
|
8
8
|
import { TTLPresets } from "../cache/cache.model";
|
9
|
+
import { TokenService } from "../token";
|
9
10
|
import { OpportunityRepository } from "./opportunity.repository";
|
10
11
|
import { getAjnaMetadata } from "./subservices/getAjnaMetadata.service";
|
11
12
|
import { getBadgerMetadata } from "./subservices/getBadgerMetadata.service";
|
@@ -212,7 +213,7 @@ export class OpportunityService {
|
|
212
213
|
return {
|
213
214
|
...opp,
|
214
215
|
id,
|
215
|
-
tokens: Tokens,
|
216
|
+
tokens: Tokens.map(t => TokenService.format(t)),
|
216
217
|
chain: Chain,
|
217
218
|
protocol: MainProtocol ?? undefined,
|
218
219
|
};
|
@@ -9,7 +9,7 @@ export const PriceController = new Elysia({ prefix: "/prices", detail: { tags: [
|
|
9
9
|
.get("/", async () => await PriceService.findMany())
|
10
10
|
.get("/array", async () => await PriceService.findManyArray())
|
11
11
|
// ─── Get Price By Token Symbol ───────────────────────────────────────
|
12
|
-
.get("/symbol/:symbol", async ({ params }) => await PriceService.
|
12
|
+
.get("/symbol/:symbol", async ({ params }) => await PriceService.fetchPriceBySymbol(params.symbol), {
|
13
13
|
params: PriceSourceIdentifier,
|
14
14
|
})
|
15
15
|
// ─── Price Sources Group ─────────────────────────────────────────────
|
@@ -8,7 +8,7 @@ export declare class PriceService {
|
|
8
8
|
token: string;
|
9
9
|
}[]>;
|
10
10
|
/** Fetches a single price */
|
11
|
-
static
|
11
|
+
static fetchPriceBySymbol(symbol: string): Promise<number>;
|
12
12
|
static getPriceSourceBySymbol(symbol: string): Promise<{
|
13
13
|
symbol: string;
|
14
14
|
method: import("../../../../database/api/.generated").$Enums.PriceSourceMethod;
|
@@ -11,7 +11,7 @@ export class PriceService {
|
|
11
11
|
return (await Pricer.load()).getArray();
|
12
12
|
}
|
13
13
|
/** Fetches a single price */
|
14
|
-
static async
|
14
|
+
static async fetchPriceBySymbol(symbol) {
|
15
15
|
const priceSource = await PriceRepository.findBySymbolOrThrow(symbol);
|
16
16
|
if (!priceSource) {
|
17
17
|
throw new Error(`Price source with symbol ${symbol} not found`);
|
@@ -20,7 +20,7 @@ export class PriceService {
|
|
20
20
|
return priceSource.args.value;
|
21
21
|
}
|
22
22
|
if (priceSource.method === PriceSourceMethod.EQUAL_TO) {
|
23
|
-
return PriceService.
|
23
|
+
return PriceService.fetchPriceBySymbol(priceSource.args.token);
|
24
24
|
}
|
25
25
|
return (await PriceFetcherFactory.instance.get(priceSource.method).getPrice([priceSource]))?.[0]?.rate;
|
26
26
|
}
|
@@ -33,7 +33,7 @@ export class PriceService {
|
|
33
33
|
}
|
34
34
|
static async createPriceSource(priceSource) {
|
35
35
|
const created = await PriceRepository.create(priceSource);
|
36
|
-
return await PriceService.
|
36
|
+
return await PriceService.fetchPriceBySymbol(created.symbol);
|
37
37
|
}
|
38
38
|
static async updatePriceSource(symbol, newPriceSource) {
|
39
39
|
return await PriceRepository.updateBySymbol(symbol, newPriceSource);
|
@@ -12,7 +12,9 @@ export declare abstract class RewardRepository {
|
|
12
12
|
address: string;
|
13
13
|
icon: string;
|
14
14
|
decimals: number;
|
15
|
+
displaySymbol: string;
|
15
16
|
verified: boolean;
|
17
|
+
isTest: boolean;
|
16
18
|
price: number | null;
|
17
19
|
};
|
18
20
|
Breakdown: ({
|
@@ -32,7 +34,9 @@ export declare abstract class RewardRepository {
|
|
32
34
|
address: string;
|
33
35
|
icon: string;
|
34
36
|
decimals: number;
|
37
|
+
displaySymbol: string;
|
35
38
|
verified: boolean;
|
39
|
+
isTest: boolean;
|
36
40
|
price: number | null;
|
37
41
|
}[];
|
38
42
|
Protocols: {
|