@arbiwallet/contracts 1.0.73 → 1.0.80
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/telegram_bot.ts +64 -0
- package/gen/user.ts +35 -0
- package/package.json +1 -1
- package/proto/telegram_bot.proto +24 -0
- package/proto/user.proto +20 -0
|
@@ -0,0 +1,64 @@
|
|
|
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: telegram_bot.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "telegram";
|
|
12
|
+
|
|
13
|
+
export interface ForwardManagerChatMessageTgRequest {
|
|
14
|
+
forwardSecret: string;
|
|
15
|
+
text: string;
|
|
16
|
+
isEcho: boolean;
|
|
17
|
+
walletClientId: string;
|
|
18
|
+
walletManagerId?: string | undefined;
|
|
19
|
+
datetime?: string | undefined;
|
|
20
|
+
content?: string | undefined;
|
|
21
|
+
messageId?:
|
|
22
|
+
| string
|
|
23
|
+
| undefined;
|
|
24
|
+
/** JSON для reply_to: отсутствие поля — нет ответа; строка "null" — null; иначе JSON-значение. */
|
|
25
|
+
replyToJson?: string | undefined;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface ForwardManagerChatMessageTgResponse {
|
|
29
|
+
ok: boolean;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const TELEGRAM_PACKAGE_NAME = "telegram";
|
|
33
|
+
|
|
34
|
+
export interface TelegramBotServiceClient {
|
|
35
|
+
forwardManagerChatMessageTg(
|
|
36
|
+
request: ForwardManagerChatMessageTgRequest,
|
|
37
|
+
): Observable<ForwardManagerChatMessageTgResponse>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface TelegramBotServiceController {
|
|
41
|
+
forwardManagerChatMessageTg(
|
|
42
|
+
request: ForwardManagerChatMessageTgRequest,
|
|
43
|
+
):
|
|
44
|
+
| Promise<ForwardManagerChatMessageTgResponse>
|
|
45
|
+
| Observable<ForwardManagerChatMessageTgResponse>
|
|
46
|
+
| ForwardManagerChatMessageTgResponse;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function TelegramBotServiceControllerMethods() {
|
|
50
|
+
return function (constructor: Function) {
|
|
51
|
+
const grpcMethods: string[] = ["forwardManagerChatMessageTg"];
|
|
52
|
+
for (const method of grpcMethods) {
|
|
53
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
54
|
+
GrpcMethod("TelegramBotService", method)(constructor.prototype[method], method, descriptor);
|
|
55
|
+
}
|
|
56
|
+
const grpcStreamMethods: string[] = [];
|
|
57
|
+
for (const method of grpcStreamMethods) {
|
|
58
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
59
|
+
GrpcStreamMethod("TelegramBotService", method)(constructor.prototype[method], method, descriptor);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export const TELEGRAM_BOT_SERVICE_NAME = "TelegramBotService";
|
package/gen/user.ts
CHANGED
|
@@ -234,6 +234,23 @@ export interface SetSupportChatLastReadResponse {
|
|
|
234
234
|
ok: boolean;
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
+
export interface EnsureTelegramUserRequest {
|
|
238
|
+
telegramId: string;
|
|
239
|
+
telegramUsername?: string | undefined;
|
|
240
|
+
firstName?: string | undefined;
|
|
241
|
+
lastName?: string | undefined;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export interface UpdateLanguageByTelegramIdRequest {
|
|
245
|
+
telegramId: string;
|
|
246
|
+
language: string;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export interface TelegramUserLanguageResponse {
|
|
250
|
+
id: number;
|
|
251
|
+
language?: string | undefined;
|
|
252
|
+
}
|
|
253
|
+
|
|
237
254
|
export interface UserBalance {
|
|
238
255
|
asset: string;
|
|
239
256
|
network: string;
|
|
@@ -311,6 +328,12 @@ export interface UserServiceClient {
|
|
|
311
328
|
getSupportChatLastRead(request: GetSupportChatLastReadRequest): Observable<GetSupportChatLastReadResponse>;
|
|
312
329
|
|
|
313
330
|
setSupportChatLastRead(request: SetSupportChatLastReadRequest): Observable<SetSupportChatLastReadResponse>;
|
|
331
|
+
|
|
332
|
+
/** Telegram bot microservice: upsert user by telegram_id (registration TELEGRAM). */
|
|
333
|
+
|
|
334
|
+
ensureTelegramUser(request: EnsureTelegramUserRequest): Observable<TelegramUserLanguageResponse>;
|
|
335
|
+
|
|
336
|
+
updateLanguageByTelegramId(request: UpdateLanguageByTelegramIdRequest): Observable<TelegramUserLanguageResponse>;
|
|
314
337
|
}
|
|
315
338
|
|
|
316
339
|
export interface UserServiceController {
|
|
@@ -412,6 +435,16 @@ export interface UserServiceController {
|
|
|
412
435
|
| Promise<SetSupportChatLastReadResponse>
|
|
413
436
|
| Observable<SetSupportChatLastReadResponse>
|
|
414
437
|
| SetSupportChatLastReadResponse;
|
|
438
|
+
|
|
439
|
+
/** Telegram bot microservice: upsert user by telegram_id (registration TELEGRAM). */
|
|
440
|
+
|
|
441
|
+
ensureTelegramUser(
|
|
442
|
+
request: EnsureTelegramUserRequest,
|
|
443
|
+
): Promise<TelegramUserLanguageResponse> | Observable<TelegramUserLanguageResponse> | TelegramUserLanguageResponse;
|
|
444
|
+
|
|
445
|
+
updateLanguageByTelegramId(
|
|
446
|
+
request: UpdateLanguageByTelegramIdRequest,
|
|
447
|
+
): Promise<TelegramUserLanguageResponse> | Observable<TelegramUserLanguageResponse> | TelegramUserLanguageResponse;
|
|
415
448
|
}
|
|
416
449
|
|
|
417
450
|
export function UserServiceControllerMethods() {
|
|
@@ -432,6 +465,8 @@ export function UserServiceControllerMethods() {
|
|
|
432
465
|
"proxyArbiWalletChatMedia",
|
|
433
466
|
"getSupportChatLastRead",
|
|
434
467
|
"setSupportChatLastRead",
|
|
468
|
+
"ensureTelegramUser",
|
|
469
|
+
"updateLanguageByTelegramId",
|
|
435
470
|
];
|
|
436
471
|
for (const method of grpcMethods) {
|
|
437
472
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
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.80",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit"
|
|
7
7
|
},
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package telegram;
|
|
4
|
+
|
|
5
|
+
service TelegramBotService {
|
|
6
|
+
rpc ForwardManagerChatMessageTg (ForwardManagerChatMessageTgRequest) returns (ForwardManagerChatMessageTgResponse);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
message ForwardManagerChatMessageTgRequest {
|
|
10
|
+
string forward_secret = 1;
|
|
11
|
+
string text = 2;
|
|
12
|
+
bool is_echo = 3;
|
|
13
|
+
string wallet_client_id = 4;
|
|
14
|
+
optional string wallet_manager_id = 5;
|
|
15
|
+
optional string datetime = 6;
|
|
16
|
+
optional string content = 7;
|
|
17
|
+
optional string message_id = 8;
|
|
18
|
+
// JSON для reply_to: отсутствие поля — нет ответа; строка "null" — null; иначе JSON-значение.
|
|
19
|
+
optional string reply_to_json = 9;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
message ForwardManagerChatMessageTgResponse {
|
|
23
|
+
bool ok = 1;
|
|
24
|
+
}
|
package/proto/user.proto
CHANGED
|
@@ -27,6 +27,9 @@ service UserService {
|
|
|
27
27
|
// Локально в user-service: последний прочитанный message_id из chat-analytics (read receipt).
|
|
28
28
|
rpc GetSupportChatLastRead (GetSupportChatLastReadRequest) returns (GetSupportChatLastReadResponse);
|
|
29
29
|
rpc SetSupportChatLastRead (SetSupportChatLastReadRequest) returns (SetSupportChatLastReadResponse);
|
|
30
|
+
// Telegram bot microservice: upsert user by telegram_id (registration TELEGRAM).
|
|
31
|
+
rpc EnsureTelegramUser (EnsureTelegramUserRequest) returns (TelegramUserLanguageResponse);
|
|
32
|
+
rpc UpdateLanguageByTelegramId (UpdateLanguageByTelegramIdRequest) returns (TelegramUserLanguageResponse);
|
|
30
33
|
}
|
|
31
34
|
|
|
32
35
|
enum UserStatus {
|
|
@@ -247,6 +250,23 @@ message SetSupportChatLastReadResponse {
|
|
|
247
250
|
bool ok = 1;
|
|
248
251
|
}
|
|
249
252
|
|
|
253
|
+
message EnsureTelegramUserRequest {
|
|
254
|
+
string telegram_id = 1;
|
|
255
|
+
optional string telegram_username = 2;
|
|
256
|
+
optional string first_name = 3;
|
|
257
|
+
optional string last_name = 4;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
message UpdateLanguageByTelegramIdRequest {
|
|
261
|
+
string telegram_id = 1;
|
|
262
|
+
string language = 2;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
message TelegramUserLanguageResponse {
|
|
266
|
+
int32 id = 1;
|
|
267
|
+
optional string language = 2;
|
|
268
|
+
}
|
|
269
|
+
|
|
250
270
|
message UserBalance {
|
|
251
271
|
string asset = 1;
|
|
252
272
|
string network = 2;
|