@arbiwallet/contracts 1.0.1 → 1.0.3

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/gen/auth.ts CHANGED
@@ -10,40 +10,58 @@ import { Observable } from "rxjs";
10
10
 
11
11
  export const protobufPackage = "auth";
12
12
 
13
- export interface LoginRequest {
13
+ export interface TelegramAuthRequest {
14
+ /** Telegram user id */
15
+ id: number;
16
+ /** может быть пустым */
14
17
  username: string;
15
- telegram: string;
18
+ /** может быть пустым */
19
+ firstName: string;
20
+ /** может быть пустым */
21
+ lastName: string;
22
+ /** может быть пустым */
23
+ photoUrl: string;
24
+ /** unix time (seconds) */
25
+ authDate: number;
26
+ /** подпись от Telegram */
27
+ hash: string;
28
+ initData: string;
16
29
  }
17
30
 
18
- export interface LoginResponse {
31
+ export interface TelegramAuthResponse {
19
32
  token: string;
20
- test: string;
21
- test2: string;
33
+ telegramId: number;
34
+ username: string;
35
+ firstName: string;
36
+ lastName: string;
37
+ photoUrl: string;
22
38
  }
23
39
 
24
40
  export const AUTH_PACKAGE_NAME = "auth";
25
41
 
26
- export interface AuthServiceClient {
27
- login(request: LoginRequest): Observable<LoginResponse>;
42
+ export interface TelegramAuthServiceClient {
43
+ telegramAuth(request: TelegramAuthRequest): Observable<TelegramAuthResponse>;
28
44
  }
29
45
 
30
- export interface AuthServiceController {
31
- login(request: LoginRequest): Promise<LoginResponse> | Observable<LoginResponse> | LoginResponse;
46
+ export interface TelegramAuthServiceController {
47
+ telegramAuth(
48
+ request: TelegramAuthRequest,
49
+ ): Promise<TelegramAuthResponse> | Observable<TelegramAuthResponse> | TelegramAuthResponse;
32
50
  }
33
51
 
34
- export function AuthServiceControllerMethods() {
52
+ export function TelegramAuthServiceControllerMethods() {
35
53
  return function (constructor: Function) {
36
- const grpcMethods: string[] = ["login"];
54
+ const grpcMethods: string[] = ["telegramAuth"];
37
55
  for (const method of grpcMethods) {
38
56
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
39
- GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
57
+ GrpcMethod("TelegramAuthService", method)(constructor.prototype[method], method, descriptor);
40
58
  }
41
59
  const grpcStreamMethods: string[] = [];
42
60
  for (const method of grpcStreamMethods) {
43
61
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
44
- GrpcStreamMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
62
+ GrpcStreamMethod("TelegramAuthService", method)(constructor.prototype[method], method, descriptor);
45
63
  }
46
64
  };
47
65
  }
48
66
 
49
- export const AUTH_SERVICE_NAME = "AuthService";
67
+ export const TELEGRAM_AUTH_SERVICE_NAME = "TelegramAuthService";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arbiwallet/contracts",
3
3
  "descriptions": "Generate and manage smart contracts for ArbiWallet",
4
- "version": "1.0.1",
4
+ "version": "1.0.3",
5
5
  "scripts": {
6
6
  "generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit"
7
7
  },
package/proto/auth.proto CHANGED
@@ -1,17 +1,26 @@
1
1
  syntax = "proto3";
2
2
  package auth;
3
3
 
4
- service AuthService {
5
- rpc Login (LoginRequest) returns (LoginResponse);
4
+ service TelegramAuthService {
5
+ rpc TelegramAuth (TelegramAuthRequest) returns (TelegramAuthResponse);
6
6
  }
7
7
 
8
- message LoginRequest {
9
- string username = 1;
10
- string telegram = 2;
8
+ message TelegramAuthRequest {
9
+ int64 id = 1; // Telegram user id
10
+ string username = 2; // может быть пустым
11
+ string first_name = 3; // может быть пустым
12
+ string last_name = 4; // может быть пустым
13
+ string photo_url = 5; // может быть пустым
14
+ int64 auth_date = 6; // unix time (seconds)
15
+ string hash = 7; // подпись от Telegram
16
+ string init_data = 8;
11
17
  }
12
18
 
13
- message LoginResponse {
19
+ message TelegramAuthResponse {
14
20
  string token = 1;
15
- string test = 2;
16
- string test2 = 3;
21
+ int64 telegram_id = 2;
22
+ string username = 3;
23
+ string first_name = 4;
24
+ string last_name = 5;
25
+ string photo_url = 6;
17
26
  }