@sui-tracker/shared 1.0.47 → 1.0.49

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.
@@ -1,29 +1,43 @@
1
+ // Đã cập nhật lại file proto để đồng bộ với interface trong account.interface.ts, bao gồm các trường kế thừa từ BaseResponse (success, message) cho các response.
2
+
3
+ // Proto3 syntax
1
4
  syntax = "proto3";
2
5
 
3
6
  package account;
4
7
 
5
8
  // Auth Service
6
9
  service AuthService {
10
+ // Login with Telegram ID, signature, and sign time
7
11
  rpc Login(LoginRequest) returns (LoginResponse);
12
+ // Get current user info by Telegram ID
8
13
  rpc Me(MeRequest) returns (MeResponse);
14
+ // Validate access token
9
15
  rpc ValidateToken(ValidateTokenRequest) returns (ValidateTokenResponse);
10
16
  }
11
17
 
12
18
  // Swap Service
13
19
  service SwapService {
20
+ // Create a new swap
14
21
  rpc CreateSwap(CreateSwapRequest) returns (CreateSwapResponse);
22
+ // Get user swaps with pagination and filters
15
23
  rpc GetUserSwaps(GetUserSwapsRequest) returns (GetUserSwapsResponse);
24
+ // Get transaction statistics for a user and wallet on a specific date
16
25
  rpc GetTransactionStats(GetTransactionStatsRequest) returns (GetTransactionStatsResponse);
26
+ // Get token transactions with pagination and filters
17
27
  rpc GetTokenTransactions(GetTokenTransactionsRequest) returns (GetTokenTransactionsResponse);
18
28
  }
19
29
 
20
30
  // Wallet Service
21
31
  service WalletService {
32
+ // Get wallet by ID and user ID
22
33
  rpc GetWalletById(GetWalletByIdRequest) returns (GetWalletByIdResponse);
34
+ // Create a new wallet for a user
23
35
  rpc CreateWallet(CreateWalletRequest) returns (CreateWalletResponse);
24
36
  }
25
37
 
26
- // Common Messages
38
+ // Common Entities
39
+
40
+ // User entity
27
41
  message User {
28
42
  string id = 1;
29
43
  string firstName = 2;
@@ -38,11 +52,13 @@ message User {
38
52
  string updatedAt = 11;
39
53
  }
40
54
 
55
+ // Token payload for authentication
41
56
  message TokenPayload {
42
57
  string accessToken = 1;
43
58
  int32 expiresIn = 2;
44
59
  }
45
60
 
61
+ // Pagination information
46
62
  message Pagination {
47
63
  int32 page = 1;
48
64
  int32 limit = 2;
@@ -50,6 +66,7 @@ message Pagination {
50
66
  int32 totalPages = 4;
51
67
  }
52
68
 
69
+ // Wallet entity
53
70
  message Wallet {
54
71
  string id = 1;
55
72
  string userId = 2;
@@ -59,6 +76,7 @@ message Wallet {
59
76
  string updatedAt = 6;
60
77
  }
61
78
 
79
+ // Swap entity
62
80
  message Swap {
63
81
  string id = 1;
64
82
  string userId = 2;
@@ -72,6 +90,7 @@ message Swap {
72
90
  string updatedAt = 10;
73
91
  }
74
92
 
93
+ // Transaction statistics
75
94
  message TransactionStats {
76
95
  int32 totalSwaps = 1;
77
96
  int32 completedSwaps = 2;
@@ -80,6 +99,7 @@ message TransactionStats {
80
99
  string totalVolume = 5;
81
100
  }
82
101
 
102
+ // Token transaction entity
83
103
  message TokenTransaction {
84
104
  string id = 1;
85
105
  string userId = 2;
@@ -92,16 +112,26 @@ message TokenTransaction {
92
112
  string createdAt = 9;
93
113
  }
94
114
 
95
- // Auth Messages
115
+ // BaseResponse fields for all responses
116
+ message BaseResponse {
117
+ bool success = 1;
118
+ string message = 2;
119
+ }
120
+
121
+ // ==================== Auth Messages ====================
122
+
123
+ // Login request
96
124
  message LoginRequest {
97
125
  string teleId = 1;
98
126
  string signature = 2;
99
127
  string signTime = 3;
100
128
  }
101
129
 
130
+ // Login response with optional user and token, extends BaseResponse
102
131
  message LoginResponse {
103
- // data is optional, user and token are optional
104
- LoginResponseData data = 1;
132
+ bool success = 1;
133
+ string message = 2;
134
+ LoginResponseData data = 3;
105
135
  }
106
136
 
107
137
  message LoginResponseData {
@@ -109,24 +139,32 @@ message LoginResponseData {
109
139
  TokenPayload token = 2;
110
140
  }
111
141
 
142
+ // Me request
112
143
  message MeRequest {
113
144
  string teleId = 1;
114
145
  }
115
146
 
147
+ // Me response with user data, extends BaseResponse
116
148
  message MeResponse {
117
- MeResponseData data = 1;
149
+ bool success = 1;
150
+ string message = 2;
151
+ MeResponseData data = 3;
118
152
  }
119
153
 
120
154
  message MeResponseData {
121
155
  User user = 1;
122
156
  }
123
157
 
158
+ // Validate token request
124
159
  message ValidateTokenRequest {
125
160
  string token = 1;
126
161
  }
127
162
 
163
+ // Validate token response with user and validity flag, extends BaseResponse
128
164
  message ValidateTokenResponse {
129
- ValidateTokenResponseData data = 1;
165
+ bool success = 1;
166
+ string message = 2;
167
+ ValidateTokenResponseData data = 3;
130
168
  }
131
169
 
132
170
  message ValidateTokenResponseData {
@@ -134,7 +172,9 @@ message ValidateTokenResponseData {
134
172
  bool isValid = 2;
135
173
  }
136
174
 
137
- // Swap Messages
175
+ // ==================== Swap Messages ====================
176
+
177
+ // Create swap request
138
178
  message CreateSwapRequest {
139
179
  string userId = 1;
140
180
  string walletId = 2;
@@ -144,8 +184,11 @@ message CreateSwapRequest {
144
184
  string dexId = 6;
145
185
  }
146
186
 
187
+ // Create swap response with swap id and status, extends BaseResponse
147
188
  message CreateSwapResponse {
148
- CreateSwapResponseData data = 1;
189
+ bool success = 1;
190
+ string message = 2;
191
+ CreateSwapResponseData data = 3;
149
192
  }
150
193
 
151
194
  message CreateSwapResponseData {
@@ -153,6 +196,7 @@ message CreateSwapResponseData {
153
196
  string status = 2;
154
197
  }
155
198
 
199
+ // Get user swaps request with filters and pagination
156
200
  message GetUserSwapsRequest {
157
201
  string userId = 1;
158
202
  int32 page = 2;
@@ -163,8 +207,11 @@ message GetUserSwapsRequest {
163
207
  string toTokenSymbol = 7;
164
208
  }
165
209
 
210
+ // Get user swaps response with swaps and pagination, extends BaseResponse
166
211
  message GetUserSwapsResponse {
167
- GetUserSwapsResponseData data = 1;
212
+ bool success = 1;
213
+ string message = 2;
214
+ GetUserSwapsResponseData data = 3;
168
215
  }
169
216
 
170
217
  message GetUserSwapsResponseData {
@@ -172,14 +219,18 @@ message GetUserSwapsResponseData {
172
219
  Pagination pagination = 2;
173
220
  }
174
221
 
222
+ // Get transaction stats request
175
223
  message GetTransactionStatsRequest {
176
224
  string userId = 1;
177
225
  string walletId = 2;
178
226
  string date = 3;
179
227
  }
180
228
 
229
+ // Get transaction stats response with stats and date, extends BaseResponse
181
230
  message GetTransactionStatsResponse {
182
- GetTransactionStatsResponseData data = 1;
231
+ bool success = 1;
232
+ string message = 2;
233
+ GetTransactionStatsResponseData data = 3;
183
234
  }
184
235
 
185
236
  message GetTransactionStatsResponseData {
@@ -187,6 +238,7 @@ message GetTransactionStatsResponseData {
187
238
  string date = 2;
188
239
  }
189
240
 
241
+ // Get token transactions request with filters and pagination
190
242
  message GetTokenTransactionsRequest {
191
243
  string userId = 1;
192
244
  int32 page = 2;
@@ -198,8 +250,11 @@ message GetTokenTransactionsRequest {
198
250
  string status = 8;
199
251
  }
200
252
 
253
+ // Get token transactions response with transactions and pagination, extends BaseResponse
201
254
  message GetTokenTransactionsResponse {
202
- GetTokenTransactionsResponseData data = 1;
255
+ bool success = 1;
256
+ string message = 2;
257
+ GetTokenTransactionsResponseData data = 3;
203
258
  }
204
259
 
205
260
  message GetTokenTransactionsResponseData {
@@ -207,26 +262,35 @@ message GetTokenTransactionsResponseData {
207
262
  Pagination pagination = 2;
208
263
  }
209
264
 
210
- // Wallet Messages
265
+ // ==================== Wallet Messages ====================
266
+
267
+ // Get wallet by id request
211
268
  message GetWalletByIdRequest {
212
269
  string id = 1;
213
270
  string userId = 2;
214
271
  }
215
272
 
273
+ // Get wallet by id response with wallet data, extends BaseResponse
216
274
  message GetWalletByIdResponse {
217
- GetWalletByIdResponseData data = 1;
275
+ bool success = 1;
276
+ string message = 2;
277
+ GetWalletByIdResponseData data = 3;
218
278
  }
219
279
 
220
280
  message GetWalletByIdResponseData {
221
281
  Wallet wallet = 1;
222
282
  }
223
283
 
284
+ // Create wallet request
224
285
  message CreateWalletRequest {
225
286
  string userId = 1;
226
287
  }
227
288
 
289
+ // Create wallet response with wallet data, extends BaseResponse
228
290
  message CreateWalletResponse {
229
- CreateWalletResponseData data = 1;
291
+ bool success = 1;
292
+ string message = 2;
293
+ CreateWalletResponseData data = 3;
230
294
  }
231
295
 
232
296
  message CreateWalletResponseData {
@@ -50,20 +50,25 @@ message Checkpoint {
50
50
 
51
51
  // Response for finding all checkpoints.
52
52
  message FindAllCheckpointsResponse {
53
+ bool success = 1;
54
+ string message = 2;
53
55
  message Data {
54
56
  repeated Checkpoint checkpoints = 1;
55
57
  }
56
- Data data = 1;
58
+ Data data = 3;
57
59
  }
58
60
 
59
61
  // Response for marking transactions as synced.
60
62
  message SetTransactionSyncedResponse {
61
- // No fields required as per interface.
63
+ bool success = 1;
64
+ string message = 2;
62
65
  }
63
66
 
64
67
  // Response for checking if a range is synced.
65
68
  message CheckRangeIsSyncedResponse {
66
- bool data = 1;
69
+ bool success = 1;
70
+ string message = 2;
71
+ bool data = 3;
67
72
  }
68
73
 
69
74
  // Config entity.
@@ -78,10 +83,12 @@ message Config {
78
83
 
79
84
  // Response for finding a config.
80
85
  message FindConfigResponse {
86
+ bool success = 1;
87
+ string message = 2;
81
88
  message Data {
82
89
  Config config = 1;
83
90
  }
84
- Data data = 1;
91
+ Data data = 3;
85
92
  }
86
93
 
87
94
  // Stat entity.
@@ -95,8 +102,10 @@ message Stat {
95
102
 
96
103
  // Response for getting a stat.
97
104
  message GetStatResponse {
105
+ bool success = 1;
106
+ string message = 2;
98
107
  message Data {
99
108
  Stat stat = 1;
100
109
  }
101
- Data data = 1;
110
+ Data data = 3;
102
111
  }
@@ -0,0 +1,95 @@
1
+ syntax = "proto3";
2
+
3
+ package sui_data_center;
4
+
5
+ // ProxyService defines all available RPC endpoints for proxy management.
6
+ service DataCenterService {
7
+ // Picks one available proxy.
8
+ rpc PickOne (PickOneRequest) returns (PickOneResponse);
9
+ // Gets all proxies.
10
+ rpc GetAllProxy (GetAllProxyRequest) returns (GetAllProxyResponse);
11
+ // Checks if an IP is available.
12
+ rpc CheckIp (CheckIpRequest) returns (CheckIpResponse);
13
+ // Tests a proxy for liveness and response time.
14
+ rpc TestProxy (TestProxyRequest) returns (TestProxyResponse);
15
+ }
16
+
17
+ // Request message for picking one proxy.
18
+ message PickOneRequest {
19
+ }
20
+
21
+ // Response message for picking one proxy.
22
+ message PickOneResponse {
23
+ // Indicates if the request was successful.
24
+ bool success = 1;
25
+ // Message describing the result.
26
+ string message = 2;
27
+ // Proxy data or null if not found.
28
+ ProxyData data = 3;
29
+ }
30
+
31
+ // Request message for getting all proxies.
32
+ message GetAllProxyRequest {
33
+ }
34
+
35
+ // Response message for getting all proxies.
36
+ message GetAllProxyResponse {
37
+ // Indicates if the request was successful.
38
+ bool success = 1;
39
+ // Message describing the result.
40
+ string message = 2;
41
+ // List of proxy data or null if none found.
42
+ repeated ProxyData data = 3;
43
+ }
44
+
45
+ // Request message for checking an IP.
46
+ message CheckIpRequest {
47
+ string ip = 1;
48
+ }
49
+
50
+ // Response message for checking an IP.
51
+ message CheckIpResponse {
52
+ message Data {
53
+ bool result = 1;
54
+ }
55
+ // Indicates if the request was successful.
56
+ bool success = 1;
57
+ // Message describing the result.
58
+ string message = 2;
59
+ // Data containing the result.
60
+ Data data = 3;
61
+ }
62
+
63
+ // Request message for testing a proxy.
64
+ message TestProxyRequest {
65
+ string ip = 1;
66
+ int32 port = 2;
67
+ string username = 3;
68
+ string password = 4;
69
+ }
70
+
71
+ // Response message for testing a proxy.
72
+ message TestProxyResponse {
73
+ // Indicates if the request was successful.
74
+ bool success = 1;
75
+ // Message describing the result.
76
+ string message = 2;
77
+ // Data containing liveness and response time, or null.
78
+ message Data {
79
+ bool isLive = 1;
80
+ int64 timeResponse = 2;
81
+ }
82
+ Data data = 3;
83
+ }
84
+
85
+ // Proxy data structure.
86
+ message ProxyData {
87
+ string id = 1;
88
+ string ip = 2;
89
+ int32 port = 3;
90
+ string username = 4;
91
+ string password = 5;
92
+ bool isActive = 6;
93
+ string createdAt = 7;
94
+ string updatedAt = 8;
95
+ }