@sui-tracker/shared 1.0.94 → 1.0.96
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/modules/grpc-services/token-grpc.service.d.ts +3 -1
- package/dist/modules/grpc-services/token-grpc.service.js +26 -0
- package/dist/modules/grpc-services/token-grpc.service.js.map +1 -1
- package/dist/modules/interfaces/index.d.ts +0 -1
- package/dist/modules/interfaces/index.js +0 -1
- package/dist/modules/interfaces/index.js.map +1 -1
- package/dist/modules/interfaces/swap-order.interface.d.ts +37 -1
- package/dist/protos/swap-order.proto +47 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ClientGrpc } from "@nestjs/microservices";
|
|
2
|
-
import { GetTrendingTokensRequest, GetTrendingTokensResponse, GetTopVolumeTokensRequest, GetTopVolumeTokensResponse, GetTokensRequest, GetTokensResponse, SearchTokensRequest, SearchTokensResponse } from "../interfaces/swap-order.interface";
|
|
2
|
+
import { GetTrendingTokensRequest, GetTrendingTokensResponse, GetTopVolumeTokensRequest, GetTopVolumeTokensResponse, GetTokensRequest, GetTokensResponse, SearchTokensRequest, SearchTokensResponse, GetTokenChartRequest, GetTokenChartResponse, GetTokenTransactionsRequest, GetTokenTransactionsResponse } from "../interfaces/swap-order.interface";
|
|
3
3
|
export declare class TokenGrpcService {
|
|
4
4
|
private grpcClient;
|
|
5
5
|
private readonly logger;
|
|
@@ -8,4 +8,6 @@ export declare class TokenGrpcService {
|
|
|
8
8
|
getTopVolumeTokens(data: GetTopVolumeTokensRequest): Promise<GetTopVolumeTokensResponse>;
|
|
9
9
|
getTokens(data: GetTokensRequest): Promise<GetTokensResponse>;
|
|
10
10
|
searchTokens(data: SearchTokensRequest): Promise<SearchTokensResponse>;
|
|
11
|
+
getTokenChart(data: GetTokenChartRequest): Promise<GetTokenChartResponse>;
|
|
12
|
+
getTokenTransactions(data: GetTokenTransactionsRequest): Promise<GetTokenTransactionsResponse>;
|
|
11
13
|
}
|
|
@@ -72,6 +72,32 @@ let TokenGrpcService = TokenGrpcService_1 = class TokenGrpcService {
|
|
|
72
72
|
}
|
|
73
73
|
return res;
|
|
74
74
|
}
|
|
75
|
+
async getTokenChart(data) {
|
|
76
|
+
const swapOrderService = this.grpcClient.getService("SwapOrderService");
|
|
77
|
+
const res = await new Promise((resolve, reject) => {
|
|
78
|
+
swapOrderService.getTokenChart(data).subscribe({
|
|
79
|
+
next: (response) => resolve(response),
|
|
80
|
+
error: (error) => reject(error),
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
if (!res.success) {
|
|
84
|
+
throw new Error(res.message);
|
|
85
|
+
}
|
|
86
|
+
return res;
|
|
87
|
+
}
|
|
88
|
+
async getTokenTransactions(data) {
|
|
89
|
+
const swapOrderService = this.grpcClient.getService("SwapOrderService");
|
|
90
|
+
const res = await new Promise((resolve, reject) => {
|
|
91
|
+
swapOrderService.getTokenTransactions(data).subscribe({
|
|
92
|
+
next: (response) => resolve(response),
|
|
93
|
+
error: (error) => reject(error),
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
if (!res.success) {
|
|
97
|
+
throw new Error(res.message);
|
|
98
|
+
}
|
|
99
|
+
return res;
|
|
100
|
+
}
|
|
75
101
|
};
|
|
76
102
|
exports.TokenGrpcService = TokenGrpcService;
|
|
77
103
|
exports.TokenGrpcService = TokenGrpcService = TokenGrpcService_1 = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-grpc.service.js","sourceRoot":"","sources":["../../../src/modules/grpc-services/token-grpc.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA0E;
|
|
1
|
+
{"version":3,"file":"token-grpc.service.js","sourceRoot":"","sources":["../../../src/modules/grpc-services/token-grpc.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA0E;AAoBnE,IAAM,gBAAgB,wBAAtB,MAAM,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AC;QAEF,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC/B,CAAC;QAED,OAAO,GAAG,CAAC;IACb,CAAC;CACF,CAAA;AA/IY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;IAIE,WAAA,IAAA,eAAM,EAAC,YAAY,CAAC,CAAA;;GAHtB,gBAAgB,CA+I5B"}
|
|
@@ -14,7 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./account.interface"), exports);
|
|
18
17
|
__exportStar(require("./checkpoint.interface"), exports);
|
|
19
18
|
__exportStar(require("./proxy.interface"), exports);
|
|
20
19
|
__exportStar(require("./swap-order.interface"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAsC;AACtC,oDAAiC;AACjC,yDAAsC;AACtC,oDAAiC;AACjC,8DAA2C;AAC3C,+DAA4C"}
|
|
@@ -147,13 +147,25 @@ export interface SwapOrderData {
|
|
|
147
147
|
price: string;
|
|
148
148
|
volume: string;
|
|
149
149
|
transactionHash: string;
|
|
150
|
-
|
|
150
|
+
timestamp: number;
|
|
151
151
|
type: 'swap' | 'createPool' | 'addLiquidity' | 'removeLiquidity';
|
|
152
152
|
a2b: 'A2B' | 'B2A';
|
|
153
153
|
amountA: string;
|
|
154
154
|
amountB: string;
|
|
155
155
|
liquidity?: string | null;
|
|
156
156
|
}
|
|
157
|
+
export interface TokenSwapData {
|
|
158
|
+
tokenAddress: string;
|
|
159
|
+
timestamp: number;
|
|
160
|
+
price: string;
|
|
161
|
+
amount: string;
|
|
162
|
+
otherAmount: string;
|
|
163
|
+
otherAddress: string;
|
|
164
|
+
volume: string;
|
|
165
|
+
transactionHash: string;
|
|
166
|
+
trader: string;
|
|
167
|
+
dex: string;
|
|
168
|
+
}
|
|
157
169
|
export interface GetLastSwapOrderRequest {
|
|
158
170
|
poolAddress: string;
|
|
159
171
|
toTime: number;
|
|
@@ -256,6 +268,28 @@ export interface GetListTokensResponse extends BaseResponse {
|
|
|
256
268
|
data: TokenData[];
|
|
257
269
|
total: number;
|
|
258
270
|
}
|
|
271
|
+
export interface GetTokenChartRequest {
|
|
272
|
+
tokenAddress: string;
|
|
273
|
+
resolution: number;
|
|
274
|
+
limit: number;
|
|
275
|
+
endTime: number;
|
|
276
|
+
type?: 'usd' | 'token';
|
|
277
|
+
}
|
|
278
|
+
export interface GetTokenChartResponse extends BaseResponse {
|
|
279
|
+
data: CandleData[];
|
|
280
|
+
}
|
|
281
|
+
export interface GetTokenTransactionsRequest {
|
|
282
|
+
tokenAddress: string;
|
|
283
|
+
toTime: number;
|
|
284
|
+
limit?: number;
|
|
285
|
+
minAmount?: number;
|
|
286
|
+
maxAmount?: number;
|
|
287
|
+
minVolume?: number;
|
|
288
|
+
maxVolume?: number;
|
|
289
|
+
}
|
|
290
|
+
export interface GetTokenTransactionsResponse extends BaseResponse {
|
|
291
|
+
data: TokenSwapData[];
|
|
292
|
+
}
|
|
259
293
|
export interface SwapOrderService {
|
|
260
294
|
GetListPools(request: GetListPoolsRequest): Observable<GetListPoolsResponse>;
|
|
261
295
|
getPool(request: GetPoolRequest): Observable<GetPoolResponse>;
|
|
@@ -270,4 +304,6 @@ export interface SwapOrderService {
|
|
|
270
304
|
searchPool(request: SearchPoolRequest): Observable<SearchPoolResponse>;
|
|
271
305
|
searchTokens(request: SearchTokensRequest): Observable<SearchTokensResponse>;
|
|
272
306
|
getListTokens(request: GetListTokensRequest): Observable<GetListTokensResponse>;
|
|
307
|
+
getTokenChart(request: GetTokenChartRequest): Observable<GetTokenChartResponse>;
|
|
308
|
+
getTokenTransactions(request: GetTokenTransactionsRequest): Observable<GetTokenTransactionsResponse>;
|
|
273
309
|
}
|
|
@@ -18,6 +18,8 @@ service SwapOrderService {
|
|
|
18
18
|
rpc SearchPool (SearchPoolRequest) returns (SearchPoolResponse);
|
|
19
19
|
rpc SearchTokens (SearchTokensRequest) returns (SearchTokensResponse);
|
|
20
20
|
rpc GetListTokens (GetListTokensRequest) returns (GetListTokensResponse);
|
|
21
|
+
rpc GetTokenChart (GetTokenChartRequest) returns (GetTokenChartResponse);
|
|
22
|
+
rpc GetTokenTransactions (GetTokenTransactionsRequest) returns (GetTokenTransactionsResponse);
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
// Token data structure matching TokenData interface
|
|
@@ -142,7 +144,7 @@ message SwapOrderData {
|
|
|
142
144
|
string price = 5; // Decimal(18, 9)
|
|
143
145
|
string volume = 6; // Decimal(18, 9)
|
|
144
146
|
string transactionHash = 7; // FixedString(66)
|
|
145
|
-
int32
|
|
147
|
+
int32 timestamp = 8; // timestamp
|
|
146
148
|
string type = 9; // Enum8: 'swap' | 'createPool' | 'addLiquidity' | 'removeLiquidity'
|
|
147
149
|
string a2b = 10; // Enum8: 'A2B' | 'B2A'
|
|
148
150
|
string amountA = 11; // UInt64
|
|
@@ -150,6 +152,20 @@ message SwapOrderData {
|
|
|
150
152
|
optional string liquidity = 13; // Nullable(UInt64)
|
|
151
153
|
}
|
|
152
154
|
|
|
155
|
+
// Token swap data structure for token_swaps table
|
|
156
|
+
message TokenSwapData {
|
|
157
|
+
string tokenAddress = 1; // LowCardinality(String)
|
|
158
|
+
int32 timestamp = 2; // DateTime as Unix timestamp
|
|
159
|
+
string price = 3; // Decimal(36, 18)
|
|
160
|
+
string amount = 4; // Decimal(30, 9)
|
|
161
|
+
string otherAmount = 5; // Decimal(30, 9)
|
|
162
|
+
string otherAddress = 6; // LowCardinality(String)
|
|
163
|
+
string volume = 7; // Decimal(30, 9)
|
|
164
|
+
string transactionHash = 8; // FixedString(44)
|
|
165
|
+
string trader = 9; // LowCardinality(String)
|
|
166
|
+
string dex = 10; // String
|
|
167
|
+
}
|
|
168
|
+
|
|
153
169
|
// Trending token data structure
|
|
154
170
|
message TrendingTokenData {
|
|
155
171
|
string id = 1;
|
|
@@ -300,6 +316,24 @@ message GetListTokensRequest {
|
|
|
300
316
|
optional GetListTokensFilter filter = 5;
|
|
301
317
|
}
|
|
302
318
|
|
|
319
|
+
message GetTokenChartRequest {
|
|
320
|
+
string tokenAddress = 1;
|
|
321
|
+
int32 resolution = 2;
|
|
322
|
+
int32 limit = 3;
|
|
323
|
+
int64 endTime = 4;
|
|
324
|
+
optional string type = 5; // 'usd' | 'token' (optional, defaults to token price)
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
message GetTokenTransactionsRequest {
|
|
328
|
+
string tokenAddress = 1;
|
|
329
|
+
int32 toTime = 2;
|
|
330
|
+
optional int32 limit = 3;
|
|
331
|
+
optional double minAmount = 4;
|
|
332
|
+
optional double maxAmount = 5;
|
|
333
|
+
optional double minVolume = 6;
|
|
334
|
+
optional double maxVolume = 7;
|
|
335
|
+
}
|
|
336
|
+
|
|
303
337
|
// Pool trader stats data structure matching PoolTraderStatsData interface
|
|
304
338
|
message PoolTraderStatsData {
|
|
305
339
|
string trader = 1;
|
|
@@ -401,4 +435,16 @@ message GetListTokensResponse {
|
|
|
401
435
|
bool success = 1;
|
|
402
436
|
string message = 2;
|
|
403
437
|
Data data = 3;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
message GetTokenChartResponse {
|
|
441
|
+
bool success = 1;
|
|
442
|
+
string message = 2;
|
|
443
|
+
repeated CandleData data = 3;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
message GetTokenTransactionsResponse {
|
|
447
|
+
bool success = 1;
|
|
448
|
+
string message = 2;
|
|
449
|
+
repeated TokenSwapData data = 3;
|
|
404
450
|
}
|