@sui-tracker/shared 1.0.56 → 1.0.57
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/index.d.ts +1 -0
- package/dist/modules/grpc-services/index.js +1 -0
- package/dist/modules/grpc-services/index.js.map +1 -1
- package/dist/modules/grpc-services/token-grpc.service.d.ts +9 -0
- package/dist/modules/grpc-services/token-grpc.service.js +56 -0
- package/dist/modules/grpc-services/token-grpc.service.js.map +1 -0
- package/dist/modules/interfaces/swap-order.interface.d.ts +29 -0
- package/dist/modules/shared.module.js +2 -0
- package/dist/modules/shared.module.js.map +1 -1
- package/dist/protos/swap-order.proto +41 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -20,4 +20,5 @@ __exportStar(require("./proxy-grpc.service"), exports);
|
|
|
20
20
|
__exportStar(require("./swap-order-grpc.service"), exports);
|
|
21
21
|
__exportStar(require("./price-grpc.service"), exports);
|
|
22
22
|
__exportStar(require("./data-center-grpc.service"), exports);
|
|
23
|
+
__exportStar(require("./token-grpc.service"), exports);
|
|
23
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/grpc-services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,4DAA0C;AAC1C,uDAAqC;AACrC,4DAA0C;AAC1C,uDAAqC;AACrC,6DAA2C"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/grpc-services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,4DAA0C;AAC1C,uDAAqC;AACrC,4DAA0C;AAC1C,uDAAqC;AACrC,6DAA2C;AAC3C,uDAAqC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ClientGrpc } from "@nestjs/microservices";
|
|
2
|
+
import { GetTrendingTokensRequest, GetTrendingTokensResponse, GetTopVolumeTokensRequest, GetTopVolumeTokensResponse } from "../interfaces/swap-order.interface";
|
|
3
|
+
export declare class TokenGrpcService {
|
|
4
|
+
private grpcClient;
|
|
5
|
+
private readonly logger;
|
|
6
|
+
constructor(grpcClient: ClientGrpc);
|
|
7
|
+
getTrendingTokens(data: GetTrendingTokensRequest): Promise<GetTrendingTokensResponse>;
|
|
8
|
+
getTopVolumeTokens(data: GetTopVolumeTokensRequest): Promise<GetTopVolumeTokensResponse>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
var TokenGrpcService_1;
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.TokenGrpcService = void 0;
|
|
17
|
+
const common_1 = require("@nestjs/common");
|
|
18
|
+
let TokenGrpcService = TokenGrpcService_1 = class TokenGrpcService {
|
|
19
|
+
constructor(grpcClient) {
|
|
20
|
+
this.grpcClient = grpcClient;
|
|
21
|
+
this.logger = new common_1.Logger(TokenGrpcService_1.name);
|
|
22
|
+
}
|
|
23
|
+
async getTrendingTokens(data) {
|
|
24
|
+
const swapOrderService = this.grpcClient.getService("SwapOrderService");
|
|
25
|
+
const res = await new Promise((resolve, reject) => {
|
|
26
|
+
swapOrderService.trendingTokens(data).subscribe({
|
|
27
|
+
next: (response) => resolve(response),
|
|
28
|
+
error: (error) => reject(error),
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
if (!res.success) {
|
|
32
|
+
throw new Error(res.message);
|
|
33
|
+
}
|
|
34
|
+
return res;
|
|
35
|
+
}
|
|
36
|
+
async getTopVolumeTokens(data) {
|
|
37
|
+
const swapOrderService = this.grpcClient.getService("SwapOrderService");
|
|
38
|
+
const res = await new Promise((resolve, reject) => {
|
|
39
|
+
swapOrderService.topVolumeTokens(data).subscribe({
|
|
40
|
+
next: (response) => resolve(response),
|
|
41
|
+
error: (error) => reject(error),
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
if (!res.success) {
|
|
45
|
+
throw new Error(res.message);
|
|
46
|
+
}
|
|
47
|
+
return res;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
exports.TokenGrpcService = TokenGrpcService;
|
|
51
|
+
exports.TokenGrpcService = TokenGrpcService = TokenGrpcService_1 = __decorate([
|
|
52
|
+
(0, common_1.Injectable)(),
|
|
53
|
+
__param(0, (0, common_1.Inject)("SWAP_ORDER")),
|
|
54
|
+
__metadata("design:paramtypes", [Object])
|
|
55
|
+
], TokenGrpcService);
|
|
56
|
+
//# sourceMappingURL=token-grpc.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-grpc.service.js","sourceRoot":"","sources":["../../../src/modules/grpc-services/token-grpc.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA0E;AAYnE,IAAM,gBAAgB,wBAAtB,MAAM,gBAAgB;IAG3B,YAAkC,UAA8B;QAAtB,eAAU,GAAV,UAA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M,IAAI,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC/B,CAAC;QAED,OAAO,GAAG,CAAC;IACb,CAAC;CACF,CAAA;AAjDY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;IAIE,WAAA,IAAA,eAAM,EAAC,YAAY,CAAC,CAAA;;GAHtB,gBAAgB,CAiD5B"}
|
|
@@ -45,6 +45,7 @@ export interface GetNewPoolsRequest {
|
|
|
45
45
|
}
|
|
46
46
|
export interface GetPoolRequest {
|
|
47
47
|
id: string;
|
|
48
|
+
label: number;
|
|
48
49
|
}
|
|
49
50
|
export interface GetCandleChartRequest {
|
|
50
51
|
pool: string;
|
|
@@ -89,10 +90,38 @@ export interface GetLastSwapOrderRequest {
|
|
|
89
90
|
export interface GetLastSwapOrderResponse extends BaseResponse {
|
|
90
91
|
data: SwapOrderData[];
|
|
91
92
|
}
|
|
93
|
+
export interface GetTrendingTokensRequest {
|
|
94
|
+
label: number;
|
|
95
|
+
}
|
|
96
|
+
export interface GetTrendingTokensResponse extends BaseResponse {
|
|
97
|
+
data: {
|
|
98
|
+
id: string;
|
|
99
|
+
name?: string | null;
|
|
100
|
+
symbol?: string | null;
|
|
101
|
+
address?: string | null;
|
|
102
|
+
decimals?: number | null;
|
|
103
|
+
iconUrl?: string | null;
|
|
104
|
+
isActive?: boolean | null;
|
|
105
|
+
totalSupply?: string | null;
|
|
106
|
+
description?: string | null;
|
|
107
|
+
volume: string;
|
|
108
|
+
txs: string;
|
|
109
|
+
currentPrice: string;
|
|
110
|
+
oldPrice: string;
|
|
111
|
+
score: string;
|
|
112
|
+
}[];
|
|
113
|
+
}
|
|
114
|
+
export interface GetTopVolumeTokensRequest {
|
|
115
|
+
label: number;
|
|
116
|
+
}
|
|
117
|
+
export interface GetTopVolumeTokensResponse extends GetTrendingTokensResponse {
|
|
118
|
+
}
|
|
92
119
|
export interface SwapOrderService {
|
|
93
120
|
getTrendingPools(request: GetTrendingPoolsRequest): Observable<GetTrendingPoolsResponse>;
|
|
94
121
|
getNewPools(request: GetNewPoolsRequest): Observable<GetNewPoolsResponse>;
|
|
95
122
|
getPool(request: GetPoolRequest): Observable<GetPoolResponse>;
|
|
96
123
|
getCandleChart(request: GetCandleChartRequest): Observable<GetCandleChartResponse>;
|
|
97
124
|
getLastSwapOrder(request: GetLastSwapOrderRequest): Observable<GetLastSwapOrderResponse>;
|
|
125
|
+
trendingTokens(request: GetTrendingTokensRequest): Observable<GetTrendingTokensResponse>;
|
|
126
|
+
topVolumeTokens(request: GetTopVolumeTokensRequest): Observable<GetTopVolumeTokensResponse>;
|
|
98
127
|
}
|
|
@@ -21,6 +21,7 @@ const dotenv_1 = require("dotenv");
|
|
|
21
21
|
const internal_token_service_1 = require("./common-service/internal-token.service");
|
|
22
22
|
const core_1 = require("@nestjs/core");
|
|
23
23
|
const grpc_metadata_service_1 = require("./grpc-services/grpc-metadata.service");
|
|
24
|
+
const grpc_services_1 = require("./grpc-services");
|
|
24
25
|
(0, dotenv_1.config)();
|
|
25
26
|
const providers = [
|
|
26
27
|
sui_client_service_1.SuiClientService,
|
|
@@ -33,6 +34,7 @@ const providers = [
|
|
|
33
34
|
internal_token_service_1.InternalTokenService,
|
|
34
35
|
core_1.Reflector,
|
|
35
36
|
grpc_metadata_service_1.GrpcMetadataService,
|
|
37
|
+
grpc_services_1.TokenGrpcService,
|
|
36
38
|
];
|
|
37
39
|
let SharedModule = class SharedModule {
|
|
38
40
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.module.js","sourceRoot":"","sources":["../../src/modules/shared.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAsD;AAEtD,6DAAuD;AACvD,+EAAyE;AACzE,2EAAqE;AACrE,qFAA+E;AAC/E,qFAA8E;AAC9E,yDAAgE;AAChE,+BAA2B;AAC3B,2EAAqE;AACrE,uFAAgF;AAChF,mCAAgC;AAChC,oFAA8E;AAC9E,uCAAwC;AACxC,iFAA2E;
|
|
1
|
+
{"version":3,"file":"shared.module.js","sourceRoot":"","sources":["../../src/modules/shared.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAsD;AAEtD,6DAAuD;AACvD,+EAAyE;AACzE,2EAAqE;AACrE,qFAA+E;AAC/E,qFAA8E;AAC9E,yDAAgE;AAChE,+BAA2B;AAC3B,2EAAqE;AACrE,uFAAgF;AAChF,mCAAgC;AAChC,oFAA8E;AAC9E,uCAAwC;AACxC,iFAA2E;AAC3E,mDAAkD;AAElD,IAAA,eAAM,GAAE,CAAC;AAET,MAAM,SAAS,GAAe;IAC5B,qCAAgB;IAChB,yCAAkB;IAClB,qCAAgB;IAChB,+CAAqB;IACrB,8CAAoB;IACpB,qCAAgB;IAChB,gDAAqB;IACrB,6CAAoB;IACpB,gBAAS;IACT,2CAAmB;IACnB,gCAAgB;CACjB,CAAA;AA+DM,IAAM,YAAY,GAAlB,MAAM,YAAY;CAAI,CAAA;AAAhB,oCAAY;uBAAZ,YAAY;IA7DxB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,6BAAa,CAAC,QAAQ,CAAC;gBACrB;oBACE,IAAI,EAAE,OAAO;oBACb,SAAS,EAAE,yBAAS,CAAC,IAAI;oBACzB,OAAO,EAAE;wBACP,OAAO,EAAE,OAAO;wBAChB,SAAS,EAAE,IAAA,WAAI,EAAC,SAAS,EAAE,uBAAuB,CAAC;wBACnD,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,iBAAiB;qBACxD;iBACF,EAAE;oBACD,IAAI,EAAE,iBAAiB;oBACvB,SAAS,EAAE,yBAAS,CAAC,IAAI;oBACzB,OAAO,EAAE;wBACP,OAAO,EAAE,iBAAiB;wBAC1B,SAAS,EAAE,IAAA,WAAI,EAAC,SAAS,EAAE,iCAAiC,CAAC;wBAC7D,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,2BAA2B,IAAI,iBAAiB;qBAClE;iBACF;gBACD;oBACE,IAAI,EAAE,SAAS;oBACf,SAAS,EAAE,yBAAS,CAAC,IAAI;oBACzB,OAAO,EAAE;wBACP,OAAO,EAAE,SAAS;wBAClB,SAAS,EAAE,IAAA,WAAI,EAAC,SAAS,EAAE,yBAAyB,CAAC;wBACrD,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,iBAAiB;qBAC1D;iBACF;gBACD;oBACE,IAAI,EAAE,YAAY;oBAClB,SAAS,EAAE,yBAAS,CAAC,IAAI;oBACzB,OAAO,EAAE;wBACP,OAAO,EAAE,YAAY;wBACrB,SAAS,EAAE,IAAA,WAAI,EAAC,SAAS,EAAE,4BAA4B,CAAC;wBACxD,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,sBAAsB,IAAI,iBAAiB;qBAC7D;iBACF;gBACD;oBACE,IAAI,EAAE,YAAY;oBAClB,SAAS,EAAE,yBAAS,CAAC,IAAI;oBACzB,OAAO,EAAE;wBACP,OAAO,EAAE,YAAY;wBACrB,SAAS,EAAE,IAAA,WAAI,EAAC,SAAS,EAAE,4BAA4B,CAAC;wBACxD,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,sBAAsB,IAAI,iBAAiB;qBAC7D;iBACF;gBACD;oBACE,IAAI,EAAE,OAAO;oBACb,SAAS,EAAE,yBAAS,CAAC,IAAI;oBACzB,OAAO,EAAE;wBACP,OAAO,EAAE,OAAO;wBAChB,SAAS,EAAE,IAAA,WAAI,EAAC,SAAS,EAAE,uBAAuB,CAAC;wBACnD,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,iBAAiB;qBACxD;iBACF;aACF,CAAC;SACH;QACD,SAAS;QACT,OAAO,EAAE,CAAC,GAAG,SAAS,CAAC;KACxB,CAAC;GACW,YAAY,CAAI"}
|
|
@@ -9,6 +9,8 @@ service SwapOrderService {
|
|
|
9
9
|
rpc GetPool (GetPoolRequest) returns (GetPoolResponse);
|
|
10
10
|
rpc GetCandleChart (GetCandleChartRequest) returns (GetCandleChartResponse);
|
|
11
11
|
rpc GetLastSwapOrder (GetLastSwapOrderRequest) returns (GetLastSwapOrderResponse);
|
|
12
|
+
rpc TrendingTokens (GetTrendingTokensRequest) returns (GetTrendingTokensResponse);
|
|
13
|
+
rpc TopVolumeTokens (GetTopVolumeTokensRequest) returns (GetTopVolumeTokensResponse);
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
// Token data structure matching TokenData interface
|
|
@@ -36,7 +38,6 @@ message PoolData {
|
|
|
36
38
|
string totalTx = 8;
|
|
37
39
|
string score = 9;
|
|
38
40
|
string currentPrice = 10;
|
|
39
|
-
string price = 11;
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
// Candle data structure matching CandleData interface
|
|
@@ -71,6 +72,24 @@ message SwapOrderData {
|
|
|
71
72
|
string swapAt = 13;
|
|
72
73
|
}
|
|
73
74
|
|
|
75
|
+
// Trending token data structure
|
|
76
|
+
message TrendingTokenData {
|
|
77
|
+
string id = 1;
|
|
78
|
+
optional string name = 2;
|
|
79
|
+
optional string symbol = 3;
|
|
80
|
+
optional string address = 4;
|
|
81
|
+
optional int32 decimals = 5;
|
|
82
|
+
optional string iconUrl = 6;
|
|
83
|
+
optional bool isActive = 7;
|
|
84
|
+
optional string totalSupply = 8;
|
|
85
|
+
optional string description = 9;
|
|
86
|
+
string volume = 10;
|
|
87
|
+
string txs = 11;
|
|
88
|
+
string currentPrice = 12;
|
|
89
|
+
string oldPrice = 13;
|
|
90
|
+
string score = 14;
|
|
91
|
+
}
|
|
92
|
+
|
|
74
93
|
// Request messages matching TypeScript interfaces
|
|
75
94
|
message GetTrendingPoolsRequest {
|
|
76
95
|
int32 label = 1; // 5 | 60 | 360 | 1440
|
|
@@ -82,6 +101,7 @@ message GetNewPoolsRequest {
|
|
|
82
101
|
|
|
83
102
|
message GetPoolRequest {
|
|
84
103
|
string id = 1;
|
|
104
|
+
int32 label = 2; // 5 | 60 | 360 | 1440
|
|
85
105
|
}
|
|
86
106
|
|
|
87
107
|
message GetCandleChartRequest {
|
|
@@ -99,6 +119,14 @@ message GetLastSwapOrderRequest {
|
|
|
99
119
|
optional int32 page = 5;
|
|
100
120
|
}
|
|
101
121
|
|
|
122
|
+
message GetTrendingTokensRequest {
|
|
123
|
+
int32 label = 1; // 5 | 60 | 360 | 1440
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
message GetTopVolumeTokensRequest {
|
|
127
|
+
int32 label = 1; // 5 | 60 | 360 | 1440
|
|
128
|
+
}
|
|
129
|
+
|
|
102
130
|
// Response messages matching TypeScript interfaces with BaseResponse structure
|
|
103
131
|
message GetTrendingPoolsResponse {
|
|
104
132
|
bool success = 1;
|
|
@@ -128,4 +156,16 @@ message GetLastSwapOrderResponse {
|
|
|
128
156
|
bool success = 1;
|
|
129
157
|
string message = 2;
|
|
130
158
|
repeated SwapOrderData data = 3;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
message GetTrendingTokensResponse {
|
|
162
|
+
bool success = 1;
|
|
163
|
+
string message = 2;
|
|
164
|
+
repeated TrendingTokenData data = 3;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
message GetTopVolumeTokensResponse {
|
|
168
|
+
bool success = 1;
|
|
169
|
+
string message = 2;
|
|
170
|
+
repeated TrendingTokenData data = 3;
|
|
131
171
|
}
|