@merkl/api 0.10.231 → 0.10.233
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 -12
- package/dist/database/api/.generated/index-browser.js +3 -8
- package/dist/database/api/.generated/index.d.ts +156 -124
- package/dist/database/api/.generated/index.js +6 -12
- package/dist/database/api/.generated/package.json +1 -1
- package/dist/database/api/.generated/schema.prisma +3 -10
- package/dist/database/api/.generated/wasm.js +3 -8
- package/dist/database/engine/.generated/edge.js +2 -3
- package/dist/database/engine/.generated/index.js +2 -3
- package/dist/database/engine/.generated/package.json +1 -1
- package/dist/database/engine/.generated/schema.prisma +1 -1
- package/dist/src/eden/index.d.ts +142 -155
- package/dist/src/index.d.ts +52 -55
- package/dist/src/modules/v4/campaign/campaign.repository.js +3 -1
- package/dist/src/modules/v4/enso/enso.service.d.ts +1 -1
- package/dist/src/modules/v4/interaction/interaction.controller.d.ts +2 -42
- package/dist/src/modules/v4/interaction/interaction.controller.js +2 -20
- package/dist/src/modules/v4/interaction/interaction.model.d.ts +1 -0
- package/dist/src/modules/v4/interaction/interaction.model.js +1 -0
- package/dist/src/modules/v4/interaction/interaction.service.d.ts +1 -1
- package/dist/src/modules/v4/interaction/interaction.service.js +2 -2
- package/dist/src/modules/v4/kyberzap/kyberzap.model.d.ts +1 -0
- package/dist/src/modules/v4/kyberzap/kyberzap.model.js +1 -0
- package/dist/src/modules/v4/kyberzap/kyberzap.service.d.ts +1 -1
- package/dist/src/modules/v4/kyberzap/kyberzap.service.js +6 -2
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +5 -3
- package/dist/src/modules/v4/opportunity/opportunity.controller.js +1 -2
- package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +2 -14
- package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +18 -8
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +9 -4
- package/dist/src/modules/v4/programPayload/programPayload.repository.d.ts +3 -0
- package/dist/src/modules/v4/programPayload/programPayload.repository.js +95 -25
- package/dist/src/modules/v4/protocol/protocol.controller.d.ts +6 -6
- package/dist/src/modules/v4/protocol/protocol.model.d.ts +3 -15
- package/dist/src/modules/v4/protocol/protocol.model.js +3 -4
- package/dist/src/modules/v4/protocol/protocol.repository.d.ts +5 -5
- package/dist/src/modules/v4/protocol/protocol.repository.js +11 -6
- package/dist/src/modules/v4/protocol/protocol.service.d.ts +2 -2
- package/dist/src/modules/v4/reward/reward.repository.d.ts +3 -2
- package/dist/src/modules/v4/reward/reward.service.d.ts +18 -12
- package/dist/src/modules/v4/router.d.ts +52 -55
- package/dist/src/modules/v4/token/token.controller.d.ts +33 -0
- package/dist/src/modules/v4/token/token.controller.js +14 -1
- package/dist/src/modules/v4/token/token.model.d.ts +8 -0
- package/dist/src/modules/v4/token/token.model.js +7 -0
- package/dist/src/modules/v4/token/token.service.d.ts +19 -1
- package/dist/src/modules/v4/token/token.service.js +10 -0
- package/dist/src/modules/v4/user/user.controller.d.ts +6 -4
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/src/modules/v4/zyfi/zyfi.model.d.ts +0 -45
- package/dist/src/modules/v4/zyfi/zyfi.model.js +0 -1
- package/dist/src/modules/v4/zyfi/zyfi.service.d.ts +0 -30
- package/dist/src/modules/v4/zyfi/zyfi.service.js +0 -35
@@ -6,7 +6,7 @@ export declare abstract class ProtocolRepository {
|
|
6
6
|
url: string;
|
7
7
|
description: string;
|
8
8
|
id: string;
|
9
|
-
tags:
|
9
|
+
tags: string[];
|
10
10
|
icon: string;
|
11
11
|
}>;
|
12
12
|
static read(type: string): Promise<{
|
@@ -14,7 +14,7 @@ export declare abstract class ProtocolRepository {
|
|
14
14
|
url: string;
|
15
15
|
description: string;
|
16
16
|
id: string;
|
17
|
-
tags:
|
17
|
+
tags: string[];
|
18
18
|
icon: string;
|
19
19
|
} | null>;
|
20
20
|
static findManyByName(name: string): Promise<{
|
@@ -22,7 +22,7 @@ export declare abstract class ProtocolRepository {
|
|
22
22
|
url: string;
|
23
23
|
description: string;
|
24
24
|
id: string;
|
25
|
-
tags:
|
25
|
+
tags: string[];
|
26
26
|
icon: string;
|
27
27
|
}[]>;
|
28
28
|
static findMany(query: GetProtocolsQueryModel): Promise<{
|
@@ -30,7 +30,7 @@ export declare abstract class ProtocolRepository {
|
|
30
30
|
url: string;
|
31
31
|
description: string;
|
32
32
|
id: string;
|
33
|
-
tags:
|
33
|
+
tags: string[];
|
34
34
|
icon: string;
|
35
35
|
}[]>;
|
36
36
|
static countMany(query: GetProtocolsQueryModel): Promise<number>;
|
@@ -39,7 +39,7 @@ export declare abstract class ProtocolRepository {
|
|
39
39
|
url: string;
|
40
40
|
description: string;
|
41
41
|
id: string;
|
42
|
-
tags:
|
42
|
+
tags: string[];
|
43
43
|
icon: string;
|
44
44
|
}>;
|
45
45
|
}
|
@@ -24,14 +24,19 @@ export class ProtocolRepository {
|
|
24
24
|
where: {
|
25
25
|
id: query.id ? { contains: query.id, mode: "insensitive" } : undefined,
|
26
26
|
tags: query.tags ? { hasEvery: query.tags } : undefined,
|
27
|
-
|
28
|
-
?
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
OR: query.opportunityTag // The opportunity tag specified can be either at the protocol level or the opportunity level
|
28
|
+
? [
|
29
|
+
{
|
30
|
+
MainOpportunities: {
|
31
|
+
some: {
|
32
|
+
tags: {
|
33
|
+
has: query.opportunityTag,
|
34
|
+
},
|
35
|
+
},
|
32
36
|
},
|
33
37
|
},
|
34
|
-
|
38
|
+
{ tags: { has: query.opportunityTag } },
|
39
|
+
]
|
35
40
|
: undefined,
|
36
41
|
// id: typeof query.id === "string" ? query.id : !!query.id ? { in: query.id } : undefined,
|
37
42
|
},
|
@@ -11,7 +11,7 @@ export declare abstract class ProtocolService {
|
|
11
11
|
url: string;
|
12
12
|
description: string;
|
13
13
|
id: string;
|
14
|
-
tags:
|
14
|
+
tags: string[];
|
15
15
|
icon: string;
|
16
16
|
}>;
|
17
17
|
static update(id: string, data: UpdateProtocolModel): Promise<{
|
@@ -19,7 +19,7 @@ export declare abstract class ProtocolService {
|
|
19
19
|
url: string;
|
20
20
|
description: string;
|
21
21
|
id: string;
|
22
|
-
tags:
|
22
|
+
tags: string[];
|
23
23
|
icon: string;
|
24
24
|
}>;
|
25
25
|
static changeLogoUrls(): Promise<void>;
|
@@ -45,7 +45,7 @@ export declare abstract class RewardRepository {
|
|
45
45
|
url: string;
|
46
46
|
description: string;
|
47
47
|
id: string;
|
48
|
-
tags:
|
48
|
+
tags: string[];
|
49
49
|
icon: string;
|
50
50
|
}[];
|
51
51
|
MainProtocol: {
|
@@ -53,7 +53,7 @@ export declare abstract class RewardRepository {
|
|
53
53
|
url: string;
|
54
54
|
description: string;
|
55
55
|
id: string;
|
56
|
-
tags:
|
56
|
+
tags: string[];
|
57
57
|
icon: string;
|
58
58
|
} | null;
|
59
59
|
} & {
|
@@ -65,6 +65,7 @@ export declare abstract class RewardRepository {
|
|
65
65
|
identifier: string;
|
66
66
|
chainId: number;
|
67
67
|
action: import("../../../../database/api/.generated").$Enums.OpportunityAction;
|
68
|
+
depositUrl: string | null;
|
68
69
|
mainProtocolId: string | null;
|
69
70
|
tvl: number;
|
70
71
|
apr: number;
|
@@ -39,7 +39,7 @@ export declare abstract class RewardService {
|
|
39
39
|
url: string;
|
40
40
|
description: string;
|
41
41
|
id: string;
|
42
|
-
tags:
|
42
|
+
tags: string[];
|
43
43
|
icon: string;
|
44
44
|
}[];
|
45
45
|
MainProtocol: {
|
@@ -47,7 +47,7 @@ export declare abstract class RewardService {
|
|
47
47
|
url: string;
|
48
48
|
description: string;
|
49
49
|
id: string;
|
50
|
-
tags:
|
50
|
+
tags: string[];
|
51
51
|
icon: string;
|
52
52
|
} | null;
|
53
53
|
} & {
|
@@ -59,6 +59,7 @@ export declare abstract class RewardService {
|
|
59
59
|
identifier: string;
|
60
60
|
chainId: number;
|
61
61
|
action: import("../../../../database/api/.generated").$Enums.OpportunityAction;
|
62
|
+
depositUrl: string | null;
|
62
63
|
mainProtocolId: string | null;
|
63
64
|
tvl: number;
|
64
65
|
apr: number;
|
@@ -116,7 +117,7 @@ export declare abstract class RewardService {
|
|
116
117
|
url: string;
|
117
118
|
description: string;
|
118
119
|
id: string;
|
119
|
-
tags:
|
120
|
+
tags: string[];
|
120
121
|
icon: string;
|
121
122
|
}[];
|
122
123
|
MainProtocol: {
|
@@ -124,7 +125,7 @@ export declare abstract class RewardService {
|
|
124
125
|
url: string;
|
125
126
|
description: string;
|
126
127
|
id: string;
|
127
|
-
tags:
|
128
|
+
tags: string[];
|
128
129
|
icon: string;
|
129
130
|
} | null;
|
130
131
|
} & {
|
@@ -136,6 +137,7 @@ export declare abstract class RewardService {
|
|
136
137
|
identifier: string;
|
137
138
|
chainId: number;
|
138
139
|
action: import("../../../../database/api/.generated").$Enums.OpportunityAction;
|
140
|
+
depositUrl: string | null;
|
139
141
|
mainProtocolId: string | null;
|
140
142
|
tvl: number;
|
141
143
|
apr: number;
|
@@ -197,7 +199,7 @@ export declare abstract class RewardService {
|
|
197
199
|
url: string;
|
198
200
|
description: string;
|
199
201
|
id: string;
|
200
|
-
tags:
|
202
|
+
tags: string[];
|
201
203
|
icon: string;
|
202
204
|
}[];
|
203
205
|
MainProtocol: {
|
@@ -205,7 +207,7 @@ export declare abstract class RewardService {
|
|
205
207
|
url: string;
|
206
208
|
description: string;
|
207
209
|
id: string;
|
208
|
-
tags:
|
210
|
+
tags: string[];
|
209
211
|
icon: string;
|
210
212
|
} | null;
|
211
213
|
} & {
|
@@ -217,6 +219,7 @@ export declare abstract class RewardService {
|
|
217
219
|
identifier: string;
|
218
220
|
chainId: number;
|
219
221
|
action: import("../../../../database/api/.generated").$Enums.OpportunityAction;
|
222
|
+
depositUrl: string | null;
|
220
223
|
mainProtocolId: string | null;
|
221
224
|
tvl: number;
|
222
225
|
apr: number;
|
@@ -306,7 +309,7 @@ export declare abstract class RewardService {
|
|
306
309
|
url: string;
|
307
310
|
description: string;
|
308
311
|
id: string;
|
309
|
-
tags:
|
312
|
+
tags: string[];
|
310
313
|
icon: string;
|
311
314
|
}[];
|
312
315
|
MainProtocol: {
|
@@ -314,7 +317,7 @@ export declare abstract class RewardService {
|
|
314
317
|
url: string;
|
315
318
|
description: string;
|
316
319
|
id: string;
|
317
|
-
tags:
|
320
|
+
tags: string[];
|
318
321
|
icon: string;
|
319
322
|
} | null;
|
320
323
|
} & {
|
@@ -326,6 +329,7 @@ export declare abstract class RewardService {
|
|
326
329
|
identifier: string;
|
327
330
|
chainId: number;
|
328
331
|
action: import("../../../../database/api/.generated").$Enums.OpportunityAction;
|
332
|
+
depositUrl: string | null;
|
329
333
|
mainProtocolId: string | null;
|
330
334
|
tvl: number;
|
331
335
|
apr: number;
|
@@ -400,7 +404,7 @@ export declare abstract class RewardService {
|
|
400
404
|
url: string;
|
401
405
|
description: string;
|
402
406
|
id: string;
|
403
|
-
tags:
|
407
|
+
tags: string[];
|
404
408
|
icon: string;
|
405
409
|
}[];
|
406
410
|
MainProtocol: {
|
@@ -408,7 +412,7 @@ export declare abstract class RewardService {
|
|
408
412
|
url: string;
|
409
413
|
description: string;
|
410
414
|
id: string;
|
411
|
-
tags:
|
415
|
+
tags: string[];
|
412
416
|
icon: string;
|
413
417
|
} | null;
|
414
418
|
} & {
|
@@ -420,6 +424,7 @@ export declare abstract class RewardService {
|
|
420
424
|
identifier: string;
|
421
425
|
chainId: number;
|
422
426
|
action: import("../../../../database/api/.generated").$Enums.OpportunityAction;
|
427
|
+
depositUrl: string | null;
|
423
428
|
mainProtocolId: string | null;
|
424
429
|
tvl: number;
|
425
430
|
apr: number;
|
@@ -492,7 +497,7 @@ export declare abstract class RewardService {
|
|
492
497
|
url: string;
|
493
498
|
description: string;
|
494
499
|
id: string;
|
495
|
-
tags:
|
500
|
+
tags: string[];
|
496
501
|
icon: string;
|
497
502
|
}[];
|
498
503
|
MainProtocol: {
|
@@ -500,7 +505,7 @@ export declare abstract class RewardService {
|
|
500
505
|
url: string;
|
501
506
|
description: string;
|
502
507
|
id: string;
|
503
|
-
tags:
|
508
|
+
tags: string[];
|
504
509
|
icon: string;
|
505
510
|
} | null;
|
506
511
|
} & {
|
@@ -512,6 +517,7 @@ export declare abstract class RewardService {
|
|
512
517
|
identifier: string;
|
513
518
|
chainId: number;
|
514
519
|
action: import("../../../../database/api/.generated").$Enums.OpportunityAction;
|
520
|
+
depositUrl: string | null;
|
515
521
|
mainProtocolId: string | null;
|
516
522
|
tvl: number;
|
517
523
|
apr: number;
|
@@ -145,7 +145,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
145
145
|
url: string;
|
146
146
|
description: string;
|
147
147
|
id: string;
|
148
|
-
tags:
|
148
|
+
tags: string[];
|
149
149
|
icon: string;
|
150
150
|
} | undefined;
|
151
151
|
name: string;
|
@@ -155,6 +155,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
155
155
|
identifier: string;
|
156
156
|
chainId: number;
|
157
157
|
action: import("../../../database/api/.generated").$Enums.OpportunityAction;
|
158
|
+
depositUrl: string | null;
|
158
159
|
tvl: number;
|
159
160
|
apr: number;
|
160
161
|
dailyRewards: number;
|
@@ -208,7 +209,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
208
209
|
url: string;
|
209
210
|
description: string;
|
210
211
|
id: string;
|
211
|
-
tags:
|
212
|
+
tags: string[];
|
212
213
|
icon: string;
|
213
214
|
} | null | undefined;
|
214
215
|
aprRecord?: {
|
@@ -317,7 +318,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
317
318
|
url: string;
|
318
319
|
description: string;
|
319
320
|
id: string;
|
320
|
-
tags:
|
321
|
+
tags: string[];
|
321
322
|
icon: string;
|
322
323
|
} | null | undefined;
|
323
324
|
aprRecord?: {
|
@@ -513,6 +514,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
513
514
|
identifier: string;
|
514
515
|
chainId: number;
|
515
516
|
action: import("../../../database/api/.generated").$Enums.OpportunityAction;
|
517
|
+
depositUrl: string | null;
|
516
518
|
mainProtocolId: string | null;
|
517
519
|
tvl: number;
|
518
520
|
apr: number;
|
@@ -734,7 +736,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
734
736
|
query: {
|
735
737
|
id?: string | undefined;
|
736
738
|
items?: number | undefined;
|
737
|
-
tags?:
|
739
|
+
tags?: string[] | undefined;
|
738
740
|
page?: number | undefined;
|
739
741
|
opportunityTag?: string | undefined;
|
740
742
|
};
|
@@ -745,7 +747,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
745
747
|
url: string;
|
746
748
|
description: string;
|
747
749
|
id: string;
|
748
|
-
tags:
|
750
|
+
tags: string[];
|
749
751
|
icon: string;
|
750
752
|
} & {})[];
|
751
753
|
};
|
@@ -782,7 +784,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
782
784
|
url: string;
|
783
785
|
description: string;
|
784
786
|
id: string;
|
785
|
-
tags:
|
787
|
+
tags: string[];
|
786
788
|
icon: string;
|
787
789
|
} | null;
|
788
790
|
};
|
@@ -811,7 +813,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
811
813
|
url: string;
|
812
814
|
description: string;
|
813
815
|
id: string;
|
814
|
-
tags:
|
816
|
+
tags: string[];
|
815
817
|
icon: string;
|
816
818
|
};
|
817
819
|
};
|
@@ -827,7 +829,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
827
829
|
url: string;
|
828
830
|
description: string;
|
829
831
|
id: string;
|
830
|
-
tags:
|
832
|
+
tags: string[];
|
831
833
|
icon: string;
|
832
834
|
};
|
833
835
|
params: {};
|
@@ -841,7 +843,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
841
843
|
url: string;
|
842
844
|
description: string;
|
843
845
|
id: string;
|
844
|
-
tags:
|
846
|
+
tags: string[];
|
845
847
|
icon: string;
|
846
848
|
};
|
847
849
|
};
|
@@ -964,6 +966,39 @@ export declare const v4: Elysia<"/v4", false, {
|
|
964
966
|
};
|
965
967
|
};
|
966
968
|
};
|
969
|
+
} & {
|
970
|
+
tokens: {
|
971
|
+
index: {
|
972
|
+
post: {
|
973
|
+
body: {
|
974
|
+
isTest?: boolean | undefined;
|
975
|
+
icon: string;
|
976
|
+
chainId: number;
|
977
|
+
address: string;
|
978
|
+
verified: boolean;
|
979
|
+
};
|
980
|
+
params: {};
|
981
|
+
query: unknown;
|
982
|
+
headers: {
|
983
|
+
authorization: string;
|
984
|
+
};
|
985
|
+
response: {
|
986
|
+
200: {
|
987
|
+
symbol: string;
|
988
|
+
name: string | null;
|
989
|
+
id: string;
|
990
|
+
icon: string;
|
991
|
+
chainId: number;
|
992
|
+
address: string;
|
993
|
+
decimals: number;
|
994
|
+
verified: boolean;
|
995
|
+
isTest: boolean;
|
996
|
+
price?: number | null | undefined;
|
997
|
+
} | undefined;
|
998
|
+
};
|
999
|
+
};
|
1000
|
+
};
|
1001
|
+
};
|
967
1002
|
} & {
|
968
1003
|
tokens: {
|
969
1004
|
":id": {
|
@@ -1712,7 +1747,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1712
1747
|
url: string;
|
1713
1748
|
description: string;
|
1714
1749
|
id: string;
|
1715
|
-
tags:
|
1750
|
+
tags: string[];
|
1716
1751
|
icon: string;
|
1717
1752
|
}[];
|
1718
1753
|
MainProtocol: {
|
@@ -1720,7 +1755,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1720
1755
|
url: string;
|
1721
1756
|
description: string;
|
1722
1757
|
id: string;
|
1723
|
-
tags:
|
1758
|
+
tags: string[];
|
1724
1759
|
icon: string;
|
1725
1760
|
} | null;
|
1726
1761
|
} & {
|
@@ -1732,6 +1767,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1732
1767
|
identifier: string;
|
1733
1768
|
chainId: number;
|
1734
1769
|
action: import("../../../database/api/.generated").$Enums.OpportunityAction;
|
1770
|
+
depositUrl: string | null;
|
1735
1771
|
mainProtocolId: string | null;
|
1736
1772
|
tvl: number;
|
1737
1773
|
apr: number;
|
@@ -1827,7 +1863,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1827
1863
|
url: string;
|
1828
1864
|
description: string;
|
1829
1865
|
id: string;
|
1830
|
-
tags:
|
1866
|
+
tags: string[];
|
1831
1867
|
icon: string;
|
1832
1868
|
}[];
|
1833
1869
|
MainProtocol: {
|
@@ -1835,7 +1871,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1835
1871
|
url: string;
|
1836
1872
|
description: string;
|
1837
1873
|
id: string;
|
1838
|
-
tags:
|
1874
|
+
tags: string[];
|
1839
1875
|
icon: string;
|
1840
1876
|
} | null;
|
1841
1877
|
} & {
|
@@ -1847,6 +1883,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1847
1883
|
identifier: string;
|
1848
1884
|
chainId: number;
|
1849
1885
|
action: import("../../../database/api/.generated").$Enums.OpportunityAction;
|
1886
|
+
depositUrl: string | null;
|
1850
1887
|
mainProtocolId: string | null;
|
1851
1888
|
tvl: number;
|
1852
1889
|
apr: number;
|
@@ -2050,7 +2087,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
2050
2087
|
url: string;
|
2051
2088
|
description: string;
|
2052
2089
|
id: string;
|
2053
|
-
tags:
|
2090
|
+
tags: string[];
|
2054
2091
|
icon: string;
|
2055
2092
|
} & {})[];
|
2056
2093
|
};
|
@@ -2064,6 +2101,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
2064
2101
|
body: unknown;
|
2065
2102
|
params: {};
|
2066
2103
|
query: {
|
2104
|
+
slippage?: number | undefined;
|
2067
2105
|
identifier: string;
|
2068
2106
|
chainId: number;
|
2069
2107
|
protocolId: string;
|
@@ -2084,47 +2122,6 @@ export declare const v4: Elysia<"/v4", false, {
|
|
2084
2122
|
};
|
2085
2123
|
};
|
2086
2124
|
};
|
2087
|
-
} & {
|
2088
|
-
interaction: {
|
2089
|
-
sponsored: {
|
2090
|
-
get: {
|
2091
|
-
body: unknown;
|
2092
|
-
params: {};
|
2093
|
-
query: {
|
2094
|
-
identifier: string;
|
2095
|
-
chainId: number;
|
2096
|
-
protocolId: string;
|
2097
|
-
userAddress: string;
|
2098
|
-
fromAmount: string;
|
2099
|
-
fromTokenAddress: string;
|
2100
|
-
};
|
2101
|
-
headers: unknown;
|
2102
|
-
response: {
|
2103
|
-
200: {
|
2104
|
-
expirationTime: string;
|
2105
|
-
expiresIn: string;
|
2106
|
-
feeTokenAmount: string;
|
2107
|
-
feeTokendecimals: string;
|
2108
|
-
feeUSD: string;
|
2109
|
-
gasLimit: string;
|
2110
|
-
gasPrice: string;
|
2111
|
-
markup: string;
|
2112
|
-
maxNonce: string;
|
2113
|
-
protocolAddress: string;
|
2114
|
-
sponsorshipRatio: string;
|
2115
|
-
tokenAddress: string;
|
2116
|
-
tokenPrice: string;
|
2117
|
-
txData: {
|
2118
|
-
from: string;
|
2119
|
-
to: string;
|
2120
|
-
data: string;
|
2121
|
-
};
|
2122
|
-
warnings: string[];
|
2123
|
-
} | undefined;
|
2124
|
-
};
|
2125
|
-
};
|
2126
|
-
};
|
2127
|
-
};
|
2128
2125
|
};
|
2129
2126
|
} & {
|
2130
2127
|
v4: {
|
@@ -125,6 +125,39 @@ export declare const TokenController: Elysia<"/tokens", false, {
|
|
125
125
|
};
|
126
126
|
};
|
127
127
|
};
|
128
|
+
} & {
|
129
|
+
tokens: {
|
130
|
+
index: {
|
131
|
+
post: {
|
132
|
+
body: {
|
133
|
+
isTest?: boolean | undefined;
|
134
|
+
icon: string;
|
135
|
+
chainId: number;
|
136
|
+
address: string;
|
137
|
+
verified: boolean;
|
138
|
+
};
|
139
|
+
params: {};
|
140
|
+
query: unknown;
|
141
|
+
headers: {
|
142
|
+
authorization: string;
|
143
|
+
};
|
144
|
+
response: {
|
145
|
+
200: {
|
146
|
+
symbol: string;
|
147
|
+
name: string | null;
|
148
|
+
id: string;
|
149
|
+
icon: string;
|
150
|
+
chainId: number;
|
151
|
+
address: string;
|
152
|
+
decimals: number;
|
153
|
+
verified: boolean;
|
154
|
+
isTest: boolean;
|
155
|
+
price?: number | null | undefined;
|
156
|
+
} | undefined;
|
157
|
+
};
|
158
|
+
};
|
159
|
+
};
|
160
|
+
};
|
128
161
|
} & {
|
129
162
|
tokens: {
|
130
163
|
":id": {
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import { NotFoundError } from "../../../errors/NotFound.error";
|
2
2
|
import { AuthorizationHeadersDto, BackOfficeGuard } from "../../../guards/BackOffice.guard";
|
3
|
+
import { throwOnInvalidRequiredAddress, throwOnUnsupportedChainId } from "../../../utils/throw";
|
3
4
|
import Elysia from "elysia";
|
4
|
-
import { FindUniqueTokenDto, GetTokenBalanceDto, GetTokenQueryDto, TokenIdDto, UpdateTokenDto } from "./token.model";
|
5
|
+
import { CreateTokenDto, FindUniqueTokenDto, GetTokenBalanceDto, GetTokenQueryDto, TokenIdDto, UpdateTokenDto, } from "./token.model";
|
5
6
|
import { TokenService } from "./token.service";
|
6
7
|
// ─── Tokens Controller ───────────────────────────────────────────────────────
|
7
8
|
export const TokenController = new Elysia({ prefix: "/tokens", detail: { tags: ["Tokens"], hide: true } })
|
@@ -28,10 +29,22 @@ export const TokenController = new Elysia({ prefix: "/tokens", detail: { tags: [
|
|
28
29
|
.get("/", async ({ query }) => await TokenService.findMany(query), { query: GetTokenQueryDto })
|
29
30
|
// ─── Count Tokens ────────────────────────────────────────────────────
|
30
31
|
.get("/count", async ({ query }) => await TokenService.countMany(query), { query: GetTokenQueryDto })
|
32
|
+
// ─── Update IsTest Status ────────────────────────────────────────────
|
33
|
+
.post("/", async ({ body }) => await TokenService.fillAndCreate(body), {
|
34
|
+
body: CreateTokenDto,
|
35
|
+
headers: AuthorizationHeadersDto,
|
36
|
+
beforeHandle: ({ headers, body }) => () => {
|
37
|
+
BackOfficeGuard({ headers });
|
38
|
+
throwOnInvalidRequiredAddress(body.address);
|
39
|
+
throwOnUnsupportedChainId(body.chainId);
|
40
|
+
},
|
41
|
+
detail: { hide: true },
|
42
|
+
})
|
31
43
|
// ─── Update IsTest Status ────────────────────────────────────────────
|
32
44
|
.patch("/:id", async ({ params, body }) => await TokenService.update(params.id, body), {
|
33
45
|
params: TokenIdDto,
|
34
46
|
body: UpdateTokenDto,
|
35
47
|
headers: AuthorizationHeadersDto,
|
36
48
|
beforeHandle: BackOfficeGuard,
|
49
|
+
detail: { hide: true },
|
37
50
|
});
|
@@ -52,6 +52,14 @@ export declare const UpdateTokenDto: import("@sinclair/typebox").TObject<{
|
|
52
52
|
icon: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
53
53
|
displaySymbol: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
54
54
|
}>;
|
55
|
+
export declare const CreateTokenDto: import("@sinclair/typebox").TObject<{
|
56
|
+
chainId: import("@sinclair/typebox").TNumber;
|
57
|
+
address: import("@sinclair/typebox").TString;
|
58
|
+
icon: import("@sinclair/typebox").TString;
|
59
|
+
verified: import("@sinclair/typebox").TBoolean;
|
60
|
+
isTest: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
61
|
+
}>;
|
55
62
|
export type TokenModel = typeof TokenDto.static;
|
56
63
|
export type GetTokenQueryModel = typeof GetTokenQueryDto.static;
|
57
64
|
export type UpdateTokenModel = typeof UpdateTokenDto.static;
|
65
|
+
export type CreateTokenModel = typeof CreateTokenDto.static;
|
@@ -41,3 +41,10 @@ export const UpdateTokenDto = t.Object({
|
|
41
41
|
// iconFile: t.Optional(t.File()),
|
42
42
|
displaySymbol: t.Optional(t.String()),
|
43
43
|
});
|
44
|
+
export const CreateTokenDto = t.Object({
|
45
|
+
chainId: t.Numeric(),
|
46
|
+
address: t.String(),
|
47
|
+
icon: t.String(),
|
48
|
+
verified: t.Boolean(),
|
49
|
+
isTest: t.Optional(t.Boolean()),
|
50
|
+
});
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { GetTokenQueryModel, Token, TokenModel, TokenUnique, UpdateTokenModel } from "./";
|
1
|
+
import type { CreateTokenModel, GetTokenQueryModel, Token, TokenModel, TokenUnique, UpdateTokenModel } from "./";
|
2
2
|
import type { Pricer } from "../../../utils/pricer";
|
3
3
|
import { Prisma } from "../../../../database/api/.generated";
|
4
4
|
import { type ChainId } from "@sdk";
|
@@ -110,6 +110,24 @@ export declare abstract class TokenService {
|
|
110
110
|
} & {
|
111
111
|
price?: number | null | undefined;
|
112
112
|
}) | undefined>;
|
113
|
+
/**
|
114
|
+
* Fetches symbol, address, decimals and creates token on database
|
115
|
+
* @param chainId
|
116
|
+
* @param address
|
117
|
+
*/
|
118
|
+
static fillAndCreate(token: CreateTokenModel): Promise<({
|
119
|
+
symbol: string;
|
120
|
+
name: string | null;
|
121
|
+
id: string;
|
122
|
+
icon: string;
|
123
|
+
chainId: number;
|
124
|
+
address: string;
|
125
|
+
decimals: number;
|
126
|
+
verified: boolean;
|
127
|
+
isTest: boolean;
|
128
|
+
} & {
|
129
|
+
price?: number | null | undefined;
|
130
|
+
}) | undefined>;
|
113
131
|
/**
|
114
132
|
* Read token from database
|
115
133
|
* @param chainId
|
@@ -208,6 +208,16 @@ export class TokenService {
|
|
208
208
|
const id = TokenService.hashId(token);
|
209
209
|
return TokenRepository.upsert({ ...token, id });
|
210
210
|
}
|
211
|
+
/**
|
212
|
+
* Fetches symbol, address, decimals and creates token on database
|
213
|
+
* @param chainId
|
214
|
+
* @param address
|
215
|
+
*/
|
216
|
+
static async fillAndCreate(token) {
|
217
|
+
const id = TokenService.hashId(token);
|
218
|
+
const filledData = await TokenService.fetchOnChain({ address: token.address, chainId: token.chainId });
|
219
|
+
return TokenRepository.upsert({ ...filledData, ...token, id });
|
220
|
+
}
|
211
221
|
/**
|
212
222
|
* Read token from database
|
213
223
|
* @param chainId
|