@merkl/api 0.10.169 → 0.10.171
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -29,7 +29,9 @@ export declare abstract class RewardService {
|
|
29
29
|
address: string;
|
30
30
|
icon: string;
|
31
31
|
decimals: number;
|
32
|
+
displaySymbol: string;
|
32
33
|
verified: boolean;
|
34
|
+
isTest: boolean;
|
33
35
|
price: number | null;
|
34
36
|
}[];
|
35
37
|
Protocols: {
|
@@ -83,7 +85,9 @@ export declare abstract class RewardService {
|
|
83
85
|
address: string;
|
84
86
|
icon: string;
|
85
87
|
decimals: number;
|
88
|
+
displaySymbol: string;
|
86
89
|
verified: boolean;
|
90
|
+
isTest: boolean;
|
87
91
|
price: number | null;
|
88
92
|
};
|
89
93
|
breakdowns: {
|
@@ -102,7 +106,9 @@ export declare abstract class RewardService {
|
|
102
106
|
address: string;
|
103
107
|
icon: string;
|
104
108
|
decimals: number;
|
109
|
+
displaySymbol: string;
|
105
110
|
verified: boolean;
|
111
|
+
isTest: boolean;
|
106
112
|
price: number | null;
|
107
113
|
}[];
|
108
114
|
Protocols: {
|
@@ -159,7 +165,9 @@ export declare abstract class RewardService {
|
|
159
165
|
address: string;
|
160
166
|
icon: string;
|
161
167
|
decimals: number;
|
168
|
+
displaySymbol: string;
|
162
169
|
verified: boolean;
|
170
|
+
isTest: boolean;
|
163
171
|
price: number | null;
|
164
172
|
};
|
165
173
|
Breakdown: ({
|
@@ -179,7 +187,9 @@ export declare abstract class RewardService {
|
|
179
187
|
address: string;
|
180
188
|
icon: string;
|
181
189
|
decimals: number;
|
190
|
+
displaySymbol: string;
|
182
191
|
verified: boolean;
|
192
|
+
isTest: boolean;
|
183
193
|
price: number | null;
|
184
194
|
}[];
|
185
195
|
Protocols: {
|
@@ -265,7 +275,9 @@ export declare abstract class RewardService {
|
|
265
275
|
address: string;
|
266
276
|
icon: string;
|
267
277
|
decimals: number;
|
278
|
+
displaySymbol: string;
|
268
279
|
verified: boolean;
|
280
|
+
isTest: boolean;
|
269
281
|
price: number | null;
|
270
282
|
};
|
271
283
|
breakdowns: {
|
@@ -284,7 +296,9 @@ export declare abstract class RewardService {
|
|
284
296
|
address: string;
|
285
297
|
icon: string;
|
286
298
|
decimals: number;
|
299
|
+
displaySymbol: string;
|
287
300
|
verified: boolean;
|
301
|
+
isTest: boolean;
|
288
302
|
price: number | null;
|
289
303
|
}[];
|
290
304
|
Protocols: {
|
@@ -355,7 +369,9 @@ export declare abstract class RewardService {
|
|
355
369
|
address: string;
|
356
370
|
icon: string;
|
357
371
|
decimals: number;
|
372
|
+
displaySymbol: string;
|
358
373
|
verified: boolean;
|
374
|
+
isTest: boolean;
|
359
375
|
price: number | null;
|
360
376
|
};
|
361
377
|
breakdowns: {
|
@@ -374,7 +390,9 @@ export declare abstract class RewardService {
|
|
374
390
|
address: string;
|
375
391
|
icon: string;
|
376
392
|
decimals: number;
|
393
|
+
displaySymbol: string;
|
377
394
|
verified: boolean;
|
395
|
+
isTest: boolean;
|
378
396
|
price: number | null;
|
379
397
|
}[];
|
380
398
|
Protocols: {
|
@@ -442,7 +460,9 @@ export declare abstract class RewardService {
|
|
442
460
|
address: string;
|
443
461
|
icon: string;
|
444
462
|
decimals: number;
|
463
|
+
displaySymbol: string;
|
445
464
|
verified: boolean;
|
465
|
+
isTest: boolean;
|
446
466
|
price: number | null;
|
447
467
|
};
|
448
468
|
Breakdown: ({
|
@@ -462,7 +482,9 @@ export declare abstract class RewardService {
|
|
462
482
|
address: string;
|
463
483
|
icon: string;
|
464
484
|
decimals: number;
|
485
|
+
displaySymbol: string;
|
465
486
|
verified: boolean;
|
487
|
+
isTest: boolean;
|
466
488
|
price: number | null;
|
467
489
|
}[];
|
468
490
|
Protocols: {
|
@@ -101,14 +101,16 @@ export declare const v4: Elysia<"/v4", false, {
|
|
101
101
|
address: string;
|
102
102
|
icon: string;
|
103
103
|
decimals: number;
|
104
|
+
displaySymbol: string;
|
104
105
|
verified: boolean;
|
106
|
+
isTest: boolean;
|
105
107
|
price: number | null;
|
106
108
|
};
|
107
109
|
amount: bigint;
|
108
110
|
}[];
|
109
111
|
};
|
110
112
|
id: string;
|
111
|
-
tokens: {
|
113
|
+
tokens: ({
|
112
114
|
symbol: string;
|
113
115
|
name: string | null;
|
114
116
|
id: string;
|
@@ -117,8 +119,10 @@ export declare const v4: Elysia<"/v4", false, {
|
|
117
119
|
icon: string;
|
118
120
|
decimals: number;
|
119
121
|
verified: boolean;
|
120
|
-
|
121
|
-
}
|
122
|
+
isTest: boolean;
|
123
|
+
} & {
|
124
|
+
price?: number | null | undefined;
|
125
|
+
})[];
|
122
126
|
chain: {
|
123
127
|
name: string;
|
124
128
|
id: number;
|
@@ -200,14 +204,16 @@ export declare const v4: Elysia<"/v4", false, {
|
|
200
204
|
address: string;
|
201
205
|
icon: string;
|
202
206
|
decimals: number;
|
207
|
+
displaySymbol: string;
|
203
208
|
verified: boolean;
|
209
|
+
isTest: boolean;
|
204
210
|
price: number | null;
|
205
211
|
};
|
206
212
|
amount: bigint;
|
207
213
|
}[];
|
208
214
|
};
|
209
215
|
id: string;
|
210
|
-
tokens: {
|
216
|
+
tokens: ({
|
211
217
|
symbol: string;
|
212
218
|
name: string | null;
|
213
219
|
id: string;
|
@@ -216,8 +222,10 @@ export declare const v4: Elysia<"/v4", false, {
|
|
216
222
|
icon: string;
|
217
223
|
decimals: number;
|
218
224
|
verified: boolean;
|
219
|
-
|
220
|
-
}
|
225
|
+
isTest: boolean;
|
226
|
+
} & {
|
227
|
+
price?: number | null | undefined;
|
228
|
+
})[];
|
221
229
|
chain: {
|
222
230
|
name: string;
|
223
231
|
id: number;
|
@@ -257,7 +265,9 @@ export declare const v4: Elysia<"/v4", false, {
|
|
257
265
|
icon: string;
|
258
266
|
decimals: number;
|
259
267
|
verified: boolean;
|
260
|
-
|
268
|
+
isTest: boolean;
|
269
|
+
} & {
|
270
|
+
price?: number | null | undefined;
|
261
271
|
};
|
262
272
|
distributionChain: {
|
263
273
|
name: string;
|
@@ -309,6 +319,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
309
319
|
action?: string | undefined;
|
310
320
|
mainProtocolId?: string | undefined;
|
311
321
|
order?: undefined;
|
322
|
+
test?: boolean | undefined;
|
312
323
|
minimumTvl?: number | undefined;
|
313
324
|
};
|
314
325
|
headers: unknown;
|
@@ -354,14 +365,16 @@ export declare const v4: Elysia<"/v4", false, {
|
|
354
365
|
address: string;
|
355
366
|
icon: string;
|
356
367
|
decimals: number;
|
368
|
+
displaySymbol: string;
|
357
369
|
verified: boolean;
|
370
|
+
isTest: boolean;
|
358
371
|
price: number | null;
|
359
372
|
};
|
360
373
|
amount: bigint;
|
361
374
|
}[];
|
362
375
|
};
|
363
376
|
id: string;
|
364
|
-
tokens: {
|
377
|
+
tokens: ({
|
365
378
|
symbol: string;
|
366
379
|
name: string | null;
|
367
380
|
id: string;
|
@@ -370,8 +383,10 @@ export declare const v4: Elysia<"/v4", false, {
|
|
370
383
|
icon: string;
|
371
384
|
decimals: number;
|
372
385
|
verified: boolean;
|
373
|
-
|
374
|
-
}
|
386
|
+
isTest: boolean;
|
387
|
+
} & {
|
388
|
+
price?: number | null | undefined;
|
389
|
+
})[];
|
375
390
|
chain: {
|
376
391
|
name: string;
|
377
392
|
id: number;
|
@@ -418,6 +433,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
418
433
|
action?: string | undefined;
|
419
434
|
mainProtocolId?: string | undefined;
|
420
435
|
order?: undefined;
|
436
|
+
test?: boolean | undefined;
|
421
437
|
minimumTvl?: number | undefined;
|
422
438
|
};
|
423
439
|
headers: unknown;
|
@@ -448,6 +464,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
448
464
|
action?: string | undefined;
|
449
465
|
mainProtocolId?: string | undefined;
|
450
466
|
order?: undefined;
|
467
|
+
test?: boolean | undefined;
|
451
468
|
minimumTvl?: number | undefined;
|
452
469
|
};
|
453
470
|
headers: unknown;
|
@@ -522,6 +539,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
522
539
|
mainParameter?: string | undefined;
|
523
540
|
campaignId?: string | undefined;
|
524
541
|
opportunityId?: string | undefined;
|
542
|
+
test?: boolean | undefined;
|
525
543
|
tokenSymbol?: string | undefined;
|
526
544
|
};
|
527
545
|
headers: unknown;
|
@@ -542,7 +560,9 @@ export declare const v4: Elysia<"/v4", false, {
|
|
542
560
|
icon: string;
|
543
561
|
decimals: number;
|
544
562
|
verified: boolean;
|
545
|
-
|
563
|
+
isTest: boolean;
|
564
|
+
} & {
|
565
|
+
price?: number | null | undefined;
|
546
566
|
};
|
547
567
|
distributionChain: {
|
548
568
|
name: string;
|
@@ -590,6 +610,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
590
610
|
mainParameter?: string | undefined;
|
591
611
|
campaignId?: string | undefined;
|
592
612
|
opportunityId?: string | undefined;
|
613
|
+
test?: boolean | undefined;
|
593
614
|
tokenSymbol?: string | undefined;
|
594
615
|
};
|
595
616
|
headers: unknown;
|
@@ -745,6 +766,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
745
766
|
icon: string;
|
746
767
|
decimals: number;
|
747
768
|
verified: boolean;
|
769
|
+
isTest: boolean;
|
748
770
|
price?: number | null | undefined;
|
749
771
|
} | undefined;
|
750
772
|
};
|
@@ -774,6 +796,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
774
796
|
icon: string;
|
775
797
|
decimals: number;
|
776
798
|
verified: boolean;
|
799
|
+
isTest: boolean;
|
777
800
|
} & {
|
778
801
|
price?: number | null | undefined;
|
779
802
|
} & {
|
@@ -795,10 +818,11 @@ export declare const v4: Elysia<"/v4", false, {
|
|
795
818
|
chainId?: any;
|
796
819
|
address?: string | undefined;
|
797
820
|
verified?: boolean | undefined;
|
821
|
+
test?: boolean | undefined;
|
798
822
|
};
|
799
823
|
headers: unknown;
|
800
824
|
response: {
|
801
|
-
200:
|
825
|
+
200: {
|
802
826
|
symbol: string;
|
803
827
|
name: string | null;
|
804
828
|
id: string;
|
@@ -806,10 +830,11 @@ export declare const v4: Elysia<"/v4", false, {
|
|
806
830
|
address: string;
|
807
831
|
icon: string;
|
808
832
|
decimals: number;
|
833
|
+
displaySymbol: string;
|
809
834
|
verified: boolean;
|
810
|
-
|
811
|
-
price
|
812
|
-
}
|
835
|
+
isTest: boolean;
|
836
|
+
price: number | null;
|
837
|
+
}[];
|
813
838
|
};
|
814
839
|
};
|
815
840
|
};
|
@@ -826,6 +851,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
826
851
|
chainId?: any;
|
827
852
|
address?: string | undefined;
|
828
853
|
verified?: boolean | undefined;
|
854
|
+
test?: boolean | undefined;
|
829
855
|
};
|
830
856
|
headers: unknown;
|
831
857
|
response: {
|
@@ -1469,7 +1495,9 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1469
1495
|
address: string;
|
1470
1496
|
icon: string;
|
1471
1497
|
decimals: number;
|
1498
|
+
displaySymbol: string;
|
1472
1499
|
verified: boolean;
|
1500
|
+
isTest: boolean;
|
1473
1501
|
price: number | null;
|
1474
1502
|
};
|
1475
1503
|
breakdowns: {
|
@@ -1488,7 +1516,9 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1488
1516
|
address: string;
|
1489
1517
|
icon: string;
|
1490
1518
|
decimals: number;
|
1519
|
+
displaySymbol: string;
|
1491
1520
|
verified: boolean;
|
1521
|
+
isTest: boolean;
|
1492
1522
|
price: number | null;
|
1493
1523
|
}[];
|
1494
1524
|
Protocols: {
|
@@ -1579,7 +1609,9 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1579
1609
|
address: string;
|
1580
1610
|
icon: string;
|
1581
1611
|
decimals: number;
|
1612
|
+
displaySymbol: string;
|
1582
1613
|
verified: boolean;
|
1614
|
+
isTest: boolean;
|
1583
1615
|
price: number | null;
|
1584
1616
|
};
|
1585
1617
|
breakdowns: {
|
@@ -1598,7 +1630,9 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1598
1630
|
address: string;
|
1599
1631
|
icon: string;
|
1600
1632
|
decimals: number;
|
1633
|
+
displaySymbol: string;
|
1601
1634
|
verified: boolean;
|
1635
|
+
isTest: boolean;
|
1602
1636
|
price: number | null;
|
1603
1637
|
}[];
|
1604
1638
|
Protocols: {
|
@@ -31,6 +31,7 @@ export declare const TokenController: Elysia<"/tokens", false, {
|
|
31
31
|
icon: string;
|
32
32
|
decimals: number;
|
33
33
|
verified: boolean;
|
34
|
+
isTest: boolean;
|
34
35
|
price?: number | null | undefined;
|
35
36
|
} | undefined;
|
36
37
|
};
|
@@ -60,6 +61,7 @@ export declare const TokenController: Elysia<"/tokens", false, {
|
|
60
61
|
icon: string;
|
61
62
|
decimals: number;
|
62
63
|
verified: boolean;
|
64
|
+
isTest: boolean;
|
63
65
|
} & {
|
64
66
|
price?: number | null | undefined;
|
65
67
|
} & {
|
@@ -81,10 +83,11 @@ export declare const TokenController: Elysia<"/tokens", false, {
|
|
81
83
|
chainId?: any;
|
82
84
|
address?: string | undefined;
|
83
85
|
verified?: boolean | undefined;
|
86
|
+
test?: boolean | undefined;
|
84
87
|
};
|
85
88
|
headers: unknown;
|
86
89
|
response: {
|
87
|
-
200:
|
90
|
+
200: {
|
88
91
|
symbol: string;
|
89
92
|
name: string | null;
|
90
93
|
id: string;
|
@@ -92,10 +95,11 @@ export declare const TokenController: Elysia<"/tokens", false, {
|
|
92
95
|
address: string;
|
93
96
|
icon: string;
|
94
97
|
decimals: number;
|
98
|
+
displaySymbol: string;
|
95
99
|
verified: boolean;
|
96
|
-
|
97
|
-
price
|
98
|
-
}
|
100
|
+
isTest: boolean;
|
101
|
+
price: number | null;
|
102
|
+
}[];
|
99
103
|
};
|
100
104
|
};
|
101
105
|
};
|
@@ -112,6 +116,7 @@ export declare const TokenController: Elysia<"/tokens", false, {
|
|
112
116
|
chainId?: any;
|
113
117
|
address?: string | undefined;
|
114
118
|
verified?: boolean | undefined;
|
119
|
+
test?: boolean | undefined;
|
115
120
|
};
|
116
121
|
headers: unknown;
|
117
122
|
response: {
|
@@ -4,7 +4,7 @@ import type { Resource } from "../prisma";
|
|
4
4
|
* @description Data of an onchain asset
|
5
5
|
* @see {@link Resource}
|
6
6
|
*/
|
7
|
-
export type Token = Resource<"Token",
|
7
|
+
export type Token = Resource<"Token", "displaySymbol", {
|
8
8
|
price?: number | null;
|
9
9
|
}>;
|
10
10
|
export type TokenUnique = {
|
@@ -20,6 +20,7 @@ export declare const GetTokenQueryDto: import("@sinclair/typebox").TObject<{
|
|
20
20
|
address: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
21
21
|
name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
22
22
|
verified: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
23
|
+
test: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
23
24
|
}>;
|
24
25
|
export declare const TokenDto: import("@sinclair/typebox").TObject<{
|
25
26
|
address: import("@sinclair/typebox").TString;
|
@@ -29,7 +29,19 @@ export declare abstract class TokenRepository {
|
|
29
29
|
* Read token from database by its symbol
|
30
30
|
* @param symbol
|
31
31
|
*/
|
32
|
-
static findMany(query: GetTokenQueryModel): Promise<
|
32
|
+
static findMany(query: GetTokenQueryModel): Promise<{
|
33
|
+
symbol: string;
|
34
|
+
name: string | null;
|
35
|
+
id: string;
|
36
|
+
chainId: number;
|
37
|
+
address: string;
|
38
|
+
icon: string;
|
39
|
+
decimals: number;
|
40
|
+
displaySymbol: string;
|
41
|
+
verified: boolean;
|
42
|
+
isTest: boolean;
|
43
|
+
price: number | null;
|
44
|
+
}[]>;
|
33
45
|
static countMany(query: GetTokenQueryModel): Promise<number>;
|
34
46
|
/**
|
35
47
|
* upsert a token on database
|
@@ -35,10 +35,12 @@ export class TokenRepository {
|
|
35
35
|
return {
|
36
36
|
where: {
|
37
37
|
symbol: query.symbol ? { equals: query.symbol, mode: "insensitive" } : undefined,
|
38
|
+
displaySymbol: query.symbol ? { equals: query.symbol, mode: "insensitive" } : undefined,
|
38
39
|
address: query.address ? { equals: query.address, mode: "insensitive" } : undefined,
|
39
40
|
chainId: query.chainId ? { equals: query.chainId } : undefined,
|
40
41
|
name: query.name ? { contains: query.name, mode: "insensitive" } : undefined,
|
41
42
|
verified: query.verified ? { equals: query.verified } : undefined,
|
43
|
+
isTest: query.test ? { equals: query.test } : undefined,
|
42
44
|
},
|
43
45
|
};
|
44
46
|
}
|
@@ -2,8 +2,10 @@ import type { GetTokenQueryModel, Token, TokenModel, TokenUnique } from "./";
|
|
2
2
|
import type { Pricer } from "../../../utils/pricer";
|
3
3
|
import { Prisma } from "../../../../database/api/.generated";
|
4
4
|
import { type ChainId } from "@sdk";
|
5
|
+
import { TokenRepository } from "./token.repository";
|
5
6
|
export declare abstract class TokenService {
|
6
7
|
static hashId(token: TokenUnique): string;
|
8
|
+
static format(token: Awaited<ReturnType<typeof TokenRepository.findMany>>[number]): Token["model"];
|
7
9
|
/**
|
8
10
|
* Fetches balances of provided tokens
|
9
11
|
*/
|
@@ -22,6 +24,7 @@ export declare abstract class TokenService {
|
|
22
24
|
icon: string;
|
23
25
|
decimals: number;
|
24
26
|
verified: boolean;
|
27
|
+
isTest: boolean;
|
25
28
|
} & {
|
26
29
|
price?: number | null | undefined;
|
27
30
|
} & {
|
@@ -41,6 +44,7 @@ export declare abstract class TokenService {
|
|
41
44
|
icon: string;
|
42
45
|
decimals: number;
|
43
46
|
verified: boolean;
|
47
|
+
isTest: boolean;
|
44
48
|
} & {
|
45
49
|
price?: number | null | undefined;
|
46
50
|
} & {
|
@@ -57,6 +61,7 @@ export declare abstract class TokenService {
|
|
57
61
|
icon: string;
|
58
62
|
decimals: number;
|
59
63
|
verified: boolean;
|
64
|
+
isTest: boolean;
|
60
65
|
} & {
|
61
66
|
price?: number | null | undefined;
|
62
67
|
}, "id">;
|
@@ -101,6 +106,7 @@ export declare abstract class TokenService {
|
|
101
106
|
icon: string;
|
102
107
|
decimals: number;
|
103
108
|
verified: boolean;
|
109
|
+
isTest: boolean;
|
104
110
|
} & {
|
105
111
|
price?: number | null | undefined;
|
106
112
|
}) | undefined>;
|
@@ -118,6 +124,7 @@ export declare abstract class TokenService {
|
|
118
124
|
icon: string;
|
119
125
|
decimals: number;
|
120
126
|
verified: boolean;
|
127
|
+
isTest: boolean;
|
121
128
|
} & {
|
122
129
|
price?: number | null | undefined;
|
123
130
|
}>;
|
@@ -126,7 +133,7 @@ export declare abstract class TokenService {
|
|
126
133
|
* @param query
|
127
134
|
* @returns A list of tokens
|
128
135
|
*/
|
129
|
-
static findMany(query: GetTokenQueryModel): Promise<
|
136
|
+
static findMany(query: GetTokenQueryModel): Promise<{
|
130
137
|
symbol: string;
|
131
138
|
name: string | null;
|
132
139
|
id: string;
|
@@ -134,10 +141,11 @@ export declare abstract class TokenService {
|
|
134
141
|
address: string;
|
135
142
|
icon: string;
|
136
143
|
decimals: number;
|
144
|
+
displaySymbol: string;
|
137
145
|
verified: boolean;
|
138
|
-
|
139
|
-
price
|
140
|
-
}
|
146
|
+
isTest: boolean;
|
147
|
+
price: number | null;
|
148
|
+
}[]>;
|
141
149
|
/**
|
142
150
|
* Get value of tokens
|
143
151
|
* @param tokenAmounts address/chain + amount of token
|
@@ -11,6 +11,13 @@ export class TokenService {
|
|
11
11
|
static hashId(token) {
|
12
12
|
return Bun.hash(`${token.chainId}${token.address}`).toString();
|
13
13
|
}
|
14
|
+
static format(token) {
|
15
|
+
const { displaySymbol, symbol, ...rest } = token;
|
16
|
+
return {
|
17
|
+
...rest,
|
18
|
+
symbol: !displaySymbol || displaySymbol === "" ? symbol : displaySymbol,
|
19
|
+
};
|
20
|
+
}
|
14
21
|
/**
|
15
22
|
* Fetches balances of provided tokens
|
16
23
|
*/
|
@@ -40,7 +47,7 @@ export class TokenService {
|
|
40
47
|
* @param additionalTokens balances along with the verified ones
|
41
48
|
*/
|
42
49
|
static async fetchVerifiedBalances(chainId, userAddress, additionalTokenAddresses) {
|
43
|
-
const verifiedTokens = await TokenService.findMany({ chainId: chainId, verified: true });
|
50
|
+
const verifiedTokens = (await TokenService.findMany({ chainId: chainId, verified: true })).map(t => TokenService.format(t));
|
44
51
|
const additionalTokens = !!additionalTokenAddresses?.length
|
45
52
|
? await TokenService.getManyOrCreate(additionalTokenAddresses?.map(address => ({ chainId, address })))
|
46
53
|
: [];
|
@@ -54,7 +61,7 @@ export class TokenService {
|
|
54
61
|
chainId: token.chainId,
|
55
62
|
address: token.address,
|
56
63
|
icon: "",
|
57
|
-
...Object.assign({ name: "unknown", decimals: 18, symbol: "UNKNOWN", verified: false }, onchainData),
|
64
|
+
...Object.assign({ name: "unknown", decimals: 18, symbol: "UNKNOWN", verified: false, isTest: false }, onchainData),
|
58
65
|
};
|
59
66
|
}
|
60
67
|
static async fetchManyOnChain(chainId, addresses) {
|
@@ -124,6 +131,7 @@ export class TokenService {
|
|
124
131
|
verified: true,
|
125
132
|
decimals: token.decimals,
|
126
133
|
icon: token.logoURI,
|
134
|
+
isTest: false,
|
127
135
|
});
|
128
136
|
log.local(`Token created: ${res?.symbol} on ${NETWORK_LABELS[Number.parseInt(chain)]}`);
|
129
137
|
}
|
@@ -140,6 +148,7 @@ export class TokenService {
|
|
140
148
|
verified: true,
|
141
149
|
decimals: token.decimals,
|
142
150
|
icon: token.logoURI,
|
151
|
+
isTest: false,
|
143
152
|
});
|
144
153
|
log.local(`Token created: ${res?.symbol} on ${NETWORK_LABELS[Number.parseInt(chain)]}`);
|
145
154
|
}
|
@@ -98,7 +98,9 @@ export declare const UserController: Elysia<"/users", false, {
|
|
98
98
|
address: string;
|
99
99
|
icon: string;
|
100
100
|
decimals: number;
|
101
|
+
displaySymbol: string;
|
101
102
|
verified: boolean;
|
103
|
+
isTest: boolean;
|
102
104
|
price: number | null;
|
103
105
|
};
|
104
106
|
breakdowns: {
|
@@ -117,7 +119,9 @@ export declare const UserController: Elysia<"/users", false, {
|
|
117
119
|
address: string;
|
118
120
|
icon: string;
|
119
121
|
decimals: number;
|
122
|
+
displaySymbol: string;
|
120
123
|
verified: boolean;
|
124
|
+
isTest: boolean;
|
121
125
|
price: number | null;
|
122
126
|
}[];
|
123
127
|
Protocols: {
|
@@ -208,7 +212,9 @@ export declare const UserController: Elysia<"/users", false, {
|
|
208
212
|
address: string;
|
209
213
|
icon: string;
|
210
214
|
decimals: number;
|
215
|
+
displaySymbol: string;
|
211
216
|
verified: boolean;
|
217
|
+
isTest: boolean;
|
212
218
|
price: number | null;
|
213
219
|
};
|
214
220
|
breakdowns: {
|
@@ -227,7 +233,9 @@ export declare const UserController: Elysia<"/users", false, {
|
|
227
233
|
address: string;
|
228
234
|
icon: string;
|
229
235
|
decimals: number;
|
236
|
+
displaySymbol: string;
|
230
237
|
verified: boolean;
|
238
|
+
isTest: boolean;
|
231
239
|
price: number | null;
|
232
240
|
}[];
|
233
241
|
Protocols: {
|