@merkl/api 0.16.18 → 0.16.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/eden/index.d.ts +410 -35
- package/dist/src/index.d.ts +82 -7
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +13 -1
- package/dist/src/modules/v4/campaign/campaign.service.d.ts +26 -2
- package/dist/src/modules/v4/enso/enso.service.js +4 -1
- package/dist/src/modules/v4/kyberzap/kyberzap.service.js +1 -1
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +40 -4
- package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +2 -2
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +108 -12
- package/dist/src/modules/v4/opportunity/subservices/getClammMetadata.service.js +3 -3
- package/dist/src/modules/v4/protocol/protocol.controller.d.ts +1 -0
- package/dist/src/modules/v4/protocol/protocol.model.d.ts +1 -0
- package/dist/src/modules/v4/protocol/protocol.model.js +1 -0
- package/dist/src/modules/v4/protocol/protocol.repository.js +5 -1
- package/dist/src/modules/v4/protocol/protocol.service.d.ts +0 -2
- package/dist/src/modules/v4/protocol/protocol.service.js +0 -38
- package/dist/src/modules/v4/router.d.ts +82 -7
- package/dist/src/modules/v4/token/token.controller.d.ts +28 -2
- package/dist/src/modules/v4/token/token.service.d.ts +71 -7
- package/dist/src/modules/v4/token/token.service.js +3 -3
- package/dist/src/utils/camelToKebabCase.d.ts +1 -0
- package/dist/src/utils/camelToKebabCase.js +3 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -93,8 +93,20 @@ export declare const v4: Elysia<"/v4", false, {
|
|
93
93
|
name: string;
|
94
94
|
status: "PAST" | "LIVE" | "SOON";
|
95
95
|
action: import("../../../database/api/.generated").$Enums.OpportunityAction;
|
96
|
-
tokens:
|
97
|
-
|
96
|
+
tokens: ({
|
97
|
+
symbol: string;
|
98
|
+
name: string | null;
|
99
|
+
id: string;
|
100
|
+
icon: string;
|
101
|
+
chainId: number;
|
102
|
+
address: string;
|
103
|
+
decimals: number;
|
104
|
+
verified: boolean;
|
105
|
+
isTest: boolean;
|
106
|
+
} & {
|
107
|
+
price?: number | null | undefined;
|
108
|
+
})[];
|
109
|
+
mainProtocol: string | undefined;
|
98
110
|
depositUrl: any;
|
99
111
|
tags: string[];
|
100
112
|
};
|
@@ -179,7 +191,19 @@ export declare const v4: Elysia<"/v4", false, {
|
|
179
191
|
};
|
180
192
|
id: string;
|
181
193
|
depositUrl: string | undefined;
|
182
|
-
tokens:
|
194
|
+
tokens: ({
|
195
|
+
symbol: string;
|
196
|
+
name: string | null;
|
197
|
+
id: string;
|
198
|
+
icon: string;
|
199
|
+
chainId: number;
|
200
|
+
address: string;
|
201
|
+
decimals: number;
|
202
|
+
verified: boolean;
|
203
|
+
isTest: boolean;
|
204
|
+
} & {
|
205
|
+
price?: number | null | undefined;
|
206
|
+
})[];
|
183
207
|
chain: {
|
184
208
|
name: string;
|
185
209
|
id: number;
|
@@ -466,7 +490,19 @@ export declare const v4: Elysia<"/v4", false, {
|
|
466
490
|
id: number;
|
467
491
|
icon: string;
|
468
492
|
};
|
469
|
-
rewardToken:
|
493
|
+
rewardToken: {
|
494
|
+
symbol: string;
|
495
|
+
name: string | null;
|
496
|
+
id: string;
|
497
|
+
icon: string;
|
498
|
+
chainId: number;
|
499
|
+
address: string;
|
500
|
+
decimals: number;
|
501
|
+
verified: boolean;
|
502
|
+
isTest: boolean;
|
503
|
+
} & {
|
504
|
+
price?: number | null | undefined;
|
505
|
+
};
|
470
506
|
distributionChain: {
|
471
507
|
name: string;
|
472
508
|
id: number;
|
@@ -946,7 +982,19 @@ export declare const v4: Elysia<"/v4", false, {
|
|
946
982
|
id: number;
|
947
983
|
icon: string;
|
948
984
|
};
|
949
|
-
rewardToken:
|
985
|
+
rewardToken: {
|
986
|
+
symbol: string;
|
987
|
+
name: string | null;
|
988
|
+
id: string;
|
989
|
+
icon: string;
|
990
|
+
chainId: number;
|
991
|
+
address: string;
|
992
|
+
decimals: number;
|
993
|
+
verified: boolean;
|
994
|
+
isTest: boolean;
|
995
|
+
} & {
|
996
|
+
price?: number | null | undefined;
|
997
|
+
};
|
950
998
|
distributionChain: {
|
951
999
|
name: string;
|
952
1000
|
id: number;
|
@@ -1103,6 +1151,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1103
1151
|
items?: number | undefined;
|
1104
1152
|
tags?: string[] | undefined;
|
1105
1153
|
page?: number | undefined;
|
1154
|
+
ids?: string[] | undefined;
|
1106
1155
|
opportunityTag?: string | undefined;
|
1107
1156
|
};
|
1108
1157
|
headers: unknown;
|
@@ -1359,7 +1408,21 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1359
1408
|
};
|
1360
1409
|
headers: unknown;
|
1361
1410
|
response: {
|
1362
|
-
200:
|
1411
|
+
200: ({
|
1412
|
+
symbol: string;
|
1413
|
+
name: string | null;
|
1414
|
+
id: string;
|
1415
|
+
icon: string;
|
1416
|
+
chainId: number;
|
1417
|
+
address: string;
|
1418
|
+
decimals: number;
|
1419
|
+
verified: boolean;
|
1420
|
+
isTest: boolean;
|
1421
|
+
} & {
|
1422
|
+
price?: number | null | undefined;
|
1423
|
+
} & {
|
1424
|
+
balance: bigint;
|
1425
|
+
})[];
|
1363
1426
|
};
|
1364
1427
|
};
|
1365
1428
|
};
|
@@ -1381,7 +1444,19 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1381
1444
|
};
|
1382
1445
|
headers: unknown;
|
1383
1446
|
response: {
|
1384
|
-
200:
|
1447
|
+
200: ({
|
1448
|
+
symbol: string;
|
1449
|
+
name: string | null;
|
1450
|
+
id: string;
|
1451
|
+
icon: string;
|
1452
|
+
chainId: number;
|
1453
|
+
address: string;
|
1454
|
+
decimals: number;
|
1455
|
+
verified: boolean;
|
1456
|
+
isTest: boolean;
|
1457
|
+
} & {
|
1458
|
+
price?: number | null | undefined;
|
1459
|
+
})[];
|
1385
1460
|
};
|
1386
1461
|
};
|
1387
1462
|
};
|
@@ -120,7 +120,21 @@ export declare const TokenController: Elysia<"/tokens", false, {
|
|
120
120
|
};
|
121
121
|
headers: unknown;
|
122
122
|
response: {
|
123
|
-
200:
|
123
|
+
200: ({
|
124
|
+
symbol: string;
|
125
|
+
name: string | null;
|
126
|
+
id: string;
|
127
|
+
icon: string;
|
128
|
+
chainId: number;
|
129
|
+
address: string;
|
130
|
+
decimals: number;
|
131
|
+
verified: boolean;
|
132
|
+
isTest: boolean;
|
133
|
+
} & {
|
134
|
+
price?: number | null | undefined;
|
135
|
+
} & {
|
136
|
+
balance: bigint;
|
137
|
+
})[];
|
124
138
|
};
|
125
139
|
};
|
126
140
|
};
|
@@ -142,7 +156,19 @@ export declare const TokenController: Elysia<"/tokens", false, {
|
|
142
156
|
};
|
143
157
|
headers: unknown;
|
144
158
|
response: {
|
145
|
-
200:
|
159
|
+
200: ({
|
160
|
+
symbol: string;
|
161
|
+
name: string | null;
|
162
|
+
id: string;
|
163
|
+
icon: string;
|
164
|
+
chainId: number;
|
165
|
+
address: string;
|
166
|
+
decimals: number;
|
167
|
+
verified: boolean;
|
168
|
+
isTest: boolean;
|
169
|
+
} & {
|
170
|
+
price?: number | null | undefined;
|
171
|
+
})[];
|
146
172
|
};
|
147
173
|
};
|
148
174
|
};
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import type { CreateTokenModel, GetTokenQueryModel, Token, TokenModel, TokenUnique, UpdateTokenModel } from "./";
|
2
1
|
import type { Pricer } from "../../../utils/pricer";
|
3
2
|
import { type ChainId } from "@sdk";
|
3
|
+
import type { CreateTokenModel, GetTokenQueryModel, Token, TokenModel, TokenUnique, UpdateTokenModel } from "./token.model";
|
4
4
|
import { TokenRepository } from "./token.repository";
|
5
5
|
export declare abstract class TokenService {
|
6
6
|
static hashId(token: TokenUnique): string;
|
@@ -14,16 +14,56 @@ export declare abstract class TokenService {
|
|
14
14
|
/**
|
15
15
|
* Fetches tokens and include balances
|
16
16
|
*/
|
17
|
-
static fetchTokensAndBalances(chainId: number, userAddress: string, addresses: string[]): Promise<
|
17
|
+
static fetchTokensAndBalances(chainId: number, userAddress: string, addresses: string[]): Promise<({
|
18
|
+
symbol: string;
|
19
|
+
name: string | null;
|
20
|
+
id: string;
|
21
|
+
icon: string;
|
22
|
+
chainId: number;
|
23
|
+
address: string;
|
24
|
+
decimals: number;
|
25
|
+
verified: boolean;
|
26
|
+
isTest: boolean;
|
27
|
+
} & {
|
28
|
+
price?: number | null | undefined;
|
29
|
+
} & {
|
30
|
+
balance: bigint;
|
31
|
+
})[]>;
|
18
32
|
/**
|
19
33
|
* Fetches balances of verified tokens
|
20
34
|
* @info tokens that are popular and must be detected in the app are marked as 'verified'
|
21
35
|
* @param additionalTokens balances along with the verified ones
|
22
36
|
*/
|
23
|
-
static fetchVerifiedBalances(chainId: number, userAddress: string, additionalTokenAddresses?: string[]): Promise<
|
37
|
+
static fetchVerifiedBalances(chainId: number, userAddress: string, additionalTokenAddresses?: string[]): Promise<({
|
38
|
+
symbol: string;
|
39
|
+
name: string | null;
|
40
|
+
id: string;
|
41
|
+
icon: string;
|
42
|
+
chainId: number;
|
43
|
+
address: string;
|
44
|
+
decimals: number;
|
45
|
+
verified: boolean;
|
46
|
+
isTest: boolean;
|
47
|
+
} & {
|
48
|
+
price?: number | null | undefined;
|
49
|
+
} & {
|
50
|
+
balance: bigint;
|
51
|
+
})[]>;
|
24
52
|
static fetchOnChain(token: TokenModel): Promise<Omit<Token["model"], "id">>;
|
25
53
|
static fetchManyOnChain(chainId: ChainId, addresses: string[]): Promise<{
|
26
|
-
[address: string]: Omit<
|
54
|
+
[address: string]: Omit<{
|
55
|
+
symbol: string;
|
56
|
+
name: string | null;
|
57
|
+
id: string;
|
58
|
+
icon: string;
|
59
|
+
chainId: number;
|
60
|
+
address: string;
|
61
|
+
decimals: number;
|
62
|
+
verified: boolean;
|
63
|
+
isTest: boolean;
|
64
|
+
} & {
|
65
|
+
price?: number | null | undefined;
|
66
|
+
}, "id">;
|
27
67
|
}>;
|
28
68
|
/**
|
29
69
|
* Updates price of tokens that share the same symbol
|
@@ -110,15 +150,39 @@ export declare abstract class TokenService {
|
|
110
150
|
* @param query
|
111
151
|
* @returns A list of tokens
|
112
152
|
*/
|
113
|
-
static findMany(query: GetTokenQueryModel): Promise<
|
114
|
-
|
153
|
+
static findMany(query: GetTokenQueryModel): Promise<({
|
154
|
+
symbol: string;
|
155
|
+
name: string | null;
|
156
|
+
id: string;
|
157
|
+
icon: string;
|
158
|
+
chainId: number;
|
159
|
+
address: string;
|
160
|
+
decimals: number;
|
161
|
+
verified: boolean;
|
162
|
+
isTest: boolean;
|
163
|
+
} & {
|
164
|
+
price?: number | null | undefined;
|
165
|
+
})[]>;
|
166
|
+
static findManyObjectPerAddress(query: GetTokenQueryModel): Promise<Record<string, {
|
167
|
+
symbol: string;
|
168
|
+
name: string | null;
|
169
|
+
id: string;
|
170
|
+
icon: string;
|
171
|
+
chainId: number;
|
172
|
+
address: string;
|
173
|
+
decimals: number;
|
174
|
+
verified: boolean;
|
175
|
+
isTest: boolean;
|
176
|
+
} & {
|
177
|
+
price?: number | null | undefined;
|
178
|
+
}>>;
|
115
179
|
/**
|
116
180
|
* Get value of tokens
|
117
181
|
* @param tokenAmounts address/chain + amount of token
|
118
182
|
* @returns the cumulated dollar value of all tokens
|
119
183
|
*/
|
120
184
|
static getValue(tokenAmounts: {
|
121
|
-
amount
|
185
|
+
amount?: bigint;
|
122
186
|
address: string;
|
123
187
|
chainId: number;
|
124
188
|
}[]): Promise<number>;
|
@@ -238,7 +238,7 @@ export class TokenService {
|
|
238
238
|
.find(({ address: addr, chainId: chain }) => addr === address && chainId === chain);
|
239
239
|
if (!token)
|
240
240
|
return sum;
|
241
|
-
const value = (bigIntToNumber(amount, token.decimals) ?? 0) * (token.price ?? 0);
|
241
|
+
const value = (bigIntToNumber(amount ?? 0n, token.decimals) ?? 0) * (token.price ?? 0);
|
242
242
|
return sum + value;
|
243
243
|
}, 0);
|
244
244
|
}
|
@@ -267,10 +267,10 @@ export class TokenService {
|
|
267
267
|
}
|
268
268
|
catch (err) {
|
269
269
|
if (err instanceof Prisma.PrismaClientKnownRequestError && err.code === "P2025") {
|
270
|
-
const newToken = await TokenService.fetchOnChain(token);
|
270
|
+
const newToken = Object.assign(await TokenService.fetchOnChain(token), { id: id });
|
271
271
|
if (!newToken)
|
272
272
|
return;
|
273
|
-
return await TokenRepository.upsert(
|
273
|
+
return await TokenRepository.upsert(newToken);
|
274
274
|
}
|
275
275
|
}
|
276
276
|
}));
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function camelToKebabCase(str: string): string;
|