@merkl/api 0.10.170 → 0.10.172
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/src/eden/index.d.ts +72 -75
- package/dist/src/index.d.ts +24 -25
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/factoryFinder.js +1 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/PendleYTProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/PendleYTProcessor.js +1 -3
- 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/subtypesRound1RefactoFinal.js +1 -1
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +4 -4
- package/dist/src/modules/v4/campaign/campaign.repository.js +1 -0
- package/dist/src/modules/v4/campaign/campaign.service.d.ts +4 -4
- package/dist/src/modules/v4/campaign/campaign.service.js +2 -1
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +15 -15
- package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +106 -3
- package/dist/src/modules/v4/opportunity/opportunity.repository.js +11 -2
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +29 -29
- package/dist/src/modules/v4/opportunity/opportunity.service.js +2 -1
- package/dist/src/modules/v4/router.d.ts +24 -25
- package/dist/src/modules/v4/token/token.controller.d.ts +5 -6
- 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 +5 -9
- package/dist/src/modules/v4/token/token.service.js +11 -2
- package/dist/src/routes/v3/blacklist.d.ts +24 -25
- package/dist/src/routes/v3/campaigns.d.ts +24 -25
- package/dist/src/routes/v3/campaignsInfo.d.ts +24 -25
- package/dist/src/routes/v3/multiChainPositions.d.ts +24 -25
- package/dist/src/routes/v3/opportunity.d.ts +24 -25
- package/dist/src/routes/v3/positions.d.ts +24 -25
- package/dist/src/routes/v3/rewards.d.ts +24 -25
- package/dist/src/routes/v3/updates.d.ts +24 -25
- package/dist/src/routes/v3/userRewards.d.ts +24 -25
- package/dist/src/utils/generateCardName.js +1 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -69,7 +69,7 @@ export declare abstract class OpportunityService {
|
|
69
69
|
}[];
|
70
70
|
};
|
71
71
|
id: string;
|
72
|
-
tokens: {
|
72
|
+
tokens: ({
|
73
73
|
symbol: string;
|
74
74
|
name: string | null;
|
75
75
|
id: string;
|
@@ -77,11 +77,11 @@ export declare abstract class OpportunityService {
|
|
77
77
|
address: string;
|
78
78
|
icon: string;
|
79
79
|
decimals: number;
|
80
|
-
displaySymbol: string;
|
81
80
|
verified: boolean;
|
82
81
|
isTest: boolean;
|
83
|
-
|
84
|
-
|
82
|
+
} & {
|
83
|
+
price?: number | null | undefined;
|
84
|
+
})[];
|
85
85
|
chain: {
|
86
86
|
name: string;
|
87
87
|
id: number;
|
@@ -121,10 +121,10 @@ export declare abstract class OpportunityService {
|
|
121
121
|
address: string;
|
122
122
|
icon: string;
|
123
123
|
decimals: number;
|
124
|
-
displaySymbol: string;
|
125
124
|
verified: boolean;
|
126
125
|
isTest: boolean;
|
127
|
-
|
126
|
+
} & {
|
127
|
+
price?: number | null | undefined;
|
128
128
|
};
|
129
129
|
distributionChain: {
|
130
130
|
name: string;
|
@@ -203,7 +203,7 @@ export declare abstract class OpportunityService {
|
|
203
203
|
}[];
|
204
204
|
};
|
205
205
|
id: string;
|
206
|
-
tokens: {
|
206
|
+
tokens: ({
|
207
207
|
symbol: string;
|
208
208
|
name: string | null;
|
209
209
|
id: string;
|
@@ -211,11 +211,11 @@ export declare abstract class OpportunityService {
|
|
211
211
|
address: string;
|
212
212
|
icon: string;
|
213
213
|
decimals: number;
|
214
|
-
displaySymbol: string;
|
215
214
|
verified: boolean;
|
216
215
|
isTest: boolean;
|
217
|
-
|
218
|
-
|
216
|
+
} & {
|
217
|
+
price?: number | null | undefined;
|
218
|
+
})[];
|
219
219
|
chain: {
|
220
220
|
name: string;
|
221
221
|
id: number;
|
@@ -295,7 +295,7 @@ export declare abstract class OpportunityService {
|
|
295
295
|
}[];
|
296
296
|
};
|
297
297
|
id: string;
|
298
|
-
tokens: {
|
298
|
+
tokens: ({
|
299
299
|
symbol: string;
|
300
300
|
name: string | null;
|
301
301
|
id: string;
|
@@ -303,11 +303,11 @@ export declare abstract class OpportunityService {
|
|
303
303
|
address: string;
|
304
304
|
icon: string;
|
305
305
|
decimals: number;
|
306
|
-
displaySymbol: string;
|
307
306
|
verified: boolean;
|
308
307
|
isTest: boolean;
|
309
|
-
|
310
|
-
|
308
|
+
} & {
|
309
|
+
price?: number | null | undefined;
|
310
|
+
})[];
|
311
311
|
chain: {
|
312
312
|
name: string;
|
313
313
|
id: number;
|
@@ -382,7 +382,7 @@ export declare abstract class OpportunityService {
|
|
382
382
|
}[];
|
383
383
|
};
|
384
384
|
id: string;
|
385
|
-
tokens: {
|
385
|
+
tokens: ({
|
386
386
|
symbol: string;
|
387
387
|
name: string | null;
|
388
388
|
id: string;
|
@@ -390,11 +390,11 @@ export declare abstract class OpportunityService {
|
|
390
390
|
address: string;
|
391
391
|
icon: string;
|
392
392
|
decimals: number;
|
393
|
-
displaySymbol: string;
|
394
393
|
verified: boolean;
|
395
394
|
isTest: boolean;
|
396
|
-
|
397
|
-
|
395
|
+
} & {
|
396
|
+
price?: number | null | undefined;
|
397
|
+
})[];
|
398
398
|
chain: {
|
399
399
|
name: string;
|
400
400
|
id: number;
|
@@ -434,10 +434,10 @@ export declare abstract class OpportunityService {
|
|
434
434
|
address: string;
|
435
435
|
icon: string;
|
436
436
|
decimals: number;
|
437
|
-
displaySymbol: string;
|
438
437
|
verified: boolean;
|
439
438
|
isTest: boolean;
|
440
|
-
|
439
|
+
} & {
|
440
|
+
price?: number | null | undefined;
|
441
441
|
};
|
442
442
|
distributionChain: {
|
443
443
|
name: string;
|
@@ -526,7 +526,7 @@ export declare abstract class OpportunityService {
|
|
526
526
|
}[];
|
527
527
|
};
|
528
528
|
id: string;
|
529
|
-
tokens: {
|
529
|
+
tokens: ({
|
530
530
|
symbol: string;
|
531
531
|
name: string | null;
|
532
532
|
id: string;
|
@@ -534,11 +534,11 @@ export declare abstract class OpportunityService {
|
|
534
534
|
address: string;
|
535
535
|
icon: string;
|
536
536
|
decimals: number;
|
537
|
-
displaySymbol: string;
|
538
537
|
verified: boolean;
|
539
538
|
isTest: boolean;
|
540
|
-
|
541
|
-
|
539
|
+
} & {
|
540
|
+
price?: number | null | undefined;
|
541
|
+
})[];
|
542
542
|
chain: {
|
543
543
|
name: string;
|
544
544
|
id: number;
|
@@ -565,7 +565,7 @@ export declare abstract class OpportunityService {
|
|
565
565
|
} | null;
|
566
566
|
static formatResponseBase(opportunity: LightOpportunityFromDB): {
|
567
567
|
id: string;
|
568
|
-
tokens: {
|
568
|
+
tokens: ({
|
569
569
|
symbol: string;
|
570
570
|
name: string | null;
|
571
571
|
id: string;
|
@@ -573,11 +573,11 @@ export declare abstract class OpportunityService {
|
|
573
573
|
address: string;
|
574
574
|
icon: string;
|
575
575
|
decimals: number;
|
576
|
-
displaySymbol: string;
|
577
576
|
verified: boolean;
|
578
577
|
isTest: boolean;
|
579
|
-
|
580
|
-
|
578
|
+
} & {
|
579
|
+
price?: number | null | undefined;
|
580
|
+
})[];
|
581
581
|
chain: {
|
582
582
|
name: string;
|
583
583
|
id: number;
|
@@ -603,6 +603,6 @@ export declare abstract class OpportunityService {
|
|
603
603
|
dailyRewards: number;
|
604
604
|
};
|
605
605
|
static aggregate(query: GetOpportunitiesQueryModel, field: keyof Prisma.OpportunitySumAggregateInputType): Promise<{
|
606
|
-
sum:
|
606
|
+
sum: never;
|
607
607
|
}>;
|
608
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
|
};
|
@@ -110,7 +110,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
110
110
|
}[];
|
111
111
|
};
|
112
112
|
id: string;
|
113
|
-
tokens: {
|
113
|
+
tokens: ({
|
114
114
|
symbol: string;
|
115
115
|
name: string | null;
|
116
116
|
id: string;
|
@@ -118,11 +118,11 @@ export declare const v4: Elysia<"/v4", false, {
|
|
118
118
|
address: string;
|
119
119
|
icon: string;
|
120
120
|
decimals: number;
|
121
|
-
displaySymbol: string;
|
122
121
|
verified: boolean;
|
123
122
|
isTest: boolean;
|
124
|
-
|
125
|
-
|
123
|
+
} & {
|
124
|
+
price?: number | null | undefined;
|
125
|
+
})[];
|
126
126
|
chain: {
|
127
127
|
name: string;
|
128
128
|
id: number;
|
@@ -213,7 +213,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
213
213
|
}[];
|
214
214
|
};
|
215
215
|
id: string;
|
216
|
-
tokens: {
|
216
|
+
tokens: ({
|
217
217
|
symbol: string;
|
218
218
|
name: string | null;
|
219
219
|
id: string;
|
@@ -221,11 +221,11 @@ export declare const v4: Elysia<"/v4", false, {
|
|
221
221
|
address: string;
|
222
222
|
icon: string;
|
223
223
|
decimals: number;
|
224
|
-
displaySymbol: string;
|
225
224
|
verified: boolean;
|
226
225
|
isTest: boolean;
|
227
|
-
|
228
|
-
|
226
|
+
} & {
|
227
|
+
price?: number | null | undefined;
|
228
|
+
})[];
|
229
229
|
chain: {
|
230
230
|
name: string;
|
231
231
|
id: number;
|
@@ -264,10 +264,10 @@ export declare const v4: Elysia<"/v4", false, {
|
|
264
264
|
address: string;
|
265
265
|
icon: string;
|
266
266
|
decimals: number;
|
267
|
-
displaySymbol: string;
|
268
267
|
verified: boolean;
|
269
268
|
isTest: boolean;
|
270
|
-
|
269
|
+
} & {
|
270
|
+
price?: number | null | undefined;
|
271
271
|
};
|
272
272
|
distributionChain: {
|
273
273
|
name: string;
|
@@ -374,7 +374,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
374
374
|
}[];
|
375
375
|
};
|
376
376
|
id: string;
|
377
|
-
tokens: {
|
377
|
+
tokens: ({
|
378
378
|
symbol: string;
|
379
379
|
name: string | null;
|
380
380
|
id: string;
|
@@ -382,11 +382,11 @@ export declare const v4: Elysia<"/v4", false, {
|
|
382
382
|
address: string;
|
383
383
|
icon: string;
|
384
384
|
decimals: number;
|
385
|
-
displaySymbol: string;
|
386
385
|
verified: boolean;
|
387
386
|
isTest: boolean;
|
388
|
-
|
389
|
-
|
387
|
+
} & {
|
388
|
+
price?: number | null | undefined;
|
389
|
+
})[];
|
390
390
|
chain: {
|
391
391
|
name: string;
|
392
392
|
id: number;
|
@@ -470,7 +470,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
470
470
|
headers: unknown;
|
471
471
|
response: {
|
472
472
|
200: {
|
473
|
-
sum:
|
473
|
+
sum: File;
|
474
474
|
};
|
475
475
|
};
|
476
476
|
};
|
@@ -539,8 +539,8 @@ export declare const v4: Elysia<"/v4", false, {
|
|
539
539
|
mainParameter?: string | undefined;
|
540
540
|
campaignId?: string | undefined;
|
541
541
|
opportunityId?: string | undefined;
|
542
|
-
tokenSymbol?: string | undefined;
|
543
542
|
test?: boolean | undefined;
|
543
|
+
tokenSymbol?: string | undefined;
|
544
544
|
};
|
545
545
|
headers: unknown;
|
546
546
|
response: {
|
@@ -559,10 +559,10 @@ export declare const v4: Elysia<"/v4", false, {
|
|
559
559
|
address: string;
|
560
560
|
icon: string;
|
561
561
|
decimals: number;
|
562
|
-
displaySymbol: string;
|
563
562
|
verified: boolean;
|
564
563
|
isTest: boolean;
|
565
|
-
|
564
|
+
} & {
|
565
|
+
price?: number | null | undefined;
|
566
566
|
};
|
567
567
|
distributionChain: {
|
568
568
|
name: string;
|
@@ -610,8 +610,8 @@ export declare const v4: Elysia<"/v4", false, {
|
|
610
610
|
mainParameter?: string | undefined;
|
611
611
|
campaignId?: string | undefined;
|
612
612
|
opportunityId?: string | undefined;
|
613
|
-
tokenSymbol?: string | undefined;
|
614
613
|
test?: boolean | undefined;
|
614
|
+
tokenSymbol?: string | undefined;
|
615
615
|
};
|
616
616
|
headers: unknown;
|
617
617
|
response: {
|
@@ -765,7 +765,6 @@ export declare const v4: Elysia<"/v4", false, {
|
|
765
765
|
address: string;
|
766
766
|
icon: string;
|
767
767
|
decimals: number;
|
768
|
-
displaySymbol: string;
|
769
768
|
verified: boolean;
|
770
769
|
isTest: boolean;
|
771
770
|
price?: number | null | undefined;
|
@@ -796,7 +795,6 @@ export declare const v4: Elysia<"/v4", false, {
|
|
796
795
|
address: string;
|
797
796
|
icon: string;
|
798
797
|
decimals: number;
|
799
|
-
displaySymbol: string;
|
800
798
|
verified: boolean;
|
801
799
|
isTest: boolean;
|
802
800
|
} & {
|
@@ -820,10 +818,11 @@ export declare const v4: Elysia<"/v4", false, {
|
|
820
818
|
chainId?: any;
|
821
819
|
address?: string | undefined;
|
822
820
|
verified?: boolean | undefined;
|
821
|
+
test?: boolean | undefined;
|
823
822
|
};
|
824
823
|
headers: unknown;
|
825
824
|
response: {
|
826
|
-
200:
|
825
|
+
200: {
|
827
826
|
symbol: string;
|
828
827
|
name: string | null;
|
829
828
|
id: string;
|
@@ -834,9 +833,8 @@ export declare const v4: Elysia<"/v4", false, {
|
|
834
833
|
displaySymbol: string;
|
835
834
|
verified: boolean;
|
836
835
|
isTest: boolean;
|
837
|
-
|
838
|
-
|
839
|
-
})[];
|
836
|
+
price: number | null;
|
837
|
+
}[];
|
840
838
|
};
|
841
839
|
};
|
842
840
|
};
|
@@ -853,6 +851,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
853
851
|
chainId?: any;
|
854
852
|
address?: string | undefined;
|
855
853
|
verified?: boolean | undefined;
|
854
|
+
test?: boolean | undefined;
|
856
855
|
};
|
857
856
|
headers: unknown;
|
858
857
|
response: {
|
@@ -30,7 +30,6 @@ export declare const TokenController: Elysia<"/tokens", false, {
|
|
30
30
|
address: string;
|
31
31
|
icon: string;
|
32
32
|
decimals: number;
|
33
|
-
displaySymbol: string;
|
34
33
|
verified: boolean;
|
35
34
|
isTest: boolean;
|
36
35
|
price?: number | null | undefined;
|
@@ -61,7 +60,6 @@ export declare const TokenController: Elysia<"/tokens", false, {
|
|
61
60
|
address: string;
|
62
61
|
icon: string;
|
63
62
|
decimals: number;
|
64
|
-
displaySymbol: string;
|
65
63
|
verified: boolean;
|
66
64
|
isTest: boolean;
|
67
65
|
} & {
|
@@ -85,10 +83,11 @@ export declare const TokenController: Elysia<"/tokens", false, {
|
|
85
83
|
chainId?: any;
|
86
84
|
address?: string | undefined;
|
87
85
|
verified?: boolean | undefined;
|
86
|
+
test?: boolean | undefined;
|
88
87
|
};
|
89
88
|
headers: unknown;
|
90
89
|
response: {
|
91
|
-
200:
|
90
|
+
200: {
|
92
91
|
symbol: string;
|
93
92
|
name: string | null;
|
94
93
|
id: string;
|
@@ -99,9 +98,8 @@ export declare const TokenController: Elysia<"/tokens", false, {
|
|
99
98
|
displaySymbol: string;
|
100
99
|
verified: boolean;
|
101
100
|
isTest: boolean;
|
102
|
-
|
103
|
-
|
104
|
-
})[];
|
101
|
+
price: number | null;
|
102
|
+
}[];
|
105
103
|
};
|
106
104
|
};
|
107
105
|
};
|
@@ -118,6 +116,7 @@ export declare const TokenController: Elysia<"/tokens", false, {
|
|
118
116
|
chainId?: any;
|
119
117
|
address?: string | undefined;
|
120
118
|
verified?: boolean | undefined;
|
119
|
+
test?: boolean | undefined;
|
121
120
|
};
|
122
121
|
headers: unknown;
|
123
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
|
*/
|
@@ -21,7 +23,6 @@ export declare abstract class TokenService {
|
|
21
23
|
address: string;
|
22
24
|
icon: string;
|
23
25
|
decimals: number;
|
24
|
-
displaySymbol: string;
|
25
26
|
verified: boolean;
|
26
27
|
isTest: boolean;
|
27
28
|
} & {
|
@@ -42,7 +43,6 @@ export declare abstract class TokenService {
|
|
42
43
|
address: string;
|
43
44
|
icon: string;
|
44
45
|
decimals: number;
|
45
|
-
displaySymbol: string;
|
46
46
|
verified: boolean;
|
47
47
|
isTest: boolean;
|
48
48
|
} & {
|
@@ -60,7 +60,6 @@ export declare abstract class TokenService {
|
|
60
60
|
address: string;
|
61
61
|
icon: string;
|
62
62
|
decimals: number;
|
63
|
-
displaySymbol: string;
|
64
63
|
verified: boolean;
|
65
64
|
isTest: boolean;
|
66
65
|
} & {
|
@@ -106,7 +105,6 @@ export declare abstract class TokenService {
|
|
106
105
|
address: string;
|
107
106
|
icon: string;
|
108
107
|
decimals: number;
|
109
|
-
displaySymbol: string;
|
110
108
|
verified: boolean;
|
111
109
|
isTest: boolean;
|
112
110
|
} & {
|
@@ -125,7 +123,6 @@ export declare abstract class TokenService {
|
|
125
123
|
address: string;
|
126
124
|
icon: string;
|
127
125
|
decimals: number;
|
128
|
-
displaySymbol: string;
|
129
126
|
verified: boolean;
|
130
127
|
isTest: boolean;
|
131
128
|
} & {
|
@@ -136,7 +133,7 @@ export declare abstract class TokenService {
|
|
136
133
|
* @param query
|
137
134
|
* @returns A list of tokens
|
138
135
|
*/
|
139
|
-
static findMany(query: GetTokenQueryModel): Promise<
|
136
|
+
static findMany(query: GetTokenQueryModel): Promise<{
|
140
137
|
symbol: string;
|
141
138
|
name: string | null;
|
142
139
|
id: string;
|
@@ -147,9 +144,8 @@ export declare abstract class TokenService {
|
|
147
144
|
displaySymbol: string;
|
148
145
|
verified: boolean;
|
149
146
|
isTest: boolean;
|
150
|
-
|
151
|
-
|
152
|
-
})[]>;
|
147
|
+
price: number | null;
|
148
|
+
}[]>;
|
153
149
|
/**
|
154
150
|
* Get value of tokens
|
155
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
|
}
|