@arbiwallet/contracts 1.0.1
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 +49 -0
- package/package.json +26 -0
- package/proto/auth.proto +17 -0
- package/readme.md +25 -0
package/gen/auth.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.4
|
|
4
|
+
// protoc v7.34.0
|
|
5
|
+
// source: auth.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "auth";
|
|
12
|
+
|
|
13
|
+
export interface LoginRequest {
|
|
14
|
+
username: string;
|
|
15
|
+
telegram: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface LoginResponse {
|
|
19
|
+
token: string;
|
|
20
|
+
test: string;
|
|
21
|
+
test2: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const AUTH_PACKAGE_NAME = "auth";
|
|
25
|
+
|
|
26
|
+
export interface AuthServiceClient {
|
|
27
|
+
login(request: LoginRequest): Observable<LoginResponse>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface AuthServiceController {
|
|
31
|
+
login(request: LoginRequest): Promise<LoginResponse> | Observable<LoginResponse> | LoginResponse;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function AuthServiceControllerMethods() {
|
|
35
|
+
return function (constructor: Function) {
|
|
36
|
+
const grpcMethods: string[] = ["login"];
|
|
37
|
+
for (const method of grpcMethods) {
|
|
38
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
39
|
+
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
40
|
+
}
|
|
41
|
+
const grpcStreamMethods: string[] = [];
|
|
42
|
+
for (const method of grpcStreamMethods) {
|
|
43
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
44
|
+
GrpcStreamMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const AUTH_SERVICE_NAME = "AuthService";
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@arbiwallet/contracts",
|
|
3
|
+
"descriptions": "Generate and manage smart contracts for ArbiWallet",
|
|
4
|
+
"version": "1.0.1",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"proto",
|
|
10
|
+
"gen"
|
|
11
|
+
],
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"author": "Digital IT Advisor LLC",
|
|
16
|
+
"license": "Digital IT Advisor LLC",
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@nestjs/microservices": "^11.1.14",
|
|
19
|
+
"rxjs": "^7.8.2"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"install": "^0.13.0",
|
|
23
|
+
"npm": "^11.11.0",
|
|
24
|
+
"ts-proto": "^2.11.4"
|
|
25
|
+
}
|
|
26
|
+
}
|
package/proto/auth.proto
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
package auth;
|
|
3
|
+
|
|
4
|
+
service AuthService {
|
|
5
|
+
rpc Login (LoginRequest) returns (LoginResponse);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
message LoginRequest {
|
|
9
|
+
string username = 1;
|
|
10
|
+
string telegram = 2;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
message LoginResponse {
|
|
14
|
+
string token = 1;
|
|
15
|
+
string test = 2;
|
|
16
|
+
string test2 = 3;
|
|
17
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# ArbiWallet (npm)
|
|
2
|
+
|
|
3
|
+
## Генерация типов (ts-proto)
|
|
4
|
+
|
|
5
|
+
### Требования
|
|
6
|
+
|
|
7
|
+
1. Установить `protoc` (Protocol Buffers Compiler):
|
|
8
|
+
- https://github.com/protocolbuffers/protobuf
|
|
9
|
+
2. Установить `ts-proto` глобально:
|
|
10
|
+
|
|
11
|
+
```powershell
|
|
12
|
+
npm install -g ts-proto
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
> Примечание (Windows): убедись, что `protoc` доступен из терминала (в `PATH`).
|
|
16
|
+
|
|
17
|
+
### Генерация
|
|
18
|
+
|
|
19
|
+
В корне папки `npm` выполни:
|
|
20
|
+
|
|
21
|
+
```powershell
|
|
22
|
+
npm run generate
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Результат будет сгенерирован в папку `./gen`.
|