@arbiwallet/contracts 1.0.73 → 1.0.81
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/content.ts +145 -0
- package/gen/telegram_bot.ts +64 -0
- package/gen/user.ts +35 -0
- package/package.json +1 -1
- package/proto/content.proto +73 -0
- package/proto/telegram_bot.proto +24 -0
- package/proto/user.proto +20 -0
package/gen/content.ts
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
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: content.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "content.v1";
|
|
12
|
+
|
|
13
|
+
export interface GetBannersRequest {
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface GetBannersResponse {
|
|
17
|
+
banners: Banner[];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface UpdateBannerRequest {
|
|
21
|
+
banner: Banner | undefined;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface UpdateBannerResponse {
|
|
25
|
+
banner: Banner | undefined;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface DeleteBannerRequest {
|
|
29
|
+
id: number;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface DeleteBannerResponse {
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface GetFaqRequest {
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface GetFaqResponse {
|
|
39
|
+
faq: FaqItem[];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface UpdateFaqItemRequest {
|
|
43
|
+
faqItem: FaqItem | undefined;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface UpdateFaqItemResponse {
|
|
47
|
+
faqItem: FaqItem | undefined;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface DeleteFaqItemRequest {
|
|
51
|
+
id: number;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface DeleteFaqItemResponse {
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface Banner {
|
|
58
|
+
id: number;
|
|
59
|
+
imageUrl: string;
|
|
60
|
+
order: number;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface FaqItem {
|
|
64
|
+
id: number;
|
|
65
|
+
question: string;
|
|
66
|
+
answer: string;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export const CONTENT_V1_PACKAGE_NAME = "content.v1";
|
|
70
|
+
|
|
71
|
+
export interface BannerServiceClient {
|
|
72
|
+
getBanners(request: GetBannersRequest): Observable<GetBannersResponse>;
|
|
73
|
+
|
|
74
|
+
updateBanner(request: UpdateBannerRequest): Observable<UpdateBannerResponse>;
|
|
75
|
+
|
|
76
|
+
deleteBanner(request: DeleteBannerRequest): Observable<DeleteBannerResponse>;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface BannerServiceController {
|
|
80
|
+
getBanners(
|
|
81
|
+
request: GetBannersRequest,
|
|
82
|
+
): Promise<GetBannersResponse> | Observable<GetBannersResponse> | GetBannersResponse;
|
|
83
|
+
|
|
84
|
+
updateBanner(
|
|
85
|
+
request: UpdateBannerRequest,
|
|
86
|
+
): Promise<UpdateBannerResponse> | Observable<UpdateBannerResponse> | UpdateBannerResponse;
|
|
87
|
+
|
|
88
|
+
deleteBanner(
|
|
89
|
+
request: DeleteBannerRequest,
|
|
90
|
+
): Promise<DeleteBannerResponse> | Observable<DeleteBannerResponse> | DeleteBannerResponse;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function BannerServiceControllerMethods() {
|
|
94
|
+
return function (constructor: Function) {
|
|
95
|
+
const grpcMethods: string[] = ["getBanners", "updateBanner", "deleteBanner"];
|
|
96
|
+
for (const method of grpcMethods) {
|
|
97
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
98
|
+
GrpcMethod("BannerService", method)(constructor.prototype[method], method, descriptor);
|
|
99
|
+
}
|
|
100
|
+
const grpcStreamMethods: string[] = [];
|
|
101
|
+
for (const method of grpcStreamMethods) {
|
|
102
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
103
|
+
GrpcStreamMethod("BannerService", method)(constructor.prototype[method], method, descriptor);
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export const BANNER_SERVICE_NAME = "BannerService";
|
|
109
|
+
|
|
110
|
+
export interface FaqServiceClient {
|
|
111
|
+
getFaq(request: GetFaqRequest): Observable<GetFaqResponse>;
|
|
112
|
+
|
|
113
|
+
updateFaqItem(request: UpdateFaqItemRequest): Observable<UpdateFaqItemResponse>;
|
|
114
|
+
|
|
115
|
+
deleteFaqItem(request: DeleteFaqItemRequest): Observable<DeleteFaqItemResponse>;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface FaqServiceController {
|
|
119
|
+
getFaq(request: GetFaqRequest): Promise<GetFaqResponse> | Observable<GetFaqResponse> | GetFaqResponse;
|
|
120
|
+
|
|
121
|
+
updateFaqItem(
|
|
122
|
+
request: UpdateFaqItemRequest,
|
|
123
|
+
): Promise<UpdateFaqItemResponse> | Observable<UpdateFaqItemResponse> | UpdateFaqItemResponse;
|
|
124
|
+
|
|
125
|
+
deleteFaqItem(
|
|
126
|
+
request: DeleteFaqItemRequest,
|
|
127
|
+
): Promise<DeleteFaqItemResponse> | Observable<DeleteFaqItemResponse> | DeleteFaqItemResponse;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export function FaqServiceControllerMethods() {
|
|
131
|
+
return function (constructor: Function) {
|
|
132
|
+
const grpcMethods: string[] = ["getFaq", "updateFaqItem", "deleteFaqItem"];
|
|
133
|
+
for (const method of grpcMethods) {
|
|
134
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
135
|
+
GrpcMethod("FaqService", method)(constructor.prototype[method], method, descriptor);
|
|
136
|
+
}
|
|
137
|
+
const grpcStreamMethods: string[] = [];
|
|
138
|
+
for (const method of grpcStreamMethods) {
|
|
139
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
140
|
+
GrpcStreamMethod("FaqService", method)(constructor.prototype[method], method, descriptor);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export const FAQ_SERVICE_NAME = "FaqService";
|
|
@@ -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.81",
|
|
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,73 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package content.v1;
|
|
4
|
+
|
|
5
|
+
service BannerService {
|
|
6
|
+
rpc GetBanners (GetBannersRequest) returns (GetBannersResponse);
|
|
7
|
+
rpc UpdateBanner (UpdateBannerRequest) returns (UpdateBannerResponse);
|
|
8
|
+
rpc DeleteBanner (DeleteBannerRequest) returns (DeleteBannerResponse);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
service FaqService {
|
|
12
|
+
rpc GetFaq (GetFaqRequest) returns (GetFaqResponse);
|
|
13
|
+
rpc UpdateFaqItem (UpdateFaqItemRequest) returns (UpdateFaqItemResponse);
|
|
14
|
+
rpc DeleteFaqItem (DeleteFaqItemRequest) returns (DeleteFaqItemResponse);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// --- BANNER MESSAGES ---
|
|
18
|
+
|
|
19
|
+
message GetBannersRequest {}
|
|
20
|
+
|
|
21
|
+
message GetBannersResponse {
|
|
22
|
+
repeated Banner banners = 1;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
message UpdateBannerRequest {
|
|
26
|
+
Banner banner = 1;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
message UpdateBannerResponse {
|
|
30
|
+
Banner banner = 1;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
message DeleteBannerRequest {
|
|
34
|
+
int32 id = 1;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
message DeleteBannerResponse {}
|
|
38
|
+
|
|
39
|
+
// --- FAQ MESSAGES ---
|
|
40
|
+
|
|
41
|
+
message GetFaqRequest {}
|
|
42
|
+
|
|
43
|
+
message GetFaqResponse {
|
|
44
|
+
repeated FaqItem faq = 1;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
message UpdateFaqItemRequest {
|
|
48
|
+
FaqItem faq_item = 1;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
message UpdateFaqItemResponse {
|
|
52
|
+
FaqItem faq_item = 1;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
message DeleteFaqItemRequest {
|
|
56
|
+
int32 id = 1;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
message DeleteFaqItemResponse {}
|
|
60
|
+
|
|
61
|
+
// --- MODELS ---
|
|
62
|
+
|
|
63
|
+
message Banner {
|
|
64
|
+
int32 id = 1;
|
|
65
|
+
string image_url = 2;
|
|
66
|
+
int32 order = 3;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
message FaqItem {
|
|
70
|
+
int32 id = 1;
|
|
71
|
+
string question = 2;
|
|
72
|
+
string answer = 3;
|
|
73
|
+
}
|
|
@@ -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;
|