@h0ngcha0/zeta-backend 0.0.1-rc.15 → 0.0.1-rc.18
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/types/api/index.d.ts +4 -3
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/serializers.d.ts +9 -0
- package/dist/types/api/serializers.d.ts.map +1 -0
- package/dist/types/api/types.d.ts +39 -11
- package/dist/types/api/types.d.ts.map +1 -1
- package/dist/types/api/utils.d.ts +6 -0
- package/dist/types/api/utils.d.ts.map +1 -0
- package/dist/types/app.d.ts +258 -14
- package/dist/types/app.d.ts.map +1 -1
- package/dist/types/cron.d.ts +54 -0
- package/dist/types/cron.d.ts.map +1 -0
- package/dist/types/database/clmmPositions.d.ts +28 -0
- package/dist/types/database/clmmPositions.d.ts.map +1 -0
- package/dist/types/database/cpmmPositions.d.ts +16 -0
- package/dist/types/database/cpmmPositions.d.ts.map +1 -0
- package/dist/types/database/mints.d.ts.map +1 -1
- package/dist/types/database/schemas.d.ts +8 -8
- package/dist/types/database/types.d.ts +17 -0
- package/dist/types/database/types.d.ts.map +1 -1
- package/dist/types/lib/error-codes.d.ts +12 -0
- package/dist/types/lib/error-codes.d.ts.map +1 -0
- package/dist/types/lib/errors.d.ts +22 -4
- package/dist/types/lib/errors.d.ts.map +1 -1
- package/dist/types/routes/addresses.d.ts +73 -0
- package/dist/types/routes/addresses.d.ts.map +1 -0
- package/dist/types/routes/compute.d.ts +8 -0
- package/dist/types/routes/compute.d.ts.map +1 -1
- package/dist/types/routes/ohlcv.d.ts +4 -0
- package/dist/types/routes/ohlcv.d.ts.map +1 -1
- package/dist/types/routes/pools.d.ts +55 -19
- package/dist/types/routes/pools.d.ts.map +1 -1
- package/dist/types/routes/response.d.ts +14 -4
- package/dist/types/routes/response.d.ts.map +1 -1
- package/dist/types/routes/stats.d.ts +45 -0
- package/dist/types/routes/stats.d.ts.map +1 -0
- package/dist/types/services/poolEventsSubscriptionService.d.ts.map +1 -1
- package/dist/types/services/poolService.d.ts +39 -8
- package/dist/types/services/poolService.d.ts.map +1 -1
- package/dist/types/services/priceService.d.ts +4 -1
- package/dist/types/services/priceService.d.ts.map +1 -1
- package/dist/types/utils/cacheUtil.d.ts +26 -0
- package/dist/types/utils/cacheUtil.d.ts.map +1 -0
- package/package.json +3 -2
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
import { Elysia } from 'elysia';
|
|
2
|
-
import { PaginatedApiResponse } from './response';
|
|
2
|
+
import type { PaginatedApiResponse } from './response';
|
|
3
3
|
import type { LiquidityLineData } from '../services/poolStatsService';
|
|
4
|
-
import type {
|
|
4
|
+
import type { ApiTokenPrice } from '../services/priceService';
|
|
5
5
|
import type { TokenInfo } from '@alephium/token-list';
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import type {
|
|
6
|
+
import type { ClmmLiquidityRow, ApiPoolWithStats } from '../services/poolService';
|
|
7
|
+
import type { ApiClmmPosition } from '../api/types';
|
|
8
|
+
import type { ApiPoolEvent } from '../database/types';
|
|
9
9
|
export type ClmmLiquidityRowPayload = ClmmLiquidityRow;
|
|
10
10
|
export interface ClmmLiquidityLinePayload {
|
|
11
11
|
count: number;
|
|
12
12
|
line: ClmmLiquidityRowPayload[];
|
|
13
13
|
}
|
|
14
|
-
export interface
|
|
14
|
+
export interface ApiPoolListResponse {
|
|
15
15
|
count: number;
|
|
16
16
|
totalPools: number;
|
|
17
|
-
data:
|
|
17
|
+
data: ApiPoolWithStats[];
|
|
18
18
|
}
|
|
19
|
-
export interface
|
|
19
|
+
export interface ApiPoolListFromIdsResponse {
|
|
20
20
|
count: number;
|
|
21
|
-
data:
|
|
21
|
+
data: ApiPoolWithStats[];
|
|
22
22
|
meta: {
|
|
23
23
|
requestedIds: string[];
|
|
24
24
|
foundIds: string[];
|
|
25
25
|
missingIds: string[];
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
-
export interface
|
|
29
|
-
data:
|
|
28
|
+
export interface ApiPoolEventsResponse {
|
|
29
|
+
data: ApiPoolEvent[];
|
|
30
30
|
}
|
|
31
31
|
export interface TokenListResponse {
|
|
32
32
|
count: number;
|
|
33
33
|
tokens: TokenInfo[];
|
|
34
34
|
}
|
|
35
|
-
export interface
|
|
35
|
+
export interface ApiTokenPricesResponse {
|
|
36
36
|
count: number;
|
|
37
|
-
prices:
|
|
37
|
+
prices: ApiTokenPrice[];
|
|
38
38
|
}
|
|
39
39
|
export declare const poolsRouter: Elysia<"/pools", {
|
|
40
40
|
decorator: {};
|
|
@@ -61,21 +61,25 @@ export declare const poolsRouter: Elysia<"/pools", {
|
|
|
61
61
|
headers: unknown;
|
|
62
62
|
response: {
|
|
63
63
|
400: {
|
|
64
|
+
code: "BAD_REQUEST" | "INVALID_FILE_TYPE" | "PARSE" | "INVALID_COOKIE_SIGNATURE";
|
|
64
65
|
message: string;
|
|
65
66
|
error: "Bad request";
|
|
66
67
|
details?: Record<string, unknown> | undefined;
|
|
67
68
|
};
|
|
68
69
|
404: {
|
|
70
|
+
code: "RESOURCE_NOT_FOUND";
|
|
69
71
|
message: string;
|
|
70
72
|
error: "Resource not found";
|
|
71
73
|
details?: Record<string, unknown> | undefined;
|
|
72
74
|
};
|
|
73
75
|
422: {
|
|
76
|
+
code: "VALIDATION";
|
|
74
77
|
message: string;
|
|
75
78
|
error: "Validation error";
|
|
76
79
|
details?: Record<string, unknown> | undefined;
|
|
77
80
|
};
|
|
78
81
|
500: {
|
|
82
|
+
code: "INTERNAL_SERVER_ERROR";
|
|
79
83
|
message: string;
|
|
80
84
|
error: "Internal server error";
|
|
81
85
|
details?: Record<string, unknown> | undefined;
|
|
@@ -98,21 +102,25 @@ export declare const poolsRouter: Elysia<"/pools", {
|
|
|
98
102
|
headers: unknown;
|
|
99
103
|
response: {
|
|
100
104
|
400: {
|
|
105
|
+
code: "BAD_REQUEST" | "INVALID_FILE_TYPE" | "PARSE" | "INVALID_COOKIE_SIGNATURE";
|
|
101
106
|
message: string;
|
|
102
107
|
error: "Bad request";
|
|
103
108
|
details?: Record<string, unknown> | undefined;
|
|
104
109
|
};
|
|
105
110
|
404: {
|
|
111
|
+
code: "RESOURCE_NOT_FOUND";
|
|
106
112
|
message: string;
|
|
107
113
|
error: "Resource not found";
|
|
108
114
|
details?: Record<string, unknown> | undefined;
|
|
109
115
|
};
|
|
110
116
|
422: {
|
|
117
|
+
code: "VALIDATION";
|
|
111
118
|
message: string;
|
|
112
119
|
error: "Validation error";
|
|
113
120
|
details?: Record<string, unknown> | undefined;
|
|
114
121
|
};
|
|
115
122
|
500: {
|
|
123
|
+
code: "INTERNAL_SERVER_ERROR";
|
|
116
124
|
message: string;
|
|
117
125
|
error: "Internal server error";
|
|
118
126
|
details?: Record<string, unknown> | undefined;
|
|
@@ -136,26 +144,30 @@ export declare const poolsRouter: Elysia<"/pools", {
|
|
|
136
144
|
headers: unknown;
|
|
137
145
|
response: {
|
|
138
146
|
400: {
|
|
147
|
+
code: "BAD_REQUEST" | "INVALID_FILE_TYPE" | "PARSE" | "INVALID_COOKIE_SIGNATURE";
|
|
139
148
|
message: string;
|
|
140
149
|
error: "Bad request";
|
|
141
150
|
details?: Record<string, unknown> | undefined;
|
|
142
151
|
};
|
|
143
152
|
404: {
|
|
153
|
+
code: "RESOURCE_NOT_FOUND";
|
|
144
154
|
message: string;
|
|
145
155
|
error: "Resource not found";
|
|
146
156
|
details?: Record<string, unknown> | undefined;
|
|
147
157
|
};
|
|
148
158
|
422: {
|
|
159
|
+
code: "VALIDATION";
|
|
149
160
|
message: string;
|
|
150
161
|
error: "Validation error";
|
|
151
162
|
details?: Record<string, unknown> | undefined;
|
|
152
163
|
};
|
|
153
164
|
500: {
|
|
165
|
+
code: "INTERNAL_SERVER_ERROR";
|
|
154
166
|
message: string;
|
|
155
167
|
error: "Internal server error";
|
|
156
168
|
details?: Record<string, unknown> | undefined;
|
|
157
169
|
};
|
|
158
|
-
200:
|
|
170
|
+
200: ApiTokenPricesResponse;
|
|
159
171
|
};
|
|
160
172
|
};
|
|
161
173
|
};
|
|
@@ -177,26 +189,30 @@ export declare const poolsRouter: Elysia<"/pools", {
|
|
|
177
189
|
headers: unknown;
|
|
178
190
|
response: {
|
|
179
191
|
400: {
|
|
192
|
+
code: "BAD_REQUEST" | "INVALID_FILE_TYPE" | "PARSE" | "INVALID_COOKIE_SIGNATURE";
|
|
180
193
|
message: string;
|
|
181
194
|
error: "Bad request";
|
|
182
195
|
details?: Record<string, unknown> | undefined;
|
|
183
196
|
};
|
|
184
197
|
404: {
|
|
198
|
+
code: "RESOURCE_NOT_FOUND";
|
|
185
199
|
message: string;
|
|
186
200
|
error: "Resource not found";
|
|
187
201
|
details?: Record<string, unknown> | undefined;
|
|
188
202
|
};
|
|
189
203
|
422: {
|
|
204
|
+
code: "VALIDATION";
|
|
190
205
|
message: string;
|
|
191
206
|
error: "Validation error";
|
|
192
207
|
details?: Record<string, unknown> | undefined;
|
|
193
208
|
};
|
|
194
209
|
500: {
|
|
210
|
+
code: "INTERNAL_SERVER_ERROR";
|
|
195
211
|
message: string;
|
|
196
212
|
error: "Internal server error";
|
|
197
213
|
details?: Record<string, unknown> | undefined;
|
|
198
214
|
};
|
|
199
|
-
200: PaginatedApiResponse<
|
|
215
|
+
200: PaginatedApiResponse<ApiPoolListResponse>;
|
|
200
216
|
};
|
|
201
217
|
};
|
|
202
218
|
};
|
|
@@ -215,26 +231,30 @@ export declare const poolsRouter: Elysia<"/pools", {
|
|
|
215
231
|
headers: unknown;
|
|
216
232
|
response: {
|
|
217
233
|
400: {
|
|
234
|
+
code: "BAD_REQUEST" | "INVALID_FILE_TYPE" | "PARSE" | "INVALID_COOKIE_SIGNATURE";
|
|
218
235
|
message: string;
|
|
219
236
|
error: "Bad request";
|
|
220
237
|
details?: Record<string, unknown> | undefined;
|
|
221
238
|
};
|
|
222
239
|
404: {
|
|
240
|
+
code: "RESOURCE_NOT_FOUND";
|
|
223
241
|
message: string;
|
|
224
242
|
error: "Resource not found";
|
|
225
243
|
details?: Record<string, unknown> | undefined;
|
|
226
244
|
};
|
|
227
245
|
422: {
|
|
246
|
+
code: "VALIDATION";
|
|
228
247
|
message: string;
|
|
229
248
|
error: "Validation error";
|
|
230
249
|
details?: Record<string, unknown> | undefined;
|
|
231
250
|
};
|
|
232
251
|
500: {
|
|
252
|
+
code: "INTERNAL_SERVER_ERROR";
|
|
233
253
|
message: string;
|
|
234
254
|
error: "Internal server error";
|
|
235
255
|
details?: Record<string, unknown> | undefined;
|
|
236
256
|
};
|
|
237
|
-
200:
|
|
257
|
+
200: ApiPoolListFromIdsResponse;
|
|
238
258
|
};
|
|
239
259
|
};
|
|
240
260
|
};
|
|
@@ -253,26 +273,30 @@ export declare const poolsRouter: Elysia<"/pools", {
|
|
|
253
273
|
headers: unknown;
|
|
254
274
|
response: {
|
|
255
275
|
400: {
|
|
276
|
+
code: "BAD_REQUEST" | "INVALID_FILE_TYPE" | "PARSE" | "INVALID_COOKIE_SIGNATURE";
|
|
256
277
|
message: string;
|
|
257
278
|
error: "Bad request";
|
|
258
279
|
details?: Record<string, unknown> | undefined;
|
|
259
280
|
};
|
|
260
281
|
404: {
|
|
282
|
+
code: "RESOURCE_NOT_FOUND";
|
|
261
283
|
message: string;
|
|
262
284
|
error: "Resource not found";
|
|
263
285
|
details?: Record<string, unknown> | undefined;
|
|
264
286
|
};
|
|
265
287
|
422: {
|
|
288
|
+
code: "VALIDATION";
|
|
266
289
|
message: string;
|
|
267
290
|
error: "Validation error";
|
|
268
291
|
details?: Record<string, unknown> | undefined;
|
|
269
292
|
};
|
|
270
293
|
500: {
|
|
294
|
+
code: "INTERNAL_SERVER_ERROR";
|
|
271
295
|
message: string;
|
|
272
296
|
error: "Internal server error";
|
|
273
297
|
details?: Record<string, unknown> | undefined;
|
|
274
298
|
};
|
|
275
|
-
200:
|
|
299
|
+
200: ApiPoolEventsResponse;
|
|
276
300
|
};
|
|
277
301
|
};
|
|
278
302
|
};
|
|
@@ -291,26 +315,30 @@ export declare const poolsRouter: Elysia<"/pools", {
|
|
|
291
315
|
headers: unknown;
|
|
292
316
|
response: {
|
|
293
317
|
400: {
|
|
318
|
+
code: "BAD_REQUEST" | "INVALID_FILE_TYPE" | "PARSE" | "INVALID_COOKIE_SIGNATURE";
|
|
294
319
|
message: string;
|
|
295
320
|
error: "Bad request";
|
|
296
321
|
details?: Record<string, unknown> | undefined;
|
|
297
322
|
};
|
|
298
323
|
404: {
|
|
324
|
+
code: "RESOURCE_NOT_FOUND";
|
|
299
325
|
message: string;
|
|
300
326
|
error: "Resource not found";
|
|
301
327
|
details?: Record<string, unknown> | undefined;
|
|
302
328
|
};
|
|
303
329
|
422: {
|
|
330
|
+
code: "VALIDATION";
|
|
304
331
|
message: string;
|
|
305
332
|
error: "Validation error";
|
|
306
333
|
details?: Record<string, unknown> | undefined;
|
|
307
334
|
};
|
|
308
335
|
500: {
|
|
336
|
+
code: "INTERNAL_SERVER_ERROR";
|
|
309
337
|
message: string;
|
|
310
338
|
error: "Internal server error";
|
|
311
339
|
details?: Record<string, unknown> | undefined;
|
|
312
340
|
};
|
|
313
|
-
200:
|
|
341
|
+
200: ApiClmmPosition[];
|
|
314
342
|
};
|
|
315
343
|
};
|
|
316
344
|
};
|
|
@@ -332,26 +360,30 @@ export declare const poolsRouter: Elysia<"/pools", {
|
|
|
332
360
|
headers: unknown;
|
|
333
361
|
response: {
|
|
334
362
|
400: {
|
|
363
|
+
code: "BAD_REQUEST" | "INVALID_FILE_TYPE" | "PARSE" | "INVALID_COOKIE_SIGNATURE";
|
|
335
364
|
message: string;
|
|
336
365
|
error: "Bad request";
|
|
337
366
|
details?: Record<string, unknown> | undefined;
|
|
338
367
|
};
|
|
339
368
|
404: {
|
|
369
|
+
code: "RESOURCE_NOT_FOUND";
|
|
340
370
|
message: string;
|
|
341
371
|
error: "Resource not found";
|
|
342
372
|
details?: Record<string, unknown> | undefined;
|
|
343
373
|
};
|
|
344
374
|
422: {
|
|
375
|
+
code: "VALIDATION";
|
|
345
376
|
message: string;
|
|
346
377
|
error: "Validation error";
|
|
347
378
|
details?: Record<string, unknown> | undefined;
|
|
348
379
|
};
|
|
349
380
|
500: {
|
|
381
|
+
code: "INTERNAL_SERVER_ERROR";
|
|
350
382
|
message: string;
|
|
351
383
|
error: "Internal server error";
|
|
352
384
|
details?: Record<string, unknown> | undefined;
|
|
353
385
|
};
|
|
354
|
-
200: PaginatedApiResponse<
|
|
386
|
+
200: PaginatedApiResponse<ApiPoolListResponse>;
|
|
355
387
|
};
|
|
356
388
|
};
|
|
357
389
|
};
|
|
@@ -372,21 +404,25 @@ export declare const poolsRouter: Elysia<"/pools", {
|
|
|
372
404
|
headers: unknown;
|
|
373
405
|
response: {
|
|
374
406
|
400: {
|
|
407
|
+
code: "BAD_REQUEST" | "INVALID_FILE_TYPE" | "PARSE" | "INVALID_COOKIE_SIGNATURE";
|
|
375
408
|
message: string;
|
|
376
409
|
error: "Bad request";
|
|
377
410
|
details?: Record<string, unknown> | undefined;
|
|
378
411
|
};
|
|
379
412
|
404: {
|
|
413
|
+
code: "RESOURCE_NOT_FOUND";
|
|
380
414
|
message: string;
|
|
381
415
|
error: "Resource not found";
|
|
382
416
|
details?: Record<string, unknown> | undefined;
|
|
383
417
|
};
|
|
384
418
|
422: {
|
|
419
|
+
code: "VALIDATION";
|
|
385
420
|
message: string;
|
|
386
421
|
error: "Validation error";
|
|
387
422
|
details?: Record<string, unknown> | undefined;
|
|
388
423
|
};
|
|
389
424
|
500: {
|
|
425
|
+
code: "INTERNAL_SERVER_ERROR";
|
|
390
426
|
message: string;
|
|
391
427
|
error: "Internal server error";
|
|
392
428
|
details?: Record<string, unknown> | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pools.d.ts","sourceRoot":"","sources":["../../../src/routes/pools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAK,MAAM,QAAQ,CAAC;AAGnC,OAAO,
|
|
1
|
+
{"version":3,"file":"pools.d.ts","sourceRo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M,CAAC;IACd,MAAM,EAAE,aAAa,EAAE,CAAC;CACzB;AAED,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6arB,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type PaginatedApiResponse<T> = {
|
|
2
2
|
data: T & {
|
|
3
3
|
meta: {
|
|
4
4
|
page: number;
|
|
@@ -6,9 +6,7 @@ export interface PaginatedApiResponse<T> extends Response {
|
|
|
6
6
|
totalPages: number;
|
|
7
7
|
};
|
|
8
8
|
};
|
|
9
|
-
}
|
|
10
|
-
export declare function handlePaginatedSuccess<T>(data: T, page: number, pageSize: number, totalPages: number): PaginatedApiResponse<T>;
|
|
11
|
-
export declare function handleSuccess<T>(data: T): T;
|
|
9
|
+
};
|
|
12
10
|
export declare function badRequest(message: string): never;
|
|
13
11
|
export declare function notFound(subject: string): never;
|
|
14
12
|
export declare function internalServerError(error: unknown): never;
|
|
@@ -18,11 +16,14 @@ export declare const DefaultErrorResponseSchemas: {
|
|
|
18
16
|
details: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
|
|
19
17
|
} & {
|
|
20
18
|
error: import("zod").ZodLiteral<"Bad request">;
|
|
19
|
+
code: import("zod").ZodEnum<["BAD_REQUEST", "INVALID_FILE_TYPE", "PARSE", "INVALID_COOKIE_SIGNATURE"]>;
|
|
21
20
|
}, "strip", import("zod").ZodTypeAny, {
|
|
21
|
+
code: "BAD_REQUEST" | "INVALID_FILE_TYPE" | "PARSE" | "INVALID_COOKIE_SIGNATURE";
|
|
22
22
|
message: string;
|
|
23
23
|
error: "Bad request";
|
|
24
24
|
details?: Record<string, unknown> | undefined;
|
|
25
25
|
}, {
|
|
26
|
+
code: "BAD_REQUEST" | "INVALID_FILE_TYPE" | "PARSE" | "INVALID_COOKIE_SIGNATURE";
|
|
26
27
|
message: string;
|
|
27
28
|
error: "Bad request";
|
|
28
29
|
details?: Record<string, unknown> | undefined;
|
|
@@ -32,11 +33,14 @@ export declare const DefaultErrorResponseSchemas: {
|
|
|
32
33
|
details: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
|
|
33
34
|
} & {
|
|
34
35
|
error: import("zod").ZodLiteral<"Resource not found">;
|
|
36
|
+
code: import("zod").ZodEnum<["RESOURCE_NOT_FOUND"]>;
|
|
35
37
|
}, "strip", import("zod").ZodTypeAny, {
|
|
38
|
+
code: "RESOURCE_NOT_FOUND";
|
|
36
39
|
message: string;
|
|
37
40
|
error: "Resource not found";
|
|
38
41
|
details?: Record<string, unknown> | undefined;
|
|
39
42
|
}, {
|
|
43
|
+
code: "RESOURCE_NOT_FOUND";
|
|
40
44
|
message: string;
|
|
41
45
|
error: "Resource not found";
|
|
42
46
|
details?: Record<string, unknown> | undefined;
|
|
@@ -46,11 +50,14 @@ export declare const DefaultErrorResponseSchemas: {
|
|
|
46
50
|
details: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
|
|
47
51
|
} & {
|
|
48
52
|
error: import("zod").ZodLiteral<"Validation error">;
|
|
53
|
+
code: import("zod").ZodEnum<["VALIDATION"]>;
|
|
49
54
|
}, "strip", import("zod").ZodTypeAny, {
|
|
55
|
+
code: "VALIDATION";
|
|
50
56
|
message: string;
|
|
51
57
|
error: "Validation error";
|
|
52
58
|
details?: Record<string, unknown> | undefined;
|
|
53
59
|
}, {
|
|
60
|
+
code: "VALIDATION";
|
|
54
61
|
message: string;
|
|
55
62
|
error: "Validation error";
|
|
56
63
|
details?: Record<string, unknown> | undefined;
|
|
@@ -60,11 +67,14 @@ export declare const DefaultErrorResponseSchemas: {
|
|
|
60
67
|
details: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
|
|
61
68
|
} & {
|
|
62
69
|
error: import("zod").ZodLiteral<"Internal server error">;
|
|
70
|
+
code: import("zod").ZodEnum<["INTERNAL_SERVER_ERROR"]>;
|
|
63
71
|
}, "strip", import("zod").ZodTypeAny, {
|
|
72
|
+
code: "INTERNAL_SERVER_ERROR";
|
|
64
73
|
message: string;
|
|
65
74
|
error: "Internal server error";
|
|
66
75
|
details?: Record<string, unknown> | undefined;
|
|
67
76
|
}, {
|
|
77
|
+
code: "INTERNAL_SERVER_ERROR";
|
|
68
78
|
message: string;
|
|
69
79
|
error: "Internal server error";
|
|
70
80
|
details?: Record<string, unknown> | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../../src/routes/response.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../../src/routes/response.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,oBAAoB,CAAC,CAAC,IAAI;IACpC,IAAI,EAAE,CAAC,GAAG;QACR,IAAI,EAAE;YACJ,IAAI,EAAE,MAAM,CAAC;YACb,QAAQ,EAAE,MAAM,CAAC;YACjB,UAAU,EAAE,MAAM,CAAC;SACpB,CAAC;KACH,CAAC;CACH,CAAC;AAEF,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAEjD;AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAE/C;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,CAwBzD;AAGD,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKvC,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Elysia } from 'elysia';
|
|
2
|
+
import type { ApiGlobalStats } from '../services/poolService';
|
|
3
|
+
export declare const statsRouter: Elysia<"/stats", {
|
|
4
|
+
decorator: {};
|
|
5
|
+
store: {};
|
|
6
|
+
derive: {};
|
|
7
|
+
resolve: {};
|
|
8
|
+
}, {
|
|
9
|
+
typebox: {};
|
|
10
|
+
error: {};
|
|
11
|
+
}, {
|
|
12
|
+
schema: {};
|
|
13
|
+
standaloneSchema: {};
|
|
14
|
+
macro: {};
|
|
15
|
+
macroFn: {};
|
|
16
|
+
parser: {};
|
|
17
|
+
response: {};
|
|
18
|
+
}, {
|
|
19
|
+
stats: {
|
|
20
|
+
global: {
|
|
21
|
+
get: {
|
|
22
|
+
body: unknown;
|
|
23
|
+
params: {};
|
|
24
|
+
query: unknown;
|
|
25
|
+
headers: unknown;
|
|
26
|
+
response: {
|
|
27
|
+
200: ApiGlobalStats;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
}, {
|
|
33
|
+
derive: {};
|
|
34
|
+
resolve: {};
|
|
35
|
+
schema: {};
|
|
36
|
+
standaloneSchema: {};
|
|
37
|
+
response: {};
|
|
38
|
+
}, {
|
|
39
|
+
derive: {};
|
|
40
|
+
resolve: {};
|
|
41
|
+
schema: {};
|
|
42
|
+
standaloneSchema: {};
|
|
43
|
+
response: {};
|
|
44
|
+
}>;
|
|
45
|
+
//# sourceMappingURL=stats.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../../src/routes/stats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAI7D,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWrB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"poolEventsSubscriptionService.d.ts","sourceRoot":"","sources":["../../../src/services/poolEventsSubscriptionService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,IAAI,EAGL,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGjD,OAAO,KAAK,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"poolEventsSubscriptionService.d.ts","sourceRoot":"","sources":["../../../src/services/poolEventsSubscriptionService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,IAAI,EAGL,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGjD,OAAO,KAAK,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAkZ5F,qBAAa,6BAA6B;IAMtC,OAAO,CAAC,IAAI;IACZ,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,yBAAyB;IACjC,OAAO,CAAC,qBAAqB;IAR/B,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA+B;IACxD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAmC;gBAGtD,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,WAAW,EACxB,yBAAyB,EAAE,yBAAyB,EACpD,qBAAqB,EAAE,qBAAqB;IAUhD,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAsBxC,gBAAgB,IAAI,IAAI;CAWzB"}
|
|
@@ -3,10 +3,31 @@ import { type SqlClient } from '../config/database';
|
|
|
3
3
|
import type { TokenInfo } from '@alephium/token-list';
|
|
4
4
|
import type { PriceService } from './priceService';
|
|
5
5
|
import type { PoolStatsService, PoolStats } from './poolStatsService';
|
|
6
|
-
import type { ClmmPoolTypes } from '@h0ngcha0/typescript-sdk';
|
|
6
|
+
import type { ClmmPoolTypes, CpmmTokenPairTypes } from '@h0ngcha0/typescript-sdk';
|
|
7
7
|
import type { PoolEvent, PoolRow, PoolEventCounterRow, PoolFactoryEventCounterRow } from '../database/types';
|
|
8
|
-
import type {
|
|
8
|
+
import type { ApiClmmPosition, ApiCpmmPosition } from '../api/types';
|
|
9
9
|
import Decimal from 'decimal.js';
|
|
10
|
+
export interface ApiCpmmPoolContractState extends Omit<CpmmPoolContractState, 'reserve0' | 'reserve1' | 'totalSupply'> {
|
|
11
|
+
reserve0: string;
|
|
12
|
+
reserve1: string;
|
|
13
|
+
totalSupply: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ApiClmmPoolContractState extends Omit<ClmmPoolContractState, 'liquidity' | 'sqrtPriceX96' | 'tick' | 'configIndex' | 'tickSpacing' | 'tradingFee' | 'protocolFee'> {
|
|
16
|
+
liquidity: string;
|
|
17
|
+
sqrtPriceX96: string;
|
|
18
|
+
tick: number;
|
|
19
|
+
configIndex: number;
|
|
20
|
+
tickSpacing: number;
|
|
21
|
+
tradingFee: string;
|
|
22
|
+
protocolFee: string;
|
|
23
|
+
}
|
|
24
|
+
export type ApiCpmmPoolWithStats = ApiCpmmPoolContractState & PoolStats & {
|
|
25
|
+
type: typeof PoolType.Standard;
|
|
26
|
+
};
|
|
27
|
+
export type ApiClmmPoolWithStats = ApiClmmPoolContractState & PoolStats & {
|
|
28
|
+
type: typeof PoolType.Concentrated;
|
|
29
|
+
};
|
|
30
|
+
export type ApiPoolWithStats = ApiCpmmPoolWithStats | ApiClmmPoolWithStats;
|
|
10
31
|
export type CpmmPoolWithStats = CpmmPoolContractState & PoolStats & {
|
|
11
32
|
type: typeof PoolType.Standard;
|
|
12
33
|
};
|
|
@@ -40,21 +61,26 @@ export interface ClmmLiquidityRow {
|
|
|
40
61
|
price: string;
|
|
41
62
|
liquidity: string;
|
|
42
63
|
}
|
|
64
|
+
export interface ApiGlobalStats {
|
|
65
|
+
tvl: string;
|
|
66
|
+
volume_1d: string;
|
|
67
|
+
lastUpdated: number;
|
|
68
|
+
}
|
|
43
69
|
export declare class PoolService {
|
|
44
70
|
private zeta;
|
|
45
71
|
private priceService;
|
|
46
72
|
private poolStatsService;
|
|
73
|
+
private globalStatsCache;
|
|
47
74
|
constructor(zeta: Zeta, priceService: PriceService, poolStatsService: PoolStatsService);
|
|
48
75
|
private getCpmmFeeRate;
|
|
49
76
|
private getClmmFeeRate;
|
|
50
|
-
private getTokensInfo;
|
|
51
77
|
private poolRecordToCpmmPool;
|
|
52
78
|
private poolRecordToCpmmPoolWithStats;
|
|
53
79
|
private poolRecordToClmmPool;
|
|
54
80
|
private poolRecordToClmmPoolWithStats;
|
|
55
81
|
getPoolByTokenPairId(tokenPairId: string): Promise<CpmmPoolWithStats | undefined>;
|
|
56
82
|
getPoolsByToken(token0Id: string, token1Id?: string, poolType?: PoolType, page?: number, pageSize?: number): Promise<{
|
|
57
|
-
pools:
|
|
83
|
+
pools: PoolWithStats[];
|
|
58
84
|
total: number;
|
|
59
85
|
page: number;
|
|
60
86
|
pageSize: number;
|
|
@@ -70,10 +96,13 @@ export declare class PoolService {
|
|
|
70
96
|
totalPages: number;
|
|
71
97
|
}>;
|
|
72
98
|
recordPoolEvent(poolId: string, eventType: string, txId: string, blockHash: string, eventData: unknown, client?: SqlClient): Promise<void>;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
99
|
+
recordCpmmMintEvent(poolId: string, mintEvent: CpmmTokenPairTypes.MintEvent, client?: SqlClient): Promise<void>;
|
|
100
|
+
recordCpmmBurnEvent(poolId: string, burnEvent: CpmmTokenPairTypes.BurnEvent, client?: SqlClient): Promise<void>;
|
|
101
|
+
recordClmmFeesEvent(poolId: string, event: ClmmPoolTypes.FeesEvent, client?: SqlClient): Promise<void>;
|
|
102
|
+
recordClmmMintEvent(poolId: string, mintEvent: ClmmPoolTypes.MintEvent, client?: SqlClient): Promise<void>;
|
|
103
|
+
recordClmmBurnEvent(poolId: string, burnEvent: ClmmPoolTypes.BurnEvent, client?: SqlClient): Promise<void>;
|
|
104
|
+
getClmmPositions(candidates: string[], client?: SqlClient): Promise<ApiClmmPosition[]>;
|
|
105
|
+
getCpmmPositions(address: string, client?: SqlClient): Promise<ApiCpmmPosition[]>;
|
|
77
106
|
recordPoolFactoryEvent(poolId: string, eventType: string, txId: string, blockHash: string, eventData: unknown, client?: SqlClient): Promise<void>;
|
|
78
107
|
getPoolEvents(poolId: string, client?: SqlClient): Promise<PoolEvent[]>;
|
|
79
108
|
getPoolEventCounter(poolId: string, client?: SqlClient): Promise<PoolEventCounterRecord | undefined>;
|
|
@@ -111,5 +140,7 @@ export declare class PoolService {
|
|
|
111
140
|
private fetchClmmTokenReserves;
|
|
112
141
|
computePoolTVL(poolRecord: PoolRecord): Promise<Decimal>;
|
|
113
142
|
computePoolTVLById(poolId: string): Promise<string>;
|
|
143
|
+
getGlobalStats(): Promise<ApiGlobalStats>;
|
|
144
|
+
calculateAndUpdateGlobalStats(): Promise<ApiGlobalStats>;
|
|
114
145
|
}
|
|
115
146
|
//# sourceMappingURL=poolService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"poolService.d.ts","sourceRoot":"","sources":["../../../src/services/poolService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"poolService.d.ts","sourceRoot":"","sources":["../../../src/services/pool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rice, 'price' | 'priceUSD'> {
|
|
10
|
+
price: number;
|
|
11
|
+
priceUSD: number;
|
|
12
|
+
}
|
|
9
13
|
export declare class PriceService {
|
|
10
14
|
private readonly zeta;
|
|
11
15
|
private priceCache;
|
|
12
|
-
private readonly CACHE_DURATION;
|
|
13
16
|
constructor(zeta: Zeta);
|
|
14
17
|
private fetchTokenPrices;
|
|
15
18
|
getTokenPrice(symbol: string): Promise<Decimal | undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"priceService.d.ts","sourceRoot":"","sources":["../../../src/services/priceService.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AACtC,OAAO,EAAgB,KAAK,IAAI,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"priceService.d.ts","sourceRoot":"","sources":["../../../src/services/priceService.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AACtC,OAAO,EAAgB,KAAK,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAKnE,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,UAAU,EAAE,OAAO,GAAG,UAAU,CAAC;IAC3E,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,YAAY;IAGX,OAAO,CAAC,QAAQ,CAAC,IAAI;IAFjC,OAAO,CAAC,UAAU,CAAqD;gBAE1C,IAAI,EAAE,IAAI;YAEzB,gBAAgB;IA6CjB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC;IAe3D,yBAAyB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IA2BnE,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IA+B7E;;OAEG;IACU,iBAAiB,CAC5B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC;IAQ/B;;OAEG;IACU,kBAAkB,CAC7B,MAAM,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,GAClE,OAAO,CAAC,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAA;KAAE,CAAC,CAAC;YA2BtE,0BAA0B;CAazC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface CacheEntry<T> {
|
|
2
|
+
value: T;
|
|
3
|
+
timestamp: number;
|
|
4
|
+
}
|
|
5
|
+
export declare class Cache<T> {
|
|
6
|
+
private readonly duration;
|
|
7
|
+
private cache;
|
|
8
|
+
constructor(duration: number);
|
|
9
|
+
/**
|
|
10
|
+
* Get a cached value if it exists and is still valid.
|
|
11
|
+
*/
|
|
12
|
+
get(key: string): T | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Set a value in the cache.
|
|
15
|
+
*/
|
|
16
|
+
set(key: string, value: T): void;
|
|
17
|
+
/**
|
|
18
|
+
* Manually invalidate a cached key, if necessary.
|
|
19
|
+
*/
|
|
20
|
+
invalidate(key: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* Invalidate all cache entries.
|
|
23
|
+
*/
|
|
24
|
+
clear(): void;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=cacheUtil.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cacheUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/cacheUtil.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,KAAK,EAAE,CAAC,CAAC;IACT,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,KAAK,CAAC,CAAC;IAGN,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAFrC,OAAO,CAAC,KAAK,CAAyC;gBAEzB,QAAQ,EAAE,MAAM;IAE7C;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAe/B;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI;IAOhC;;OAEG;IACH,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAI7B;;OAEG;IACH,KAAK,IAAI,IAAI;CAGd"}
|