@sui-tracker/shared 1.0.78 → 1.0.79

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.
@@ -0,0 +1,19 @@
1
+ import { ClientGrpc } from '@nestjs/microservices';
2
+ import { UserResponse } from '../interfaces/auth.interface';
3
+ export declare class AccountUserGrpcService {
4
+ private grpcClient;
5
+ private readonly logger;
6
+ constructor(grpcClient: ClientGrpc);
7
+ getOrCreateUser(telegramData: {
8
+ teleId: string;
9
+ firstName?: string;
10
+ lastName?: string;
11
+ username?: string;
12
+ }): Promise<UserResponse>;
13
+ signTransaction(user: UserResponse): Promise<{
14
+ signature: string;
15
+ msg: string;
16
+ signTime: number;
17
+ }>;
18
+ generateLoginUrl(user: UserResponse, signature: string, signTime: number): string;
19
+ }
@@ -0,0 +1,70 @@
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 AccountUserGrpcService_1;
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.AccountUserGrpcService = void 0;
17
+ const common_1 = require("@nestjs/common");
18
+ const ethers_1 = require("ethers");
19
+ let AccountUserGrpcService = AccountUserGrpcService_1 = class AccountUserGrpcService {
20
+ constructor(grpcClient) {
21
+ this.grpcClient = grpcClient;
22
+ this.logger = new common_1.Logger(AccountUserGrpcService_1.name);
23
+ }
24
+ async getOrCreateUser(telegramData) {
25
+ const userService = this.grpcClient.getService('AuthService');
26
+ this.logger.log(`Getting or creating user for teleId: ${telegramData.teleId}`);
27
+ const res = await new Promise((resolve, reject) => {
28
+ userService.getOrCreateUser({
29
+ teleId: telegramData.teleId,
30
+ firstName: telegramData.firstName,
31
+ lastName: telegramData.lastName,
32
+ username: telegramData.username,
33
+ }).subscribe({
34
+ next: (response) => resolve(response),
35
+ error: (error) => reject(error),
36
+ });
37
+ });
38
+ if (!res.success || !res.user) {
39
+ throw new Error(res.message || 'Failed to get or create user');
40
+ }
41
+ this.logger.log(`User retrieved: ${res.user.id}`);
42
+ return res.user;
43
+ }
44
+ async signTransaction(user) {
45
+ const privateKey = process.env.ADMIN_WALLET_PK;
46
+ if (!privateKey) {
47
+ throw new Error('ADMIN_WALLET_PK is not set');
48
+ }
49
+ const wallet = new ethers_1.ethers.Wallet(privateKey);
50
+ const signTime = Date.now();
51
+ const msg = `${user.teleId}-${signTime}`;
52
+ const signature = await wallet.signMessage(msg);
53
+ return {
54
+ signature,
55
+ msg,
56
+ signTime,
57
+ };
58
+ }
59
+ generateLoginUrl(user, signature, signTime) {
60
+ const appDomain = process.env.APP_DOMAIN || 'https://app.example.com';
61
+ return `${appDomain}?signature=${signature}&username=${user.teleUserName}&teleId=${user.teleId}&signTime=${signTime}`;
62
+ }
63
+ };
64
+ exports.AccountUserGrpcService = AccountUserGrpcService;
65
+ exports.AccountUserGrpcService = AccountUserGrpcService = AccountUserGrpcService_1 = __decorate([
66
+ (0, common_1.Injectable)(),
67
+ __param(0, (0, common_1.Inject)('AUTH')),
68
+ __metadata("design:paramtypes", [Object])
69
+ ], AccountUserGrpcService);
70
+ //# sourceMappingURL=account-user-grpc.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account-user-grpc.service.js","sourceRoot":"","sources":["../../../src/modules/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O,GAAG,CAAC,IAAI,CAAC;IAClB,CAAC;IAKD,KAAK,CAAC,eAAe,CAAC,IAAkB;QAKtC,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;QAE/C,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAChD,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,eAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC7C,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC5B,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,IAAI,QAAQ,EAAE,CAAC;QACzC,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAEhD,OAAO;YACL,SAAS;YACT,GAAG;YACH,QAAQ;SACT,CAAC;IACJ,CAAC;IAKD,gBAAgB,CACd,IAAkB,EAClB,SAAiB,EACjB,QAAgB;QAEhB,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,yBAAyB,CAAC;QACtE,OAAO,GAAG,SAAS,cAAc,SAAS,aAAa,IAAI,CAAC,YAAY,WAAW,IAAI,CAAC,MAAM,aAAa,QAAQ,EAAE,CAAC;IACxH,CAAC;CACF,CAAA;AAlFY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,mBAAU,GAAE;IAKR,WAAA,IAAA,eAAM,EAAC,MAAM,CAAC,CAAA;;GAJN,sBAAsB,CAkFlC"}
@@ -0,0 +1,22 @@
1
+ import { ClientGrpc } from "@nestjs/microservices";
2
+ import { GetOrCreateUserRequest, GetOrCreateUserResponse } from "../interfaces/auth.interface";
3
+ export declare class AuthGrpcService {
4
+ private grpcClient;
5
+ private readonly logger;
6
+ constructor(grpcClient: ClientGrpc);
7
+ getOrCreateUser(data: GetOrCreateUserRequest): Promise<GetOrCreateUserResponse>;
8
+ login(data: {
9
+ teleId: string;
10
+ signature: string;
11
+ signTime: string;
12
+ }): Promise<any>;
13
+ me(userId: string): Promise<any>;
14
+ signTransaction(userId: string): Promise<{
15
+ success: boolean;
16
+ message: string;
17
+ signature?: string;
18
+ msg?: string;
19
+ signTime?: number;
20
+ }>;
21
+ validateToken(token: string): Promise<any>;
22
+ }
@@ -0,0 +1,113 @@
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 AuthGrpcService_1;
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.AuthGrpcService = void 0;
17
+ const common_1 = require("@nestjs/common");
18
+ const grpc_js_1 = require("@grpc/grpc-js");
19
+ let AuthGrpcService = AuthGrpcService_1 = class AuthGrpcService {
20
+ constructor(grpcClient) {
21
+ this.grpcClient = grpcClient;
22
+ this.logger = new common_1.Logger(AuthGrpcService_1.name);
23
+ }
24
+ async getOrCreateUser(data) {
25
+ const authService = this.grpcClient.getService("AuthService");
26
+ const res = await new Promise((resolve, reject) => {
27
+ authService.getOrCreateUser(data).subscribe({
28
+ next: (response) => resolve(response),
29
+ error: (error) => reject({
30
+ success: false,
31
+ message: error.message,
32
+ user: null,
33
+ }),
34
+ });
35
+ });
36
+ if (!res.success) {
37
+ throw new Error(res.message);
38
+ }
39
+ return res;
40
+ }
41
+ async login(data) {
42
+ const authService = this.grpcClient.getService("AuthService");
43
+ const res = await new Promise((resolve, reject) => {
44
+ authService.login(data).subscribe({
45
+ next: (response) => resolve(response),
46
+ error: (error) => reject(error),
47
+ });
48
+ });
49
+ if (!res.success) {
50
+ throw new Error(res.message);
51
+ }
52
+ return res;
53
+ }
54
+ async me(userId) {
55
+ const authService = this.grpcClient.getService("AuthService");
56
+ const metadata = new grpc_js_1.Metadata();
57
+ const res = await new Promise((resolve, reject) => {
58
+ authService.me({ userId }, metadata).subscribe({
59
+ next: (response) => resolve(response),
60
+ error: (error) => reject({
61
+ success: false,
62
+ message: error.message,
63
+ user: null,
64
+ }),
65
+ });
66
+ });
67
+ if (!res.success) {
68
+ throw new Error(res.message);
69
+ }
70
+ return res;
71
+ }
72
+ async signTransaction(userId) {
73
+ const authService = this.grpcClient.getService("AuthService");
74
+ const res = await new Promise((resolve, reject) => {
75
+ authService.signTransaction({ userId }).subscribe({
76
+ next: (response) => resolve(response),
77
+ error: (error) => reject({
78
+ success: false,
79
+ message: error.message,
80
+ }),
81
+ });
82
+ });
83
+ if (!res.success) {
84
+ throw new Error(res.message);
85
+ }
86
+ return res;
87
+ }
88
+ async validateToken(token) {
89
+ const authService = this.grpcClient.getService("AuthService");
90
+ const res = await new Promise((resolve, reject) => {
91
+ authService.validateToken({ token }).subscribe({
92
+ next: (response) => resolve(response),
93
+ error: (error) => resolve({
94
+ success: false,
95
+ message: error.message,
96
+ user: null,
97
+ isValid: false,
98
+ }),
99
+ });
100
+ });
101
+ if (!res.success) {
102
+ throw new Error(res.message);
103
+ }
104
+ return res;
105
+ }
106
+ };
107
+ exports.AuthGrpcService = AuthGrpcService;
108
+ exports.AuthGrpcService = AuthGrpcService = AuthGrpcService_1 = __decorate([
109
+ (0, common_1.Injectable)(),
110
+ __param(0, (0, common_1.Inject)("AUTH")),
111
+ __metadata("design:paramtypes", [Object])
112
+ ], AuthGrpcService);
113
+ //# sourceMappingURL=auth-grpc.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-grpc.service.js","sourceRoot":"","sources":["../../../src/modules/grpc-services/auth-grpc.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA4D;AAS5D,2CAAyC;AAGlC,IAAM,eAAe,uBAArB,MAAM,eAAe;IAG1B,YACkB,UAA8B;QAAtB,eAAU,GAAV,UAAU,CAAY;QAH/B,WAAM,GAAG,IAAI,eAAM,CAAC,iBAAe,CAAC,IAAI,CAAC,CAAC;IAIxD,CAAC;IAMJ,KAAK,CAAC,eAAe,CACnB,IAA4B;QAE5B,MAAM,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,UAAU,CAAc,aAAa,CAAC,CAAC;QAE3E,MAAM,GAAG,GAAG,MAAM,IAAI,OAAO,CAA0B,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACzE,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC;gBAC1C,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC;gBACrC,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CACf,MAAM,CAAC;oBACL,OAAO,EAAE,KAAK;oBACd,OAAO,EAAE,KAAK,CAAC,OAAO;oBACtB,IAAI,EAAE,IAAI;iBACX,CAAC;aACL,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,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;IAMD,KAAK,CAAC,KAAK,CAAC,IAIX;QACC,MAAM,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,UAAU,CAAM,aAAa,CAAC,CAAC;QAEnE,MAAM,GAAG,GAAG,MAAM,IAAI,OAAO,CAAM,CAAC,O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AAC,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;AApJY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,mBAAU,GAAE;IAKR,WAAA,IAAA,eAAM,EAAC,MAAM,CAAC,CAAA;;GAJN,eAAe,CAoJ3B"}
@@ -0,0 +1,76 @@
1
+ import { Observable } from "rxjs";
2
+ import { Metadata } from "@grpc/grpc-js";
3
+ export interface UserResponse {
4
+ id: string;
5
+ firstName: string;
6
+ lastName: string;
7
+ teleId: string;
8
+ teleUserName: string;
9
+ isActive: boolean;
10
+ referralCode: string;
11
+ parentId: string;
12
+ role: string;
13
+ mainWalletAddress?: string;
14
+ createdAt: string;
15
+ updatedAt: string;
16
+ }
17
+ export interface TokenResponse {
18
+ accessToken: string;
19
+ expiresIn: number;
20
+ }
21
+ export interface GetOrCreateUserRequest {
22
+ teleId: string;
23
+ firstName?: string;
24
+ lastName?: string;
25
+ username?: string;
26
+ }
27
+ export interface GetOrCreateUserResponse {
28
+ success: boolean;
29
+ message: string;
30
+ user?: UserResponse;
31
+ }
32
+ export interface LoginRequest {
33
+ teleId: string;
34
+ signature: string;
35
+ signTime: string;
36
+ }
37
+ export interface LoginResponse {
38
+ success: boolean;
39
+ message: string;
40
+ user?: UserResponse;
41
+ token?: TokenResponse;
42
+ }
43
+ export interface MeRequest {
44
+ userId: string;
45
+ }
46
+ export interface MeResponse {
47
+ success: boolean;
48
+ message: string;
49
+ user?: UserResponse;
50
+ }
51
+ export interface SignTransactionRequest {
52
+ userId: string;
53
+ }
54
+ export interface SignTransactionResponse {
55
+ success: boolean;
56
+ message: string;
57
+ signature?: string;
58
+ msg?: string;
59
+ signTime?: number;
60
+ }
61
+ export interface ValidateTokenRequest {
62
+ token: string;
63
+ }
64
+ export interface ValidateTokenResponse {
65
+ success: boolean;
66
+ message: string;
67
+ user?: UserResponse;
68
+ isValid: boolean;
69
+ }
70
+ export interface AuthService {
71
+ getOrCreateUser(data: GetOrCreateUserRequest): Observable<GetOrCreateUserResponse>;
72
+ login(request: LoginRequest): Observable<LoginResponse>;
73
+ me(request: MeRequest, metadata?: Metadata): Observable<MeResponse>;
74
+ signTransaction(request: SignTransactionRequest): Observable<SignTransactionResponse>;
75
+ validateToken(request: ValidateTokenRequest): Observable<ValidateTokenResponse>;
76
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=auth.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.interface.js","sourceRoot":"","sources":["../../../src/modules/interfaces/auth.interface.ts"],"names":[],"mappings":""}
@@ -125,6 +125,7 @@ export interface ListPool {
125
125
  priceChange360m: number;
126
126
  priceChange1440m: number;
127
127
  aIsBase: boolean;
128
+ volumeChangePercentage: number;
128
129
  }
129
130
  export interface GetListPoolsResponse extends BaseResponse {
130
131
  data: {
@@ -1 +1 @@
1
- {"version":3,"file":"swap-order.interface.js","sourceRoot":"","sources":["../../../src/modules/interfaces/swap-order.interface.ts"],"names":[],"mappings":";;AA0IC,EAAE,CAAA"}
1
+ {"version":3,"file":"swap-order.interface.js","sourceRoot":"","sources":["../../../src/modules/interfaces/swap-order.interface.ts"],"names":[],"mappings":";;AA2IC,EAAE,CAAA"}
@@ -0,0 +1,117 @@
1
+ // Proto file for Auth Service
2
+ // Được tạo từ auth.interface.ts
3
+
4
+ // Proto3 syntax
5
+ syntax = "proto3";
6
+
7
+ package auth;
8
+
9
+ // Auth Service
10
+ service AuthService {
11
+ // Login with signature
12
+ rpc Login(LoginRequest) returns (LoginResponse);
13
+
14
+ // Get or create user from Telegram data
15
+ rpc GetOrCreateUser(GetOrCreateUserRequest) returns (GetOrCreateUserResponse);
16
+
17
+ // Get current user information
18
+ rpc Me(MeRequest) returns (MeResponse);
19
+
20
+ // Sign transaction for authentication
21
+ rpc SignTransaction(SignTransactionRequest) returns (SignTransactionResponse);
22
+
23
+ // Validate JWT token
24
+ rpc ValidateToken(ValidateTokenRequest) returns (ValidateTokenResponse);
25
+ }
26
+
27
+ // User entity
28
+ message UserResponse {
29
+ string id = 1;
30
+ string firstName = 2;
31
+ string lastName = 3;
32
+ string teleId = 4;
33
+ string teleUserName = 5;
34
+ bool isActive = 6;
35
+ string referralCode = 7;
36
+ string parentId = 8;
37
+ string role = 9;
38
+ string mainWalletAddress = 10;
39
+ string createdAt = 11;
40
+ string updatedAt = 12;
41
+ }
42
+
43
+ // Get or create user request
44
+ message GetOrCreateUserRequest {
45
+ string teleId = 1;
46
+ string firstName = 2;
47
+ string lastName = 3;
48
+ string username = 4;
49
+ }
50
+
51
+ // Get or create user response with user data
52
+ message GetOrCreateUserResponse {
53
+ bool success = 1;
54
+ string message = 2;
55
+ UserResponse user = 3;
56
+ }
57
+
58
+ // Login request
59
+ message LoginRequest {
60
+ string teleId = 1;
61
+ string signature = 2;
62
+ string signTime = 3;
63
+ }
64
+
65
+ // Token response
66
+ message TokenResponse {
67
+ string accessToken = 1;
68
+ int32 expiresIn = 2;
69
+ }
70
+
71
+ // Login response
72
+ message LoginResponse {
73
+ bool success = 1;
74
+ string message = 2;
75
+ UserResponse user = 3;
76
+ TokenResponse token = 4;
77
+ }
78
+
79
+ // Me request
80
+ message MeRequest {
81
+ string userId = 1;
82
+ }
83
+
84
+ // Me response
85
+ message MeResponse {
86
+ bool success = 1;
87
+ string message = 2;
88
+ UserResponse user = 3;
89
+ }
90
+
91
+ // Validate token request
92
+ message ValidateTokenRequest {
93
+ string token = 1;
94
+ }
95
+
96
+ // Sign transaction request
97
+ message SignTransactionRequest {
98
+ string userId = 1;
99
+ }
100
+
101
+ // Sign transaction response
102
+ message SignTransactionResponse {
103
+ bool success = 1;
104
+ string message = 2;
105
+ string signature = 3;
106
+ string msg = 4;
107
+ int64 signTime = 5;
108
+ }
109
+
110
+ // Validate token response
111
+ message ValidateTokenResponse {
112
+ bool success = 1;
113
+ string message = 2;
114
+ UserResponse user = 3;
115
+ bool isValid = 4;
116
+ }
117
+
@@ -102,6 +102,7 @@ message ListPool {
102
102
  double priceChange360m = 22;
103
103
  double priceChange1440m = 23;
104
104
  bool aIsBase = 24;
105
+ double volumeChangePercentage = 25;
105
106
  }
106
107
 
107
108
  // Candle data structure matching CandleData interface