@eyettea/zeta-backend 0.0.1-rc.3
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/README.md +1 -0
- package/dist/types/api/index.d.ts +9 -0
- package/dist/types/api/index.d.ts.map +1 -0
- package/dist/types/api/types.d.ts +19 -0
- package/dist/types/api/types.d.ts.map +1 -0
- package/dist/types/app.d.ts +945 -0
- package/dist/types/app.d.ts.map +1 -0
- package/dist/types/config/database.d.ts +17 -0
- package/dist/types/config/database.d.ts.map +1 -0
- package/dist/types/config/env.d.ts +20 -0
- package/dist/types/config/env.d.ts.map +1 -0
- package/dist/types/database/aggregates.d.ts +14 -0
- package/dist/types/database/aggregates.d.ts.map +1 -0
- package/dist/types/database/clmmTicks.d.ts +9 -0
- package/dist/types/database/clmmTicks.d.ts.map +1 -0
- package/dist/types/database/liquidityTicks.d.ts +7 -0
- package/dist/types/database/liquidityTicks.d.ts.map +1 -0
- package/dist/types/database/mints.d.ts +18 -0
- package/dist/types/database/mints.d.ts.map +1 -0
- package/dist/types/database/poolEvents.d.ts +37 -0
- package/dist/types/database/poolEvents.d.ts.map +1 -0
- package/dist/types/database/pools.d.ts +47 -0
- package/dist/types/database/pools.d.ts.map +1 -0
- package/dist/types/database/priceTicks.d.ts +7 -0
- package/dist/types/database/priceTicks.d.ts.map +1 -0
- package/dist/types/database/schemas.d.ts +134 -0
- package/dist/types/database/schemas.d.ts.map +1 -0
- package/dist/types/database/types.d.ts +114 -0
- package/dist/types/database/types.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/lib/errors.d.ts +8 -0
- package/dist/types/lib/errors.d.ts.map +1 -0
- package/dist/types/lib/logger.d.ts +2 -0
- package/dist/types/lib/logger.d.ts.map +1 -0
- package/dist/types/lib/validation.d.ts +3 -0
- package/dist/types/lib/validation.d.ts.map +1 -0
- package/dist/types/routes/compute.d.ts +103 -0
- package/dist/types/routes/compute.d.ts.map +1 -0
- package/dist/types/routes/ohlcv.d.ts +64 -0
- package/dist/types/routes/ohlcv.d.ts.map +1 -0
- package/dist/types/routes/pools.d.ts +305 -0
- package/dist/types/routes/pools.d.ts.map +1 -0
- package/dist/types/routes/response.d.ts +26 -0
- package/dist/types/routes/response.d.ts.map +1 -0
- package/dist/types/routes/websocket.d.ts +42 -0
- package/dist/types/routes/websocket.d.ts.map +1 -0
- package/dist/types/services/Services.d.ts +21 -0
- package/dist/types/services/Services.d.ts.map +1 -0
- package/dist/types/services/computeService.d.ts +103 -0
- package/dist/types/services/computeService.d.ts.map +1 -0
- package/dist/types/services/poolEventsHandler.d.ts +26 -0
- package/dist/types/services/poolEventsHandler.d.ts.map +1 -0
- package/dist/types/services/poolEventsSubscriptionService.d.ts +16 -0
- package/dist/types/services/poolEventsSubscriptionService.d.ts.map +1 -0
- package/dist/types/services/poolService.d.ts +140 -0
- package/dist/types/services/poolService.d.ts.map +1 -0
- package/dist/types/services/poolStateWebsocketService.d.ts +13 -0
- package/dist/types/services/poolStateWebsocketService.d.ts.map +1 -0
- package/dist/types/services/poolStatsService.d.ts +53 -0
- package/dist/types/services/poolStatsService.d.ts.map +1 -0
- package/dist/types/services/priceService.d.ts +36 -0
- package/dist/types/services/priceService.d.ts.map +1 -0
- package/dist/types/utils/period.d.ts +8 -0
- package/dist/types/utils/period.d.ts.map +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAgB,MAAM,QAAQ,CAAC;AAiB9C,wBAAgB,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0GxB;AAED,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAc,CAAC;AAC/B,MAAM,MAAM,GAAG,GAAG,OAAO,GAAG,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import postgres from 'postgres';
|
|
2
|
+
declare const sql: postgres.Sql<{}>;
|
|
3
|
+
export type SqlClient = typeof sql;
|
|
4
|
+
export declare function ensureDatabaseExists(): Promise<void>;
|
|
5
|
+
export declare function checkDatabaseConnection(): Promise<boolean>;
|
|
6
|
+
export declare function closeDatabaseConnection(): Promise<void>;
|
|
7
|
+
export declare function withTransaction<T>(fn: (tx: SqlClient) => T | Promise<T>, client?: SqlClient): Promise<Awaited<T>>;
|
|
8
|
+
export declare class DatabaseError extends Error {
|
|
9
|
+
readonly cause?: unknown;
|
|
10
|
+
readonly code?: string;
|
|
11
|
+
readonly detail?: string;
|
|
12
|
+
constructor(message: string, cause?: unknown);
|
|
13
|
+
}
|
|
14
|
+
export declare function wrapDatabaseError(message: string, error: unknown): DatabaseError;
|
|
15
|
+
export declare function isDatabaseError(error: unknown): error is DatabaseError;
|
|
16
|
+
export default sql;
|
|
17
|
+
//# sourceMappingURL=database.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../../src/config/database.ts"],"names":[],"mappings":"AAAA,OAAO,QAA6C,MAAM,UAAU,CAAC;AA+CrE,QAAA,MAAM,GAAG,kBAA+D,CAAC;AAEzE,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,CAAC;AAEnC,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC,CA2B1D;AAED,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,OAAO,CAAC,CAahE;AAED,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,IAAI,CAAC,CAiB7D;AAED,wBAAsB,eAAe,CAAC,CAAC,EACrC,EAAE,EAAE,CAAC,EAAE,EAAE,SAAS,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EACrC,MAAM,GAAE,SAAe,GACtB,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAErB;AAED,qBAAa,aAAc,SAAQ,KAAK;IACtC,SAAgB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChC,SAAgB,IAAI,CAAC,EAAE,MAAM,CAAC;IAC9B,SAAgB,MAAM,CAAC,EAAE,MAAM,CAAC;gBAEpB,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAU7C;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,aAAa,CAKhF;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAEtE;AAkBD,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const env: Readonly<{
|
|
2
|
+
DB_NAME: string;
|
|
3
|
+
NODE_ENV: "development" | "test" | "production";
|
|
4
|
+
HOST: string;
|
|
5
|
+
PORT: number;
|
|
6
|
+
LOG_LEVEL: "error" | "warn" | "warning" | "info" | "debug";
|
|
7
|
+
DB_HOST: string;
|
|
8
|
+
DB_PORT: number;
|
|
9
|
+
DB_USER: string;
|
|
10
|
+
DB_PASSWORD: string;
|
|
11
|
+
DB_IDLE_TIMEOUT: number;
|
|
12
|
+
DB_CONNECT_TIMEOUT: number;
|
|
13
|
+
DB_MAX_CONNECTIONS: number;
|
|
14
|
+
DB_MAX_LIFETIME: number;
|
|
15
|
+
NETWORK_ID: "mainnet" | "testnet" | "devnet";
|
|
16
|
+
TOKEN_LIST_FILE: string;
|
|
17
|
+
PRICE_API_URL: string;
|
|
18
|
+
}>;
|
|
19
|
+
export type Env = typeof env;
|
|
20
|
+
//# sourceMappingURL=env.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../../src/config/env.ts"],"names":[],"mappings":"AA2CA,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;EAGd,CAAC;AACH,MAAM,MAAM,GAAG,GAAG,OAAO,GAAG,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { AggregatedOHLCVRow, OHLCVRow } from './types';
|
|
2
|
+
export declare function getAggregatedOHLCV(poolId: string, startTime: number, endTime: number): Promise<AggregatedOHLCVRow[]>;
|
|
3
|
+
export declare function getOHLCVRows(poolId: string, interval: string, timeFrom: number, timeTo: number): Promise<OHLCVRow[]>;
|
|
4
|
+
export declare function getOHLCVRowsByTokenPair(tokenAId: string, tokenBId: string, interval: string, timeFrom: number, timeTo: number): Promise<OHLCVRow[]>;
|
|
5
|
+
export declare function refreshContinuousAggregate(viewName: string): Promise<void>;
|
|
6
|
+
export declare function getOHLCVCounts(): Promise<{
|
|
7
|
+
ohlcv_1m_count: number;
|
|
8
|
+
ohlcv_15m_count: number;
|
|
9
|
+
ohlcv_1h_count: number;
|
|
10
|
+
ohlcv_4h_count: number;
|
|
11
|
+
ohlcv_1d_count: number;
|
|
12
|
+
ohlcv_1w_count: number;
|
|
13
|
+
}>;
|
|
14
|
+
//# sourceMappingURL=aggregates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aggregates.d.ts","sourceRoot":"","sources":["../../../src/database/aggregates.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AA0D5D,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAa/B;AAED,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,QAAQ,EAAE,CAAC,CAkBrB;AAED,wBAAsB,uBAAuB,CAC3C,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,QAAQ,EAAE,CAAC,CAoBrB;AAED,wBAAsB,0BAA0B,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAKhF;AAED,wBAAsB,cAAc,IAAI,OAAO,CAAC;IAC9C,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC,CA4BD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ClmmTickRow } from './types';
|
|
2
|
+
export interface ClmmTickDelta {
|
|
3
|
+
tick: bigint;
|
|
4
|
+
liquidityGrossDelta: bigint;
|
|
5
|
+
liquidityNetDelta: bigint;
|
|
6
|
+
}
|
|
7
|
+
export declare function applyTickDeltas(poolId: string, deltas: ClmmTickDelta[]): Promise<void>;
|
|
8
|
+
export declare function fetchClmmTicks(poolId: string): Promise<ClmmTickRow[]>;
|
|
9
|
+
//# sourceMappingURL=clmmTicks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clmmTicks.d.ts","sourceRoot":"","sources":["../../../src/database/clmmTicks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,mBAAmB,EAAE,MAAM,CAAC;IAC5B,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,wBAAsB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAsB5F;AAED,wBAAsB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAO3E"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { LiquidityTickInsert } from './types';
|
|
2
|
+
export declare function insertLiquidityTick(params: LiquidityTickInsert): Promise<void>;
|
|
3
|
+
export declare function getLiquidityTickStats(): Promise<{
|
|
4
|
+
total_liquidity_ticks: number;
|
|
5
|
+
pools_with_liquidity: number;
|
|
6
|
+
}>;
|
|
7
|
+
//# sourceMappingURL=liquidityTicks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liquidityTicks.d.ts","sourceRoot":"","sources":["../../../src/database/liquidityTicks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,wBAAsB,mBAAmB,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkCpF;AAED,wBAAsB,qBAAqB,IAAI,OAAO,CAAC;IACrD,qBAAqB,EAAE,MAAM,CAAC;IAC9B,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAAC,CAiBD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type SqlClient } from '../config/database';
|
|
2
|
+
import type { ClmmPoolTypes } from '@h0ngcha0/typescript-sdk';
|
|
3
|
+
import type { ClmmPositionRow } from './types';
|
|
4
|
+
export declare function insertMints(params: {
|
|
5
|
+
id: string;
|
|
6
|
+
poolId: string;
|
|
7
|
+
configIndex: number;
|
|
8
|
+
createdAt?: Date;
|
|
9
|
+
mint: ClmmPoolTypes.MintEvent;
|
|
10
|
+
}, client?: SqlClient): Promise<void>;
|
|
11
|
+
export declare function insertBurns(params: {
|
|
12
|
+
id: string;
|
|
13
|
+
poolId: string;
|
|
14
|
+
createdAt?: Date;
|
|
15
|
+
burn: ClmmPoolTypes.BurnEvent;
|
|
16
|
+
}, client?: SqlClient): Promise<void>;
|
|
17
|
+
export declare function getClmmPositions(candidates: string[], client?: SqlClient): Promise<ClmmPositionRow[]>;
|
|
18
|
+
//# sourceMappingURL=mints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mints.d.ts","sourceRoot":"","sources":["../../../src/database/mints.ts"],"names":[],"mappings":"AAAA,OAAY,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,wBAAsB,WAAW,CAC/B,MAAM,EAAE;IACN,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC;CAC/B,EACD,MAAM,GAAE,SAAe,GACtB,OAAO,CAAC,IAAI,CAAC,CA2Cf;AAED,wBAAsB,WAAW,CAC/B,MAAM,EAAE;IACN,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC;CAC/B,EACD,MAAM,GAAE,SAAe,GACtB,OAAO,CAAC,IAAI,CAAC,CAQf;AAED,wBAAsB,gBAAgB,CACpC,UAAU,EAAE,MAAM,EAAE,EACpB,MAAM,GAAE,SAAe,GACtB,OAAO,CAAC,eAAe,EAAE,CAAC,CAwB5B"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type SqlClient } from '../config/database';
|
|
2
|
+
import type { PoolEvent, PoolEventCounterRow, PoolFactoryEventCounterRow } from './types';
|
|
3
|
+
export declare function insertPoolEvent(params: {
|
|
4
|
+
poolId: string;
|
|
5
|
+
eventType: string;
|
|
6
|
+
txId: string;
|
|
7
|
+
blockHash: string;
|
|
8
|
+
eventData: unknown;
|
|
9
|
+
}, client?: SqlClient): Promise<void>;
|
|
10
|
+
export declare function insertPoolFactoryEvent(params: {
|
|
11
|
+
poolId: string;
|
|
12
|
+
eventType: string;
|
|
13
|
+
txId: string;
|
|
14
|
+
blockHash: string;
|
|
15
|
+
eventData: unknown;
|
|
16
|
+
}, client?: SqlClient): Promise<void>;
|
|
17
|
+
export declare function getPoolEventCounter(poolId: string, client?: SqlClient): Promise<PoolEventCounterRow | undefined>;
|
|
18
|
+
export declare function getPoolEvents(poolId: string, client?: SqlClient): Promise<PoolEvent[]>;
|
|
19
|
+
export declare function createPoolEventCounter(poolId: string, fromCount?: number, client?: SqlClient): Promise<void>;
|
|
20
|
+
export declare function updatePoolEventCounter(poolId: string, fromCount: number, client?: SqlClient): Promise<void>;
|
|
21
|
+
export declare function getPoolFactoryEventCounter(poolFactoryId: string, client?: SqlClient): Promise<PoolFactoryEventCounterRow | undefined>;
|
|
22
|
+
export declare function createPoolFactoryEventCounter(poolFactoryId: string, fromCount?: number, client?: SqlClient): Promise<void>;
|
|
23
|
+
export declare function updatePoolFactoryEventCounter(poolFactoryId: string, fromCount: number, client?: SqlClient): Promise<void>;
|
|
24
|
+
export declare function getPoolEventSummary(): Promise<{
|
|
25
|
+
total_events: number;
|
|
26
|
+
swaps: number;
|
|
27
|
+
mints: number;
|
|
28
|
+
burns: number;
|
|
29
|
+
}>;
|
|
30
|
+
export declare function getFactoryEventCount(): Promise<number>;
|
|
31
|
+
export declare function getMostActivePools(limit: number): Promise<{
|
|
32
|
+
pool_id: string;
|
|
33
|
+
event_count: number;
|
|
34
|
+
last_event: Date | null;
|
|
35
|
+
}[]>;
|
|
36
|
+
export declare function countEventsForPool(poolId: string): Promise<number>;
|
|
37
|
+
//# sourceMappingURL=poolEvents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"poolEvents.d.ts","sourceRoot":"","sources":["../../../src/database/poolEvents.ts"],"names":[],"mappings":"AAAA,OAAY,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAG1F,wBAAsB,eAAe,CACnC,MAAM,EAAE;IACN,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,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AM,EACjB,MAAM,GAAE,SAAe,GACtB,OAAO,CAAC,IAAI,CAAC,CAOf;AAED,wBAAsB,mBAAmB,IAAI,OAAO,CAAC;IACnD,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC,CAuBD;AAED,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC,CAM5D;AAED,wBAAsB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAC9D;IACE,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;CACzB,EAAE,CACJ,CAiBA;AAED,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAOxE"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type SqlClient } from '../config/database';
|
|
2
|
+
import type { PoolRow, PoolType } from './types';
|
|
3
|
+
export declare function getPoolById(id: string): Promise<PoolRow | undefined>;
|
|
4
|
+
export declare function upsertPool(params: {
|
|
5
|
+
id: string;
|
|
6
|
+
token0: string;
|
|
7
|
+
token1: string;
|
|
8
|
+
poolType: PoolType;
|
|
9
|
+
configIndex?: number;
|
|
10
|
+
}, client?: SqlClient): Promise<void>;
|
|
11
|
+
export declare function countAllPools(): Promise<number>;
|
|
12
|
+
export declare function countPoolsByType(poolType: PoolType): Promise<number>;
|
|
13
|
+
export declare function countActivePools(poolType?: PoolType | 'all'): Promise<number>;
|
|
14
|
+
export declare function fetchActivePools(params: {
|
|
15
|
+
poolType?: PoolType | 'all';
|
|
16
|
+
sortDirection?: 'asc' | 'desc';
|
|
17
|
+
limit?: number;
|
|
18
|
+
offset?: number;
|
|
19
|
+
}): Promise<PoolRow[]>;
|
|
20
|
+
export declare function countActivePoolsByExactPair(params: {
|
|
21
|
+
token0Id: string;
|
|
22
|
+
token1Id: string;
|
|
23
|
+
poolType?: PoolType | 'all';
|
|
24
|
+
}): Promise<number>;
|
|
25
|
+
export declare function fetchActivePoolsByExactPair(params: {
|
|
26
|
+
token0Id: string;
|
|
27
|
+
token1Id: string;
|
|
28
|
+
poolType?: PoolType | 'all';
|
|
29
|
+
sortDirection?: 'asc' | 'desc';
|
|
30
|
+
limit?: number;
|
|
31
|
+
offset?: number;
|
|
32
|
+
}): Promise<PoolRow[]>;
|
|
33
|
+
export declare function countActivePoolsByToken(params: {
|
|
34
|
+
tokenId: string;
|
|
35
|
+
poolType?: PoolType | 'all';
|
|
36
|
+
}): Promise<number>;
|
|
37
|
+
export declare function fetchActivePoolsByToken(params: {
|
|
38
|
+
tokenId: string;
|
|
39
|
+
poolType?: PoolType | 'all';
|
|
40
|
+
sortDirection?: 'asc' | 'desc';
|
|
41
|
+
limit?: number;
|
|
42
|
+
offset?: number;
|
|
43
|
+
}): Promise<PoolRow[]>;
|
|
44
|
+
export declare function fetchAllActivePools(): Promise<PoolRow[]>;
|
|
45
|
+
export declare function fetchRecentActivePools(limit: number): Promise<PoolRow[]>;
|
|
46
|
+
export declare function fetchActivePoolsByIds(poolIds: string[]): Promise<PoolRow[]>;
|
|
47
|
+
//# sourceMappingURL=pools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pools.d.ts","sourceRoot":"","sources":["../../../src/database/pools.ts"],"names":[],"mappings":"AAAA,OAAY,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAKjD,wBAAsB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAQ1E;AAED,wBAAsB,UAAU,CAC9B,MAAM,EAAE;IACN,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC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AAE;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;CAC7B,GAAG,OAAO,CAAC,MAAM,CAAC,CAqBlB;AAED,wBAAsB,uBAAuB,CAAC,MAAM,EAAE;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;IAC5B,aAAa,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CA2BrB;AAED,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC,CAQ9D;AAED,wBAAsB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAS9E;AAED,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAUjF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PriceTickInsert } from './types';
|
|
2
|
+
export declare function insertPriceTick(params: PriceTickInsert): Promise<void>;
|
|
3
|
+
export declare function getPriceTickStats(): Promise<{
|
|
4
|
+
total_price_ticks: number;
|
|
5
|
+
pools_with_prices: number;
|
|
6
|
+
}>;
|
|
7
|
+
//# sourceMappingURL=priceTicks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"priceTicks.d.ts","sourceRoot":"","sources":["../../../src/database/priceTicks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG/C,wBAAsB,eAAe,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAmB5E;AAED,wBAAsB,iBAAiB,IAAI,OAAO,CAAC;IACjD,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC,CAiBD"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ZPoolRow: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
token0_id: z.ZodString;
|
|
5
|
+
token1_id: z.ZodString;
|
|
6
|
+
config_index: z.ZodNullable<z.ZodNumber>;
|
|
7
|
+
pool_type: z.ZodEnum<["standard", "concentrated"]>;
|
|
8
|
+
is_active: z.ZodBoolean;
|
|
9
|
+
created_at: z.ZodDate;
|
|
10
|
+
updated_at: z.ZodDate;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
id: string;
|
|
13
|
+
token0_id: string;
|
|
14
|
+
token1_id: string;
|
|
15
|
+
config_index: number | null;
|
|
16
|
+
pool_type: "standard" | "concentrated";
|
|
17
|
+
is_active: boolean;
|
|
18
|
+
created_at: Date;
|
|
19
|
+
updated_at: Date;
|
|
20
|
+
}, {
|
|
21
|
+
id: string;
|
|
22
|
+
token0_id: string;
|
|
23
|
+
token1_id: string;
|
|
24
|
+
config_index: number | null;
|
|
25
|
+
pool_type: "standard" | "concentrated";
|
|
26
|
+
is_active: boolean;
|
|
27
|
+
created_at: Date;
|
|
28
|
+
updated_at: Date;
|
|
29
|
+
}>;
|
|
30
|
+
export declare const ZPoolEventCounterRow: z.ZodObject<{
|
|
31
|
+
id: z.ZodString;
|
|
32
|
+
pool_id: z.ZodString;
|
|
33
|
+
from_count: z.ZodNumber;
|
|
34
|
+
is_active: z.ZodBoolean;
|
|
35
|
+
created_at: z.ZodDate;
|
|
36
|
+
updated_at: z.ZodDate;
|
|
37
|
+
}, "strip", z.ZodTypeAny, {
|
|
38
|
+
id: string;
|
|
39
|
+
is_active: boolean;
|
|
40
|
+
created_at: Date;
|
|
41
|
+
updated_at: Date;
|
|
42
|
+
pool_id: string;
|
|
43
|
+
from_count: number;
|
|
44
|
+
}, {
|
|
45
|
+
id: string;
|
|
46
|
+
is_active: boolean;
|
|
47
|
+
created_at: Date;
|
|
48
|
+
updated_at: Date;
|
|
49
|
+
pool_id: string;
|
|
50
|
+
from_count: number;
|
|
51
|
+
}>;
|
|
52
|
+
export declare const ZPoolFactoryEventCounterRow: z.ZodObject<{
|
|
53
|
+
id: z.ZodString;
|
|
54
|
+
pool_factory_id: z.ZodString;
|
|
55
|
+
from_count: z.ZodNumber;
|
|
56
|
+
is_active: z.ZodBoolean;
|
|
57
|
+
created_at: z.ZodDate;
|
|
58
|
+
updated_at: z.ZodDate;
|
|
59
|
+
}, "strip", z.ZodTypeAny, {
|
|
60
|
+
id: string;
|
|
61
|
+
is_active: boolean;
|
|
62
|
+
created_at: Date;
|
|
63
|
+
updated_at: Date;
|
|
64
|
+
from_count: number;
|
|
65
|
+
pool_factory_id: string;
|
|
66
|
+
}, {
|
|
67
|
+
id: string;
|
|
68
|
+
is_active: boolean;
|
|
69
|
+
created_at: Date;
|
|
70
|
+
updated_at: Date;
|
|
71
|
+
from_count: number;
|
|
72
|
+
pool_factory_id: string;
|
|
73
|
+
}>;
|
|
74
|
+
export declare const ZAggregatedOHLCVRow: z.ZodObject<{
|
|
75
|
+
total_volume_base: z.ZodNullable<z.ZodString>;
|
|
76
|
+
total_volume_quote: z.ZodNullable<z.ZodString>;
|
|
77
|
+
price_min: z.ZodNullable<z.ZodString>;
|
|
78
|
+
price_max: z.ZodNullable<z.ZodString>;
|
|
79
|
+
}, "strip", z.ZodTypeAny, {
|
|
80
|
+
total_volume_base: string | null;
|
|
81
|
+
total_volume_quote: string | null;
|
|
82
|
+
price_min: string | null;
|
|
83
|
+
price_max: string | null;
|
|
84
|
+
}, {
|
|
85
|
+
total_volume_base: string | null;
|
|
86
|
+
total_volume_quote: string | null;
|
|
87
|
+
price_min: string | null;
|
|
88
|
+
price_max: string | null;
|
|
89
|
+
}>;
|
|
90
|
+
export declare const ZOHLCVRow: z.ZodObject<{
|
|
91
|
+
unix_time: z.ZodString;
|
|
92
|
+
open_price: z.ZodString;
|
|
93
|
+
high_price: z.ZodString;
|
|
94
|
+
low_price: z.ZodString;
|
|
95
|
+
close_price: z.ZodString;
|
|
96
|
+
volume_base: z.ZodString;
|
|
97
|
+
volume_quote: z.ZodString;
|
|
98
|
+
}, "strip", z.ZodTypeAny, {
|
|
99
|
+
unix_time: string;
|
|
100
|
+
open_price: string;
|
|
101
|
+
high_price: string;
|
|
102
|
+
low_price: string;
|
|
103
|
+
close_price: string;
|
|
104
|
+
volume_base: string;
|
|
105
|
+
volume_quote: string;
|
|
106
|
+
}, {
|
|
107
|
+
unix_time: string;
|
|
108
|
+
open_price: string;
|
|
109
|
+
high_price: string;
|
|
110
|
+
low_price: string;
|
|
111
|
+
close_price: string;
|
|
112
|
+
volume_base: string;
|
|
113
|
+
volume_quote: string;
|
|
114
|
+
}>;
|
|
115
|
+
export declare const ZClmmTickRow: z.ZodObject<{
|
|
116
|
+
pool_id: z.ZodString;
|
|
117
|
+
tick: z.ZodString;
|
|
118
|
+
liquidity_gross: z.ZodString;
|
|
119
|
+
liquidity_net: z.ZodString;
|
|
120
|
+
}, "strip", z.ZodTypeAny, {
|
|
121
|
+
pool_id: string;
|
|
122
|
+
tick: string;
|
|
123
|
+
liquidity_gross: string;
|
|
124
|
+
liquidity_net: string;
|
|
125
|
+
}, {
|
|
126
|
+
pool_id: string;
|
|
127
|
+
tick: string;
|
|
128
|
+
liquidity_gross: string;
|
|
129
|
+
liquidity_net: string;
|
|
130
|
+
}>;
|
|
131
|
+
export declare function parseRow<Output, Schema extends z.ZodType<Output>>(schema: Schema, row: unknown, context: string): Output;
|
|
132
|
+
export declare function parseRows<Output, Schema extends z.ZodType<Output>>(schema: Schema, rows: unknown[], context: string): Output[];
|
|
133
|
+
export declare function parseFirstRow<Output, Schema extends z.ZodType<Output>>(schema: Schema, rows: unknown[], context: string): Output | undefined;
|
|
134
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/database/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;EASnB,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;EAO/B,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;EAOtC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;EAK9B,CAAC;AAEH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;EAQpB,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;EAKvB,CAAC;AAMH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,SAAS,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAC/D,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,OAAO,EACZ,OAAO,EAAE,MAAM,GACd,MAAM,CAQR;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,SAAS,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAChE,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EAAE,EACf,OAAO,EAAE,MAAM,GACd,MAAM,EAAE,CAQV;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,SAAS,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EACpE,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EAAE,EACf,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,SAAS,CAKpB"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
export interface EventFields {
|
|
2
|
+
sender: string;
|
|
3
|
+
owner: string;
|
|
4
|
+
tickLower: string;
|
|
5
|
+
tickUpper: string;
|
|
6
|
+
liquidity: string;
|
|
7
|
+
amount0: string;
|
|
8
|
+
amount1: string;
|
|
9
|
+
totalLiquidity: string;
|
|
10
|
+
}
|
|
11
|
+
export interface EventData {
|
|
12
|
+
contractAddress: string;
|
|
13
|
+
blockHash: string;
|
|
14
|
+
txId: string;
|
|
15
|
+
eventIndex: number;
|
|
16
|
+
name: string;
|
|
17
|
+
fields: EventFields;
|
|
18
|
+
}
|
|
19
|
+
export type PoolType = 'standard' | 'concentrated';
|
|
20
|
+
export interface PoolRow {
|
|
21
|
+
id: string;
|
|
22
|
+
token0_id: string;
|
|
23
|
+
token1_id: string;
|
|
24
|
+
config_index: number | null;
|
|
25
|
+
pool_type: PoolType;
|
|
26
|
+
is_active: boolean;
|
|
27
|
+
created_at: Date;
|
|
28
|
+
updated_at: Date;
|
|
29
|
+
}
|
|
30
|
+
export interface PoolEvent {
|
|
31
|
+
id: string;
|
|
32
|
+
pool_id: string;
|
|
33
|
+
event_type: string;
|
|
34
|
+
tx_id: string;
|
|
35
|
+
event_data: EventData;
|
|
36
|
+
created_at: Date;
|
|
37
|
+
block_hash: string | null;
|
|
38
|
+
}
|
|
39
|
+
export interface PoolEventCounterRow {
|
|
40
|
+
id: string;
|
|
41
|
+
pool_id: string;
|
|
42
|
+
from_count: number;
|
|
43
|
+
is_active: boolean;
|
|
44
|
+
created_at: Date;
|
|
45
|
+
updated_at: Date;
|
|
46
|
+
}
|
|
47
|
+
export interface PoolFactoryEventCounterRow {
|
|
48
|
+
id: string;
|
|
49
|
+
pool_factory_id: string;
|
|
50
|
+
from_count: number;
|
|
51
|
+
is_active: boolean;
|
|
52
|
+
created_at: Date;
|
|
53
|
+
updated_at: Date;
|
|
54
|
+
}
|
|
55
|
+
export interface OHLCVRow {
|
|
56
|
+
unix_time: string;
|
|
57
|
+
open_price: string;
|
|
58
|
+
high_price: string;
|
|
59
|
+
low_price: string;
|
|
60
|
+
close_price: string;
|
|
61
|
+
volume_base: string;
|
|
62
|
+
volume_quote: string;
|
|
63
|
+
}
|
|
64
|
+
export interface AggregatedOHLCVRow {
|
|
65
|
+
total_volume_base: string | null;
|
|
66
|
+
total_volume_quote: string | null;
|
|
67
|
+
price_min: string | null;
|
|
68
|
+
price_max: string | null;
|
|
69
|
+
}
|
|
70
|
+
export interface PriceTickInsert {
|
|
71
|
+
poolId: string;
|
|
72
|
+
token0Id: string;
|
|
73
|
+
token1Id: string;
|
|
74
|
+
price: string;
|
|
75
|
+
volumeBase: string;
|
|
76
|
+
volumeQuote: string;
|
|
77
|
+
timestamp: number;
|
|
78
|
+
txId: string;
|
|
79
|
+
}
|
|
80
|
+
export interface LiquidityTickInsert {
|
|
81
|
+
poolId: string;
|
|
82
|
+
liquidityChange: string;
|
|
83
|
+
amount0Change: string;
|
|
84
|
+
amount1Change: string;
|
|
85
|
+
totalLiquidity: string;
|
|
86
|
+
reserve0: string;
|
|
87
|
+
reserve1: string;
|
|
88
|
+
timestamp: number;
|
|
89
|
+
txId: string;
|
|
90
|
+
blockHash: string;
|
|
91
|
+
}
|
|
92
|
+
export interface ClmmTickRow {
|
|
93
|
+
pool_id: string;
|
|
94
|
+
tick: string;
|
|
95
|
+
liquidity_gross: string;
|
|
96
|
+
liquidity_net: string;
|
|
97
|
+
}
|
|
98
|
+
export interface ClmmPositionRow {
|
|
99
|
+
id: string;
|
|
100
|
+
pool_id: string;
|
|
101
|
+
config_index: number;
|
|
102
|
+
tx_id: string;
|
|
103
|
+
created_at: Date;
|
|
104
|
+
block_hash: string;
|
|
105
|
+
sender: string;
|
|
106
|
+
owner: string;
|
|
107
|
+
tick_lower: number;
|
|
108
|
+
tick_upper: number;
|
|
109
|
+
liquidity: string;
|
|
110
|
+
amount0: string;
|
|
111
|
+
amount1: string;
|
|
112
|
+
total_liquidity: string;
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/database/types.ts"],"names":[],"mappings":"AAAA,MA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ClB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,IAAI,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;CACzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,cAAc,OAAO,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare class ValidationError extends Error {
|
|
2
|
+
constructor(message: string);
|
|
3
|
+
}
|
|
4
|
+
export declare function isValidationError(error: unknown): error is ValidationError;
|
|
5
|
+
export declare class DataParsingError extends Error {
|
|
6
|
+
constructor(message: string);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/lib/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,eAAgB,SAAQ,KAAK;gBAC5B,OAAO,EAAE,MAAM;CAI5B;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,eAAe,CAE1E;AAED,qBAAa,gBAAiB,SAAQ,KAAK;gBAC7B,OAAO,EAAE,MAAM;CAI5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/lib/logger.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,MAAM,2CAA4B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/lib/validation.ts"],"names":[],"mappings":"AAGA,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,EACb,SAAS,GAAE,MAAkB,GAC5B,OAAO,CAAC,KAAK,IAAI,MAAM,CAMzB;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAa5E"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { Elysia } from 'elysia';
|
|
2
|
+
import type { SwapComputeResult } from '../services/computeService';
|
|
3
|
+
import type { ApiResponse } from './response';
|
|
4
|
+
export interface SwapComputeError {
|
|
5
|
+
id: string;
|
|
6
|
+
success: false;
|
|
7
|
+
msg: string;
|
|
8
|
+
data: undefined;
|
|
9
|
+
}
|
|
10
|
+
export interface SwapComputeSuccess {
|
|
11
|
+
id: string;
|
|
12
|
+
success: true;
|
|
13
|
+
msg?: undefined;
|
|
14
|
+
data: SwapComputeResult;
|
|
15
|
+
}
|
|
16
|
+
export type SwapComputeResponse = SwapComputeSuccess | SwapComputeError;
|
|
17
|
+
export declare const computeRouter: Elysia<"/compute", {
|
|
18
|
+
decorator: {};
|
|
19
|
+
store: {};
|
|
20
|
+
derive: {};
|
|
21
|
+
resolve: {};
|
|
22
|
+
}, {
|
|
23
|
+
typebox: {};
|
|
24
|
+
error: {};
|
|
25
|
+
}, {
|
|
26
|
+
schema: {};
|
|
27
|
+
standaloneSchema: {};
|
|
28
|
+
macro: {};
|
|
29
|
+
macroFn: {};
|
|
30
|
+
parser: {};
|
|
31
|
+
response: {};
|
|
32
|
+
}, {
|
|
33
|
+
compute: {
|
|
34
|
+
"swap-base-in": {
|
|
35
|
+
get: {
|
|
36
|
+
body: unknown;
|
|
37
|
+
params: {};
|
|
38
|
+
query: {
|
|
39
|
+
slippageBps?: string | undefined;
|
|
40
|
+
poolType: "standard" | "concentrated";
|
|
41
|
+
inputMint: string;
|
|
42
|
+
outputMint: string;
|
|
43
|
+
amount: string;
|
|
44
|
+
};
|
|
45
|
+
headers: unknown;
|
|
46
|
+
response: {
|
|
47
|
+
200: ApiResponse<SwapComputeResult>;
|
|
48
|
+
422: {
|
|
49
|
+
type: "validation";
|
|
50
|
+
on: string;
|
|
51
|
+
summary?: string;
|
|
52
|
+
message?: string;
|
|
53
|
+
found?: unknown;
|
|
54
|
+
property?: string;
|
|
55
|
+
expected?: string;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
} & {
|
|
62
|
+
compute: {
|
|
63
|
+
"swap-base-out": {
|
|
64
|
+
get: {
|
|
65
|
+
body: unknown;
|
|
66
|
+
params: {};
|
|
67
|
+
query: {
|
|
68
|
+
slippageBps?: string | undefined;
|
|
69
|
+
poolType: "standard" | "concentrated";
|
|
70
|
+
inputMint: string;
|
|
71
|
+
outputMint: string;
|
|
72
|
+
amount: string;
|
|
73
|
+
};
|
|
74
|
+
headers: unknown;
|
|
75
|
+
response: {
|
|
76
|
+
200: ApiResponse<SwapComputeResult>;
|
|
77
|
+
422: {
|
|
78
|
+
type: "validation";
|
|
79
|
+
on: string;
|
|
80
|
+
summary?: string;
|
|
81
|
+
message?: string;
|
|
82
|
+
found?: unknown;
|
|
83
|
+
property?: string;
|
|
84
|
+
expected?: string;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
}, {
|
|
91
|
+
derive: {};
|
|
92
|
+
resolve: {};
|
|
93
|
+
schema: {};
|
|
94
|
+
standaloneSchema: {};
|
|
95
|
+
response: {};
|
|
96
|
+
}, {
|
|
97
|
+
derive: {};
|
|
98
|
+
resolve: {};
|
|
99
|
+
schema: {};
|
|
100
|
+
standaloneSchema: {};
|
|
101
|
+
response: {};
|
|
102
|
+
}>;
|
|
103
|
+
//# sourceMappingURL=compute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compute.d.ts","sourceRoot":"","sources":["../../../src/routes/compute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAK,MAAM,QAAQ,CAAC;AACnC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAI9C,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,KAAK,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,SAAS,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,IAAI,CAAC;IACd,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,iBAAiB,CAAC;CACzB;AAED,MAAM,MAAM,mBAAmB,GAAG,kBAAkB,GAAG,gBAAgB,CAAC;AAIxE,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqFvB,CAAC"}
|