@arbiwallet/contracts 1.0.1 → 1.0.2
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 +31 -13
- package/package.json +1 -1
- package/proto/auth.proto +17 -8
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
|
|
13
|
+
export interface TelegramAuthRequest {
|
|
14
|
+
/** Telegram user id */
|
|
15
|
+
id: number;
|
|
16
|
+
/** может быть пустым */
|
|
14
17
|
username: string;
|
|
15
|
-
|
|
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
|
|
31
|
+
export interface TelegramAuthResponse {
|
|
19
32
|
token: string;
|
|
20
|
-
|
|
21
|
-
|
|
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
|
|
27
|
-
login(request:
|
|
42
|
+
export interface TelegramAuthServiceClient {
|
|
43
|
+
login(request: TelegramAuthRequest): Observable<TelegramAuthResponse>;
|
|
28
44
|
}
|
|
29
45
|
|
|
30
|
-
export interface
|
|
31
|
-
login(
|
|
46
|
+
export interface TelegramAuthServiceController {
|
|
47
|
+
login(
|
|
48
|
+
request: TelegramAuthRequest,
|
|
49
|
+
): Promise<TelegramAuthResponse> | Observable<TelegramAuthResponse> | TelegramAuthResponse;
|
|
32
50
|
}
|
|
33
51
|
|
|
34
|
-
export function
|
|
52
|
+
export function TelegramAuthServiceControllerMethods() {
|
|
35
53
|
return function (constructor: Function) {
|
|
36
54
|
const grpcMethods: string[] = ["login"];
|
|
37
55
|
for (const method of grpcMethods) {
|
|
38
56
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
39
|
-
GrpcMethod("
|
|
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("
|
|
62
|
+
GrpcStreamMethod("TelegramAuthService", method)(constructor.prototype[method], method, descriptor);
|
|
45
63
|
}
|
|
46
64
|
};
|
|
47
65
|
}
|
|
48
66
|
|
|
49
|
-
export const
|
|
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.
|
|
4
|
+
"version": "1.0.2",
|
|
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
|
|
5
|
-
rpc Login (
|
|
4
|
+
service TelegramAuthService {
|
|
5
|
+
rpc Login (TelegramAuthRequest) returns (TelegramAuthResponse);
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
message
|
|
9
|
-
|
|
10
|
-
string
|
|
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
|
|
19
|
+
message TelegramAuthResponse {
|
|
14
20
|
string token = 1;
|
|
15
|
-
|
|
16
|
-
string
|
|
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
|
}
|