@arbiwallet/contracts 1.0.273 → 1.0.275

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.
@@ -336,6 +336,29 @@ export interface CancelExchangeDealResponse {
336
336
  validationErrors?: { [key: string]: any } | undefined;
337
337
  }
338
338
 
339
+ export interface GetUserIdsWithDealsInPeriodRequest {
340
+ dateFrom?: string | undefined;
341
+ dateTo?: string | undefined;
342
+ }
343
+
344
+ export interface GetUserIdsWithDealsInPeriodResponse {
345
+ userIds: number[];
346
+ }
347
+
348
+ export interface BatchGetUserDealStatsRequest {
349
+ userIds: number[];
350
+ }
351
+
352
+ export interface UserDealStats {
353
+ userId: number;
354
+ exchangeCountLastMonth: number;
355
+ totalProfit: number;
356
+ }
357
+
358
+ export interface BatchGetUserDealStatsResponse {
359
+ items: UserDealStats[];
360
+ }
361
+
339
362
  export interface ExchangeCalculationsFiltersRequest {
340
363
  dateFrom?: string | undefined;
341
364
  dateTo?: string | undefined;
@@ -613,6 +636,12 @@ export interface ExchangeCoreServiceClient {
613
636
 
614
637
  cancelExchangeDeal(request: CancelExchangeDealRequest): Observable<CancelExchangeDealResponse>;
615
638
 
639
+ getUserIdsWithDealsInPeriod(
640
+ request: GetUserIdsWithDealsInPeriodRequest,
641
+ ): Observable<GetUserIdsWithDealsInPeriodResponse>;
642
+
643
+ batchGetUserDealStats(request: BatchGetUserDealStatsRequest): Observable<BatchGetUserDealStatsResponse>;
644
+
616
645
  createExchangePayment(request: CreateExchangePaymentRequest): Observable<CreateExchangePaymentResponse>;
617
646
 
618
647
  handlePaymentWebhook(request: HandlePaymentWebhookRequest): Observable<HandlePaymentWebhookResponse>;
@@ -685,6 +714,17 @@ export interface ExchangeCoreServiceController {
685
714
  request: CancelExchangeDealRequest,
686
715
  ): Promise<CancelExchangeDealResponse> | Observable<CancelExchangeDealResponse> | CancelExchangeDealResponse;
687
716
 
717
+ getUserIdsWithDealsInPeriod(
718
+ request: GetUserIdsWithDealsInPeriodRequest,
719
+ ):
720
+ | Promise<GetUserIdsWithDealsInPeriodResponse>
721
+ | Observable<GetUserIdsWithDealsInPeriodResponse>
722
+ | GetUserIdsWithDealsInPeriodResponse;
723
+
724
+ batchGetUserDealStats(
725
+ request: BatchGetUserDealStatsRequest,
726
+ ): Promise<BatchGetUserDealStatsResponse> | Observable<BatchGetUserDealStatsResponse> | BatchGetUserDealStatsResponse;
727
+
688
728
  createExchangePayment(
689
729
  request: CreateExchangePaymentRequest,
690
730
  ): Promise<CreateExchangePaymentResponse> | Observable<CreateExchangePaymentResponse> | CreateExchangePaymentResponse;
@@ -746,6 +786,8 @@ export function ExchangeCoreServiceControllerMethods() {
746
786
  "updateExchangeDeal",
747
787
  "completeExchangeDeal",
748
788
  "cancelExchangeDeal",
789
+ "getUserIdsWithDealsInPeriod",
790
+ "batchGetUserDealStats",
749
791
  "createExchangePayment",
750
792
  "handlePaymentWebhook",
751
793
  "getExchangePayments",
package/gen/user.ts CHANGED
@@ -27,6 +27,12 @@ export enum UserKycStatus {
27
27
  UNRECOGNIZED = -1,
28
28
  }
29
29
 
30
+ export enum UserSearchBonusType {
31
+ PROFIT = 0,
32
+ VOLUME = 1,
33
+ UNRECOGNIZED = -1,
34
+ }
35
+
30
36
  export enum UserSortBy {
31
37
  CREATED_AT = 0,
32
38
  STATUS = 1,
@@ -67,6 +73,22 @@ export interface UserResponse {
67
73
  cardFirstName?: string | undefined;
68
74
  cardLastName?: string | undefined;
69
75
  crmCustomerId?: number | undefined;
76
+ referrerUserId?: number | undefined;
77
+ refPercent?: number | undefined;
78
+ referralVolume?: number | undefined;
79
+ exchangesCount?: number | undefined;
80
+ exchangeCountLastYear?: number | undefined;
81
+ totalAmount?: number | undefined;
82
+ avgCheck?: number | undefined;
83
+ firstExchangeAt?: string | undefined;
84
+ lastExchangeAt?: string | undefined;
85
+ lifePeriod?: number | undefined;
86
+ lifePeriodYear?: number | undefined;
87
+ frequency?: number | undefined;
88
+ ltv?: number | undefined;
89
+ userSearchUpdatedAt?: string | undefined;
90
+ bonusType?: UserSearchBonusType | undefined;
91
+ referrerName?: string | undefined;
70
92
  }
71
93
 
72
94
  export interface UpdateUserRequest {
@@ -91,6 +113,16 @@ export interface ListUsersRequest {
91
113
  search?: string | undefined;
92
114
  statusValue?: UserStatus | undefined;
93
115
  registrationTypeValue?: string | undefined;
116
+ sources: string[];
117
+ tags: string[];
118
+ referrerUserId?: number | undefined;
119
+ registrationFrom?: string | undefined;
120
+ registrationTo?: string | undefined;
121
+ dealFrom?: string | undefined;
122
+ dealTo?: string | undefined;
123
+ lastDealFrom?: string | undefined;
124
+ lastDealTo?: string | undefined;
125
+ sort?: string | undefined;
94
126
  }
95
127
 
96
128
  export interface ListUsersResponse {
@@ -100,6 +132,40 @@ export interface ListUsersResponse {
100
132
  limit: number;
101
133
  }
102
134
 
135
+ export interface UserSearchExchangeStats {
136
+ exchangesCount: number;
137
+ exchangeCountLastYear: number;
138
+ totalAmount: number;
139
+ avgCheck: number;
140
+ firstExchangeAt?: string | undefined;
141
+ lastExchangeAt?: string | undefined;
142
+ lifePeriod?: number | undefined;
143
+ lifePeriodYear?: number | undefined;
144
+ frequency?: number | undefined;
145
+ ltv?: number | undefined;
146
+ }
147
+
148
+ export interface UserSearchReferralStats {
149
+ referrerUserId?: number | undefined;
150
+ refPercent?: number | undefined;
151
+ referralVolume: number;
152
+ bonusType?: UserSearchBonusType | undefined;
153
+ }
154
+
155
+ export interface UserSearchStatsUpdate {
156
+ userId: number;
157
+ exchangeStats: UserSearchExchangeStats | undefined;
158
+ referralStats: UserSearchReferralStats | undefined;
159
+ }
160
+
161
+ export interface UpdateUserSearchStatsRequest {
162
+ items: UserSearchStatsUpdate[];
163
+ }
164
+
165
+ export interface UpdateUserSearchStatsResponse {
166
+ updatedCount: number;
167
+ }
168
+
103
169
  export interface GetUserFullNamesByIdsRequest {
104
170
  userIds: number[];
105
171
  }
@@ -518,6 +584,8 @@ export interface UserServiceClient {
518
584
 
519
585
  listUsers(request: ListUsersRequest): Observable<ListUsersResponse>;
520
586
 
587
+ updateUserSearchStats(request: UpdateUserSearchStatsRequest): Observable<UpdateUserSearchStatsResponse>;
588
+
521
589
  /** Батч-резолв полных имен пользователей по их id (для enrichment в других сервисах). */
522
590
 
523
591
  getUserFullNamesByIds(request: GetUserFullNamesByIdsRequest): Observable<GetUserFullNamesByIdsResponse>;
@@ -652,6 +720,10 @@ export interface UserServiceController {
652
720
 
653
721
  listUsers(request: ListUsersRequest): Promise<ListUsersResponse> | Observable<ListUsersResponse> | ListUsersResponse;
654
722
 
723
+ updateUserSearchStats(
724
+ request: UpdateUserSearchStatsRequest,
725
+ ): Promise<UpdateUserSearchStatsResponse> | Observable<UpdateUserSearchStatsResponse> | UpdateUserSearchStatsResponse;
726
+
655
727
  /** Батч-резолв полных имен пользователей по их id (для enrichment в других сервисах). */
656
728
 
657
729
  getUserFullNamesByIds(
@@ -886,6 +958,7 @@ export function UserServiceControllerMethods() {
886
958
  "updateUser",
887
959
  "updateUserStatus",
888
960
  "listUsers",
961
+ "updateUserSearchStats",
889
962
  "getUserFullNamesByIds",
890
963
  "resolveUserForTransfer",
891
964
  "getCrmSession",
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.273",
4
+ "version": "1.0.275",
5
5
  "scripts": {
6
6
  "generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit"
7
7
  },
@@ -20,6 +20,8 @@ service ExchangeCoreService {
20
20
  rpc UpdateExchangeDeal(UpdateExchangeDealRequest) returns (UpdateExchangeDealResponse);
21
21
  rpc CompleteExchangeDeal(CompleteExchangeDealRequest) returns (CompleteExchangeDealResponse);
22
22
  rpc CancelExchangeDeal(CancelExchangeDealRequest) returns (CancelExchangeDealResponse);
23
+ rpc GetUserIdsWithDealsInPeriod(GetUserIdsWithDealsInPeriodRequest) returns (GetUserIdsWithDealsInPeriodResponse);
24
+ rpc BatchGetUserDealStats(BatchGetUserDealStatsRequest) returns (BatchGetUserDealStatsResponse);
23
25
 
24
26
  rpc CreateExchangePayment(CreateExchangePaymentRequest) returns (CreateExchangePaymentResponse);
25
27
  rpc HandlePaymentWebhook(HandlePaymentWebhookRequest) returns (HandlePaymentWebhookResponse);
@@ -381,6 +383,29 @@ message CancelExchangeDealResponse {
381
383
  optional google.protobuf.Struct validationErrors = 4;
382
384
  }
383
385
 
386
+ message GetUserIdsWithDealsInPeriodRequest {
387
+ optional string date_from = 1;
388
+ optional string date_to = 2;
389
+ }
390
+
391
+ message GetUserIdsWithDealsInPeriodResponse {
392
+ repeated int32 user_ids = 1;
393
+ }
394
+
395
+ message BatchGetUserDealStatsRequest {
396
+ repeated int32 user_ids = 1;
397
+ }
398
+
399
+ message UserDealStats {
400
+ int32 user_id = 1;
401
+ int32 exchange_count_last_month = 2;
402
+ double total_profit = 3;
403
+ }
404
+
405
+ message BatchGetUserDealStatsResponse {
406
+ repeated UserDealStats items = 1;
407
+ }
408
+
384
409
  message ExchangeCalculationsFiltersRequest {
385
410
  optional string date_from = 1;
386
411
  optional string date_to = 2;
package/proto/user.proto CHANGED
@@ -6,6 +6,7 @@ service UserService {
6
6
  rpc UpdateUser (UpdateUserRequest) returns (UserResponse);
7
7
  rpc UpdateUserStatus (UpdateUserStatusRequest) returns (UserResponse);
8
8
  rpc ListUsers (ListUsersRequest) returns (ListUsersResponse);
9
+ rpc UpdateUserSearchStats (UpdateUserSearchStatsRequest) returns (UpdateUserSearchStatsResponse);
9
10
  // Батч-резолв полных имен пользователей по их id (для enrichment в других сервисах).
10
11
  rpc GetUserFullNamesByIds (GetUserFullNamesByIdsRequest) returns (GetUserFullNamesByIdsResponse);
11
12
  // Ровно одно из полей: user_id, email, phone, telegram_username → id получателя для внутреннего перевода.
@@ -80,6 +81,11 @@ enum UserKycStatus {
80
81
  REJECTED = 6;
81
82
  }
82
83
 
84
+ enum UserSearchBonusType {
85
+ PROFIT = 0;
86
+ VOLUME = 1;
87
+ }
88
+
83
89
  message GetUserRequest {
84
90
  int32 id = 1;
85
91
  }
@@ -107,6 +113,22 @@ message UserResponse {
107
113
  optional string card_first_name = 20;
108
114
  optional string card_last_name = 21;
109
115
  optional int32 crm_customer_id = 22;
116
+ optional int32 referrer_user_id = 23;
117
+ optional double ref_percent = 24;
118
+ optional double referral_volume = 25;
119
+ optional int32 exchanges_count = 26;
120
+ optional int32 exchange_count_last_year = 27;
121
+ optional double total_amount = 28;
122
+ optional double avg_check = 29;
123
+ optional string first_exchange_at = 30;
124
+ optional string last_exchange_at = 31;
125
+ optional double life_period = 32;
126
+ optional double life_period_year = 33;
127
+ optional double frequency = 34;
128
+ optional double ltv = 35;
129
+ optional string user_search_updated_at = 36;
130
+ optional UserSearchBonusType bonus_type = 37;
131
+ optional string referrer_name = 38;
110
132
  }
111
133
 
112
134
  message UpdateUserRequest {
@@ -142,6 +164,16 @@ message ListUsersRequest {
142
164
  optional string search = 5;
143
165
  optional UserStatus status_value = 6;
144
166
  optional string registration_type_value = 7;
167
+ repeated string sources = 8;
168
+ repeated string tags = 9;
169
+ optional int32 referrer_user_id = 10;
170
+ optional string registration_from = 11;
171
+ optional string registration_to = 12;
172
+ optional string deal_from = 13;
173
+ optional string deal_to = 14;
174
+ optional string last_deal_from = 15;
175
+ optional string last_deal_to = 16;
176
+ optional string sort = 17;
145
177
  }
146
178
 
147
179
  message ListUsersResponse {
@@ -151,6 +183,40 @@ message ListUsersResponse {
151
183
  int32 limit = 4;
152
184
  }
153
185
 
186
+ message UserSearchExchangeStats {
187
+ int32 exchanges_count = 1;
188
+ int32 exchange_count_last_year = 2;
189
+ double total_amount = 3;
190
+ double avg_check = 4;
191
+ optional string first_exchange_at = 5;
192
+ optional string last_exchange_at = 6;
193
+ optional double life_period = 7;
194
+ optional double life_period_year = 8;
195
+ optional double frequency = 9;
196
+ optional double ltv = 10;
197
+ }
198
+
199
+ message UserSearchReferralStats {
200
+ optional int32 referrer_user_id = 1;
201
+ optional double ref_percent = 2;
202
+ double referral_volume = 3;
203
+ optional UserSearchBonusType bonus_type = 4;
204
+ }
205
+
206
+ message UserSearchStatsUpdate {
207
+ int32 user_id = 1;
208
+ UserSearchExchangeStats exchange_stats = 2;
209
+ UserSearchReferralStats referral_stats = 3;
210
+ }
211
+
212
+ message UpdateUserSearchStatsRequest {
213
+ repeated UserSearchStatsUpdate items = 1;
214
+ }
215
+
216
+ message UpdateUserSearchStatsResponse {
217
+ int32 updated_count = 1;
218
+ }
219
+
154
220
  message GetUserFullNamesByIdsRequest {
155
221
  repeated int32 user_ids = 1;
156
222
  }