@sui-tracker/shared 1.0.33 → 1.0.35
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/.env +1 -0
- package/dist/grpc/controllers/base-grpc.controller.d.ts +7 -0
- package/dist/grpc/controllers/base-grpc.controller.js +42 -0
- package/dist/grpc/controllers/base-grpc.controller.js.map +1 -0
- package/dist/grpc/controllers/index.d.ts +1 -0
- package/dist/{decorators → grpc/controllers}/index.js +1 -1
- package/dist/grpc/controllers/index.js.map +1 -0
- package/dist/grpc/decorators/index.d.ts +0 -0
- package/dist/grpc/decorators/index.js +2 -0
- package/dist/grpc/decorators/index.js.map +1 -0
- package/dist/grpc/index.d.ts +3 -0
- package/dist/grpc/index.js +20 -0
- package/dist/grpc/index.js.map +1 -0
- package/dist/grpc/interfaces/account.interface.d.ts +175 -0
- package/dist/grpc/interfaces/account.interface.js +3 -0
- package/dist/grpc/interfaces/account.interface.js.map +1 -0
- package/dist/grpc/interfaces/checkpoint.interface.d.ts +63 -0
- package/dist/grpc/interfaces/checkpoint.interface.js +3 -0
- package/dist/grpc/interfaces/checkpoint.interface.js.map +1 -0
- package/dist/grpc/interfaces/index.d.ts +4 -0
- package/dist/grpc/interfaces/index.js +21 -0
- package/dist/grpc/interfaces/index.js.map +1 -0
- package/dist/grpc/interfaces/proxy.interface.d.ts +51 -0
- package/dist/grpc/interfaces/proxy.interface.js +3 -0
- package/dist/grpc/interfaces/proxy.interface.js.map +1 -0
- package/dist/grpc/interfaces/swap-order.interface.d.ts +61 -0
- package/dist/grpc/interfaces/swap-order.interface.js +3 -0
- package/dist/grpc/interfaces/swap-order.interface.js.map +1 -0
- package/dist/grpc/interfaces/swap.interface.d.ts +71 -0
- package/dist/{types.js → grpc/interfaces/swap.interface.js} +1 -1
- package/dist/grpc/interfaces/swap.interface.js.map +1 -0
- package/dist/grpc/services/account-grpc.service.d.ts +20 -0
- package/dist/grpc/services/account-grpc.service.js +134 -0
- package/dist/grpc/services/account-grpc.service.js.map +1 -0
- package/dist/grpc/services/base-grpc.service.d.ts +17 -0
- package/dist/grpc/services/base-grpc.service.js +44 -0
- package/dist/grpc/services/base-grpc.service.js.map +1 -0
- package/dist/grpc/services/checkpoint-grpc.service.d.ts +13 -0
- package/dist/grpc/services/checkpoint-grpc.service.js +77 -0
- package/dist/grpc/services/checkpoint-grpc.service.js.map +1 -0
- package/dist/grpc/services/index.d.ts +5 -0
- package/dist/grpc/services/index.js +22 -0
- package/dist/grpc/services/index.js.map +1 -0
- package/dist/grpc/services/proxy-grpc.service.d.ts +12 -0
- package/dist/grpc/services/proxy-grpc.service.js +68 -0
- package/dist/grpc/services/proxy-grpc.service.js.map +1 -0
- package/dist/grpc/services/swap-order-grpc.service.d.ts +13 -0
- package/dist/grpc/services/swap-order-grpc.service.js +77 -0
- package/dist/grpc/services/swap-order-grpc.service.js.map +1 -0
- package/dist/index.d.ts +6 -5
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/protos/account.proto +202 -0
- package/dist/protos/checkpoint.proto +97 -0
- package/dist/protos/proxy.proto +61 -0
- package/dist/protos/swap-order.proto +82 -0
- package/dist/services/shared.module.js +11 -1
- package/dist/services/shared.module.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -2
- package/dist/commons/dto/abstract.dto.d.ts +0 -12
- package/dist/commons/dto/abstract.dto.js +0 -42
- package/dist/commons/dto/abstract.dto.js.map +0 -1
- package/dist/decorators/field.decorators.d.ts +0 -50
- package/dist/decorators/field.decorators.js +0 -291
- package/dist/decorators/field.decorators.js.map +0 -1
- package/dist/decorators/http.decorators.d.ts +0 -6
- package/dist/decorators/http.decorators.js +0 -18
- package/dist/decorators/http.decorators.js.map +0 -1
- package/dist/decorators/index.d.ts +0 -1
- package/dist/decorators/index.js.map +0 -1
- package/dist/types.d.ts +0 -4
- package/dist/types.js.map +0 -1
package/.env
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ACCOUNT_SERVICE_URL=localhost:50051
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Logger } from "@nestjs/common";
|
|
2
|
+
export declare abstract class BaseGrpcController {
|
|
3
|
+
protected readonly logger: Logger;
|
|
4
|
+
protected handleGrpcError(error: any, method: string, data?: any): never;
|
|
5
|
+
protected logGrpcCall(method: string, data?: any): void;
|
|
6
|
+
protected logGrpcSuccess(method: string, result?: any): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.BaseGrpcController = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const microservices_1 = require("@nestjs/microservices");
|
|
12
|
+
let BaseGrpcController = class BaseGrpcController {
|
|
13
|
+
constructor() {
|
|
14
|
+
this.logger = new common_1.Logger(this.constructor.name);
|
|
15
|
+
}
|
|
16
|
+
handleGrpcError(error, method, data) {
|
|
17
|
+
this.logger.error(`❌ gRPC ${method} failed`);
|
|
18
|
+
this.logger.error(`🚨 Error: ${error.message}`);
|
|
19
|
+
this.logger.error(`📋 Error stack: ${error.stack}`);
|
|
20
|
+
if (data) {
|
|
21
|
+
this.logger.error(`📝 Request data: ${JSON.stringify(data)}`);
|
|
22
|
+
}
|
|
23
|
+
throw new microservices_1.RpcException(error.message);
|
|
24
|
+
}
|
|
25
|
+
logGrpcCall(method, data) {
|
|
26
|
+
this.logger.log(`🔍 gRPC ${method} called`);
|
|
27
|
+
if (data) {
|
|
28
|
+
this.logger.log(`📝 Request data: ${JSON.stringify(data)}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
logGrpcSuccess(method, result) {
|
|
32
|
+
this.logger.log(`✅ gRPC ${method} successful`);
|
|
33
|
+
if (result) {
|
|
34
|
+
this.logger.log(`📤 Response data: ${JSON.stringify(result)}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
exports.BaseGrpcController = BaseGrpcController;
|
|
39
|
+
exports.BaseGrpcController = BaseGrpcController = __decorate([
|
|
40
|
+
(0, common_1.Controller)()
|
|
41
|
+
], BaseGrpcController);
|
|
42
|
+
//# sourceMappingURL=base-grpc.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-grpc.controller.js","sourceRoot":"","sources":["../../../src/grpc/controllers/base-grpc.controller.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAmD;AACnD,yDAAoD;AAG7C,IAAe,kBAAkB,GAAjC,MAAe,kBAAkB;IAAjC;QACc,WAAM,GAAG,IAAI,eAAM,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;IA2B/D,CAAC;IAzBW,eAAe,CAAC,KAAU,EAAE,MAAc,EAAE,IAAU;QAC9D,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,MAAM,SAAS,CAAC,CAAA;QAC5C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;QAC/C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,KAAK,CAAC,KAAK,EAAE,CAAC,CAAA;QAEnD,IAAI,IAAI,EAAE,CAAC;YACT,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QAC/D,CAAC;QAED,MAAM,IAAI,4BAAY,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IACvC,CAAC;IAES,WAAW,CAAC,MAAc,EAAE,IAAU;QAC9C,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,MAAM,SAAS,CAAC,CAAA;QAC3C,IAAI,IAAI,EAAE,CAAC;YACT,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,oBAAoB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QAC7D,CAAC;IACH,CAAC;IAES,cAAc,CAAC,MAAc,EAAE,MAAY;QACnD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,MAAM,aAAa,CAAC,CAAA;QAC9C,IAAI,MAAM,EAAE,CAAC;YACX,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,qBAAqB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;QAChE,CAAC;IACH,CAAC;CACF,CAAA;AA5BqB,gDAAkB;6BAAlB,kBAAkB;IADvC,IAAA,mBAAU,GAAE;GACS,kBAAkB,CA4BvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./base-grpc.controller";
|
|
@@ -14,5 +14,5 @@ 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("./
|
|
17
|
+
__exportStar(require("./base-grpc.controller"), exports);
|
|
18
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/grpc/controllers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAsC"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/grpc/decorators/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./interfaces"), exports);
|
|
18
|
+
__exportStar(require("./services"), exports);
|
|
19
|
+
__exportStar(require("./controllers"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/grpc/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA4B;AAC5B,6CAA0B;AAC1B,gDAA6B"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
export interface User {
|
|
3
|
+
id: string;
|
|
4
|
+
firstName: string;
|
|
5
|
+
lastName: string;
|
|
6
|
+
teleId: string;
|
|
7
|
+
teleUserName: string;
|
|
8
|
+
isActive: boolean;
|
|
9
|
+
referralCode: string;
|
|
10
|
+
parentId: string;
|
|
11
|
+
role: string;
|
|
12
|
+
createdAt: string;
|
|
13
|
+
updatedAt: string;
|
|
14
|
+
}
|
|
15
|
+
export interface TokenPayload {
|
|
16
|
+
accessToken: string;
|
|
17
|
+
expiresIn: number;
|
|
18
|
+
}
|
|
19
|
+
export interface Pagination {
|
|
20
|
+
page: number;
|
|
21
|
+
limit: number;
|
|
22
|
+
total: number;
|
|
23
|
+
totalPages: number;
|
|
24
|
+
}
|
|
25
|
+
export interface Wallet {
|
|
26
|
+
id: string;
|
|
27
|
+
userId: string;
|
|
28
|
+
address: string;
|
|
29
|
+
name: string;
|
|
30
|
+
createdAt: string;
|
|
31
|
+
updatedAt: string;
|
|
32
|
+
}
|
|
33
|
+
export interface Swap {
|
|
34
|
+
id: string;
|
|
35
|
+
userId: string;
|
|
36
|
+
walletId: string;
|
|
37
|
+
fromToken: string;
|
|
38
|
+
toToken: string;
|
|
39
|
+
amount: string;
|
|
40
|
+
status: string;
|
|
41
|
+
dexId: string;
|
|
42
|
+
createdAt: string;
|
|
43
|
+
updatedAt: string;
|
|
44
|
+
}
|
|
45
|
+
export interface TransactionStats {
|
|
46
|
+
totalSwaps: number;
|
|
47
|
+
completedSwaps: number;
|
|
48
|
+
failedSwaps: number;
|
|
49
|
+
pendingSwaps: number;
|
|
50
|
+
totalVolume: string;
|
|
51
|
+
}
|
|
52
|
+
export interface TokenTransaction {
|
|
53
|
+
id: string;
|
|
54
|
+
userId: string;
|
|
55
|
+
walletId: string;
|
|
56
|
+
coinType: string;
|
|
57
|
+
tokenSymbol: string;
|
|
58
|
+
amount: string;
|
|
59
|
+
transactionType: string;
|
|
60
|
+
status: string;
|
|
61
|
+
createdAt: string;
|
|
62
|
+
}
|
|
63
|
+
export interface LoginRequest {
|
|
64
|
+
teleId: string;
|
|
65
|
+
signature: string;
|
|
66
|
+
signTime: string;
|
|
67
|
+
}
|
|
68
|
+
export interface LoginResponse {
|
|
69
|
+
success: boolean;
|
|
70
|
+
message: string;
|
|
71
|
+
data?: {
|
|
72
|
+
user?: User;
|
|
73
|
+
token?: TokenPayload;
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
export interface MeRequest {
|
|
77
|
+
teleId: string;
|
|
78
|
+
}
|
|
79
|
+
export interface MeResponse {
|
|
80
|
+
success: boolean;
|
|
81
|
+
message: string;
|
|
82
|
+
data?: {
|
|
83
|
+
user?: User;
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
export interface ValidateTokenRequest {
|
|
87
|
+
token: string;
|
|
88
|
+
}
|
|
89
|
+
export interface ValidateTokenResponse {
|
|
90
|
+
success: boolean;
|
|
91
|
+
message: string;
|
|
92
|
+
data?: {
|
|
93
|
+
user?: User;
|
|
94
|
+
isValid: boolean;
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
export interface AuthService {
|
|
98
|
+
login(request: LoginRequest): Observable<LoginResponse>;
|
|
99
|
+
me(request: MeRequest): Observable<MeResponse>;
|
|
100
|
+
validateToken(request: ValidateTokenRequest): Observable<ValidateTokenResponse>;
|
|
101
|
+
}
|
|
102
|
+
export interface CreateSwapRequest {
|
|
103
|
+
userId: string;
|
|
104
|
+
walletId: string;
|
|
105
|
+
fromToken: string;
|
|
106
|
+
toToken: string;
|
|
107
|
+
amount: string;
|
|
108
|
+
dexId: string;
|
|
109
|
+
}
|
|
110
|
+
export interface CreateSwapResponse {
|
|
111
|
+
id: string;
|
|
112
|
+
status: string;
|
|
113
|
+
message: string;
|
|
114
|
+
}
|
|
115
|
+
export interface GetUserSwapsRequest {
|
|
116
|
+
userId: string;
|
|
117
|
+
page: number;
|
|
118
|
+
limit: number;
|
|
119
|
+
status: string;
|
|
120
|
+
dexId: string;
|
|
121
|
+
fromTokenSymbol: string;
|
|
122
|
+
toTokenSymbol: string;
|
|
123
|
+
}
|
|
124
|
+
export interface GetUserSwapsResponse {
|
|
125
|
+
swaps: Swap[];
|
|
126
|
+
pagination: Pagination;
|
|
127
|
+
}
|
|
128
|
+
export interface GetTransactionStatsRequest {
|
|
129
|
+
userId: string;
|
|
130
|
+
walletId: string;
|
|
131
|
+
date: string;
|
|
132
|
+
}
|
|
133
|
+
export interface GetTransactionStatsResponse {
|
|
134
|
+
stats: TransactionStats;
|
|
135
|
+
date: string;
|
|
136
|
+
}
|
|
137
|
+
export interface GetTokenTransactionsRequest {
|
|
138
|
+
userId: string;
|
|
139
|
+
page: number;
|
|
140
|
+
limit: number;
|
|
141
|
+
walletId: string;
|
|
142
|
+
coinType: string;
|
|
143
|
+
tokenSymbol: string;
|
|
144
|
+
transactionType: string;
|
|
145
|
+
status: string;
|
|
146
|
+
}
|
|
147
|
+
export interface GetTokenTransactionsResponse {
|
|
148
|
+
transactions: TokenTransaction[];
|
|
149
|
+
pagination: Pagination;
|
|
150
|
+
}
|
|
151
|
+
export interface SwapService {
|
|
152
|
+
createSwap(request: CreateSwapRequest): Observable<CreateSwapResponse>;
|
|
153
|
+
getUserSwaps(request: GetUserSwapsRequest): Observable<GetUserSwapsResponse>;
|
|
154
|
+
getTransactionStats(request: GetTransactionStatsRequest): Observable<GetTransactionStatsResponse>;
|
|
155
|
+
getTokenTransactions(request: GetTokenTransactionsRequest): Observable<GetTokenTransactionsResponse>;
|
|
156
|
+
}
|
|
157
|
+
export interface GetWalletByIdRequest {
|
|
158
|
+
id: string;
|
|
159
|
+
userId: string;
|
|
160
|
+
}
|
|
161
|
+
export interface GetWalletByIdResponse {
|
|
162
|
+
wallet: Wallet;
|
|
163
|
+
error: string;
|
|
164
|
+
}
|
|
165
|
+
export interface CreateWalletRequest {
|
|
166
|
+
userId: string;
|
|
167
|
+
}
|
|
168
|
+
export interface CreateWalletResponse {
|
|
169
|
+
wallet: Wallet;
|
|
170
|
+
error: string;
|
|
171
|
+
}
|
|
172
|
+
export interface WalletService {
|
|
173
|
+
getWalletById(request: GetWalletByIdRequest): Observable<GetWalletByIdResponse>;
|
|
174
|
+
createWallet(request: CreateWalletRequest): Observable<CreateWalletResponse>;
|
|
175
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.interface.js","sourceRoot":"","sources":["../../../src/grpc/interfaces/account.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
export interface FindAllCheckpointsRequest {
|
|
3
|
+
}
|
|
4
|
+
export interface SetTransactionSyncedRequest {
|
|
5
|
+
ids: string[];
|
|
6
|
+
}
|
|
7
|
+
export interface FindConfigRequest {
|
|
8
|
+
id: string;
|
|
9
|
+
}
|
|
10
|
+
export interface GetStatRequest {
|
|
11
|
+
key: string;
|
|
12
|
+
}
|
|
13
|
+
export interface Checkpoint {
|
|
14
|
+
id: string;
|
|
15
|
+
checkpointId: string;
|
|
16
|
+
transactionsCount?: number;
|
|
17
|
+
}
|
|
18
|
+
export interface FindAllCheckpointsResponse {
|
|
19
|
+
success: boolean;
|
|
20
|
+
message: string;
|
|
21
|
+
data: {
|
|
22
|
+
checkpoints: Checkpoint[];
|
|
23
|
+
} | null;
|
|
24
|
+
}
|
|
25
|
+
export interface SetTransactionSyncedResponse {
|
|
26
|
+
success: boolean;
|
|
27
|
+
message: string;
|
|
28
|
+
}
|
|
29
|
+
export interface Config {
|
|
30
|
+
id: string;
|
|
31
|
+
key: string;
|
|
32
|
+
value: string;
|
|
33
|
+
description: string;
|
|
34
|
+
createdAt: string;
|
|
35
|
+
updatedAt: string;
|
|
36
|
+
}
|
|
37
|
+
export interface FindConfigResponse {
|
|
38
|
+
success: boolean;
|
|
39
|
+
message: string;
|
|
40
|
+
data: {
|
|
41
|
+
config: Config;
|
|
42
|
+
} | null;
|
|
43
|
+
}
|
|
44
|
+
export interface Stat {
|
|
45
|
+
key: string;
|
|
46
|
+
value: string;
|
|
47
|
+
description: string;
|
|
48
|
+
createdAt: string;
|
|
49
|
+
updatedAt: string;
|
|
50
|
+
}
|
|
51
|
+
export interface GetStatResponse {
|
|
52
|
+
success: boolean;
|
|
53
|
+
message: string;
|
|
54
|
+
data: {
|
|
55
|
+
stat: Stat;
|
|
56
|
+
} | null;
|
|
57
|
+
}
|
|
58
|
+
export interface CheckpointService {
|
|
59
|
+
findAllCheckpoints(request: FindAllCheckpointsRequest): Observable<FindAllCheckpointsResponse>;
|
|
60
|
+
setTransactionSynced(request: SetTransactionSyncedRequest): Observable<SetTransactionSyncedResponse>;
|
|
61
|
+
findConfig(request: FindConfigRequest): Observable<FindConfigResponse>;
|
|
62
|
+
getStat(request: GetStatRequest): Observable<GetStatResponse>;
|
|
63
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkpoint.interface.js","sourceRoot":"","sources":["../../../src/grpc/interfaces/checkpoint.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./account.interface"), exports);
|
|
18
|
+
__exportStar(require("./checkpoint.interface"), exports);
|
|
19
|
+
__exportStar(require("./proxy.interface"), exports);
|
|
20
|
+
__exportStar(require("./swap-order.interface"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/grpc/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAmC;AACnC,yDAAsC;AACtC,oDAAiC;AACjC,yDAAsC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
export interface ProxyData {
|
|
3
|
+
id: string;
|
|
4
|
+
ip: string;
|
|
5
|
+
port: number;
|
|
6
|
+
username: string;
|
|
7
|
+
password: string;
|
|
8
|
+
isActive: boolean;
|
|
9
|
+
createdAt: string;
|
|
10
|
+
updatedAt: string;
|
|
11
|
+
}
|
|
12
|
+
export interface PickOneRequest {
|
|
13
|
+
}
|
|
14
|
+
export interface PickOneResponse {
|
|
15
|
+
success: boolean;
|
|
16
|
+
message: string;
|
|
17
|
+
data: ProxyData | null;
|
|
18
|
+
}
|
|
19
|
+
export interface GetAllProxyRequest {
|
|
20
|
+
}
|
|
21
|
+
export interface GetAllProxyResponse {
|
|
22
|
+
success: boolean;
|
|
23
|
+
message: string;
|
|
24
|
+
data: ProxyData[] | null;
|
|
25
|
+
}
|
|
26
|
+
export interface CheckIpRequest {
|
|
27
|
+
ip: string;
|
|
28
|
+
}
|
|
29
|
+
export interface CheckIpResponse {
|
|
30
|
+
result: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface TestProxyRequest {
|
|
33
|
+
ip: string;
|
|
34
|
+
port: number;
|
|
35
|
+
username: string;
|
|
36
|
+
password: string;
|
|
37
|
+
}
|
|
38
|
+
export interface TestProxyResponse {
|
|
39
|
+
success: boolean;
|
|
40
|
+
message: string;
|
|
41
|
+
data: {
|
|
42
|
+
isLive: boolean;
|
|
43
|
+
timeResponse: number;
|
|
44
|
+
} | null;
|
|
45
|
+
}
|
|
46
|
+
export interface ProxyService {
|
|
47
|
+
pickOne(request: PickOneRequest): Observable<PickOneResponse>;
|
|
48
|
+
getAllProxy(request: GetAllProxyRequest): Observable<GetAllProxyResponse>;
|
|
49
|
+
checkIp(request: CheckIpRequest): Observable<CheckIpResponse>;
|
|
50
|
+
testProxy(request: TestProxyRequest): Observable<TestProxyResponse>;
|
|
51
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxy.interface.js","sourceRoot":"","sources":["../../../src/grpc/interfaces/proxy.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
export interface PoolData {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
symbol: string;
|
|
6
|
+
token0: string;
|
|
7
|
+
token1: string;
|
|
8
|
+
reserve0: string;
|
|
9
|
+
reserve1: string;
|
|
10
|
+
totalSupply: string;
|
|
11
|
+
volume: string;
|
|
12
|
+
liquidity: string;
|
|
13
|
+
price: string;
|
|
14
|
+
priceChange24h: string;
|
|
15
|
+
volume24h: string;
|
|
16
|
+
tvl: string;
|
|
17
|
+
isActive: boolean;
|
|
18
|
+
createdAt: string;
|
|
19
|
+
updatedAt: string;
|
|
20
|
+
}
|
|
21
|
+
export interface CandleData {
|
|
22
|
+
timestamp: number;
|
|
23
|
+
open: string;
|
|
24
|
+
high: string;
|
|
25
|
+
low: string;
|
|
26
|
+
close: string;
|
|
27
|
+
volume: string;
|
|
28
|
+
}
|
|
29
|
+
export interface GetTrendingPoolsRequest {
|
|
30
|
+
label: number;
|
|
31
|
+
}
|
|
32
|
+
export interface GetNewPoolsRequest {
|
|
33
|
+
label: number;
|
|
34
|
+
}
|
|
35
|
+
export interface GetPoolRequest {
|
|
36
|
+
id: string;
|
|
37
|
+
}
|
|
38
|
+
export interface GetCandleChartRequest {
|
|
39
|
+
pool: string;
|
|
40
|
+
resolution: number;
|
|
41
|
+
limit: number;
|
|
42
|
+
timestamp?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface GetTrendingPoolsResponse {
|
|
45
|
+
pools: PoolData[];
|
|
46
|
+
}
|
|
47
|
+
export interface GetNewPoolsResponse {
|
|
48
|
+
pools: PoolData[];
|
|
49
|
+
}
|
|
50
|
+
export interface GetPoolResponse {
|
|
51
|
+
pool: PoolData;
|
|
52
|
+
}
|
|
53
|
+
export interface GetCandleChartResponse {
|
|
54
|
+
candles: CandleData[];
|
|
55
|
+
}
|
|
56
|
+
export interface SwapOrderService {
|
|
57
|
+
getTrendingPools(request: GetTrendingPoolsRequest): Observable<GetTrendingPoolsResponse>;
|
|
58
|
+
getNewPools(request: GetNewPoolsRequest): Observable<GetNewPoolsResponse>;
|
|
59
|
+
getPool(request: GetPoolRequest): Observable<GetPoolResponse>;
|
|
60
|
+
getCandleChart(request: GetCandleChartRequest): Observable<GetCandleChartResponse>;
|
|
61
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swap-order.interface.js","sourceRoot":"","sources":["../../../src/grpc/interfaces/swap-order.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export interface CreateSwapRequest {
|
|
2
|
+
userId: string;
|
|
3
|
+
walletId: string;
|
|
4
|
+
fromToken: string;
|
|
5
|
+
toToken: string;
|
|
6
|
+
amount: string;
|
|
7
|
+
dexId: string;
|
|
8
|
+
}
|
|
9
|
+
export interface CreateSwapResponse {
|
|
10
|
+
id: string;
|
|
11
|
+
status: string;
|
|
12
|
+
message: string;
|
|
13
|
+
}
|
|
14
|
+
export interface GetUserSwapsRequest {
|
|
15
|
+
userId: string;
|
|
16
|
+
page?: number;
|
|
17
|
+
limit?: number;
|
|
18
|
+
status?: string;
|
|
19
|
+
dexId?: string;
|
|
20
|
+
fromTokenSymbol?: string;
|
|
21
|
+
toTokenSymbol?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface GetUserSwapsResponse {
|
|
24
|
+
swaps: any[];
|
|
25
|
+
pagination: {
|
|
26
|
+
page: number;
|
|
27
|
+
limit: number;
|
|
28
|
+
total: number;
|
|
29
|
+
totalPages: number;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export interface GetTransactionStatsRequest {
|
|
33
|
+
userId: string;
|
|
34
|
+
walletId?: string;
|
|
35
|
+
date?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface GetTransactionStatsResponse {
|
|
38
|
+
stats: {
|
|
39
|
+
totalSwaps: number;
|
|
40
|
+
completedSwaps: number;
|
|
41
|
+
failedSwaps: number;
|
|
42
|
+
pendingSwaps: number;
|
|
43
|
+
totalVolume: string;
|
|
44
|
+
};
|
|
45
|
+
date: string;
|
|
46
|
+
}
|
|
47
|
+
export interface GetTokenTransactionsRequest {
|
|
48
|
+
userId: string;
|
|
49
|
+
page?: number;
|
|
50
|
+
limit?: number;
|
|
51
|
+
walletId?: string;
|
|
52
|
+
coinType?: string;
|
|
53
|
+
tokenSymbol?: string;
|
|
54
|
+
transactionType?: string;
|
|
55
|
+
status?: string;
|
|
56
|
+
}
|
|
57
|
+
export interface GetTokenTransactionsResponse {
|
|
58
|
+
transactions: any[];
|
|
59
|
+
pagination: {
|
|
60
|
+
page: number;
|
|
61
|
+
limit: number;
|
|
62
|
+
total: number;
|
|
63
|
+
totalPages: number;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
export interface SwapService {
|
|
67
|
+
createSwap(data: CreateSwapRequest): any;
|
|
68
|
+
getUserSwaps(data: GetUserSwapsRequest): any;
|
|
69
|
+
getTransactionStats(data: GetTransactionStatsRequest): any;
|
|
70
|
+
getTokenTransactions(data: GetTokenTransactionsRequest): any;
|
|
71
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swap.interface.js","sourceRoot":"","sources":["../../../src/grpc/interfaces/swap.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { OnModuleInit } from "@nestjs/common";
|
|
2
|
+
import { LoginRequest, LoginResponse, CreateSwapRequest, CreateSwapResponse, GetUserSwapsRequest, GetUserSwapsResponse, GetTransactionStatsRequest, GetTransactionStatsResponse, GetTokenTransactionsRequest, GetTokenTransactionsResponse, GetWalletByIdRequest, GetWalletByIdResponse, CreateWalletRequest, CreateWalletResponse, User } from "../interfaces/account.interface";
|
|
3
|
+
export declare class AccountGrpcService implements OnModuleInit {
|
|
4
|
+
private readonly logger;
|
|
5
|
+
private grpcClient;
|
|
6
|
+
private authService;
|
|
7
|
+
private swapService;
|
|
8
|
+
private walletService;
|
|
9
|
+
constructor();
|
|
10
|
+
onModuleInit(): void;
|
|
11
|
+
login(data: LoginRequest): Promise<LoginResponse>;
|
|
12
|
+
me(teleId: string): Promise<User | null>;
|
|
13
|
+
validateToken(token: string): Promise<User | null>;
|
|
14
|
+
createSwap(data: CreateSwapRequest): Promise<CreateSwapResponse>;
|
|
15
|
+
getUserSwaps(data: GetUserSwapsRequest): Promise<GetUserSwapsResponse>;
|
|
16
|
+
getTransactionStats(data: GetTransactionStatsRequest): Promise<GetTransactionStatsResponse>;
|
|
17
|
+
getTokenTransactions(data: GetTokenTransactionsRequest): Promise<GetTokenTransactionsResponse>;
|
|
18
|
+
getWalletById(data: GetWalletByIdRequest): Promise<GetWalletByIdResponse>;
|
|
19
|
+
createWallet(data: CreateWalletRequest): Promise<CreateWalletResponse>;
|
|
20
|
+
}
|