@arbiwallet/contracts 1.0.200 → 1.0.201
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/exchange_rates.ts +118 -0
- package/package.json +1 -1
- package/proto/exchange_rates.proto +75 -0
|
@@ -0,0 +1,118 @@
|
|
|
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: exchange_rates.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "exchange_rates";
|
|
12
|
+
|
|
13
|
+
export interface CalculateExchangeRequest {
|
|
14
|
+
managerUserId: number;
|
|
15
|
+
inputCurrency: string;
|
|
16
|
+
outputCurrency: string;
|
|
17
|
+
currencyForAmount: string;
|
|
18
|
+
amount: number;
|
|
19
|
+
adjustment?: number | undefined;
|
|
20
|
+
promoDiscount?: number | undefined;
|
|
21
|
+
customerId?: number | undefined;
|
|
22
|
+
disableRounding?: boolean | undefined;
|
|
23
|
+
fixedRate?: number | undefined;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface CalculateExchangeResponse {
|
|
27
|
+
result: boolean;
|
|
28
|
+
calculationId?: number | undefined;
|
|
29
|
+
inputCurrencyQuantity: number;
|
|
30
|
+
outputCurrencyQuantity: number;
|
|
31
|
+
exchangeRateForMessage: string;
|
|
32
|
+
exchangeRate: number;
|
|
33
|
+
realExchangeRate: number;
|
|
34
|
+
finalPercent: number;
|
|
35
|
+
adjustment: number;
|
|
36
|
+
hasCustomer: boolean;
|
|
37
|
+
customerId?: number | undefined;
|
|
38
|
+
availableAgents: number[];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface GetExchangeCalculationRequest {
|
|
42
|
+
calculationId?: number | undefined;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface ExchangeCalculation {
|
|
46
|
+
id: number;
|
|
47
|
+
customerId?: number | undefined;
|
|
48
|
+
managerId?: number | undefined;
|
|
49
|
+
inputCurrencyId: number;
|
|
50
|
+
outputCurrencyId: number;
|
|
51
|
+
currencyForAmountId: number;
|
|
52
|
+
amount: number;
|
|
53
|
+
inputCurrencyQuantity: number;
|
|
54
|
+
outputCurrencyQuantity: number;
|
|
55
|
+
exchangeRate: number;
|
|
56
|
+
realExchangeRate: number;
|
|
57
|
+
finalPercent: number;
|
|
58
|
+
adjustment: number;
|
|
59
|
+
promoDiscount: number;
|
|
60
|
+
createdAt: string;
|
|
61
|
+
updatedAt: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface GetExchangeCalculationResponse {
|
|
65
|
+
result: boolean;
|
|
66
|
+
calculation?: ExchangeCalculation | undefined;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface GetExchanheRatesRequest {
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface GetExchanheRatesResponse {
|
|
73
|
+
dataJson: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export const EXCHANGE_RATES_PACKAGE_NAME = "exchange_rates";
|
|
77
|
+
|
|
78
|
+
export interface ExchangeRatesServiceClient {
|
|
79
|
+
calculateExchange(request: CalculateExchangeRequest): Observable<CalculateExchangeResponse>;
|
|
80
|
+
|
|
81
|
+
getExchangeCalculation(request: GetExchangeCalculationRequest): Observable<GetExchangeCalculationResponse>;
|
|
82
|
+
|
|
83
|
+
getExchanheRates(request: GetExchanheRatesRequest): Observable<GetExchanheRatesResponse>;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface ExchangeRatesServiceController {
|
|
87
|
+
calculateExchange(
|
|
88
|
+
request: CalculateExchangeRequest,
|
|
89
|
+
): Promise<CalculateExchangeResponse> | Observable<CalculateExchangeResponse> | CalculateExchangeResponse;
|
|
90
|
+
|
|
91
|
+
getExchangeCalculation(
|
|
92
|
+
request: GetExchangeCalculationRequest,
|
|
93
|
+
):
|
|
94
|
+
| Promise<GetExchangeCalculationResponse>
|
|
95
|
+
| Observable<GetExchangeCalculationResponse>
|
|
96
|
+
| GetExchangeCalculationResponse;
|
|
97
|
+
|
|
98
|
+
getExchanheRates(
|
|
99
|
+
request: GetExchanheRatesRequest,
|
|
100
|
+
): Promise<GetExchanheRatesResponse> | Observable<GetExchanheRatesResponse> | GetExchanheRatesResponse;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export function ExchangeRatesServiceControllerMethods() {
|
|
104
|
+
return function (constructor: Function) {
|
|
105
|
+
const grpcMethods: string[] = ["calculateExchange", "getExchangeCalculation", "getExchanheRates"];
|
|
106
|
+
for (const method of grpcMethods) {
|
|
107
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
108
|
+
GrpcMethod("ExchangeRatesService", method)(constructor.prototype[method], method, descriptor);
|
|
109
|
+
}
|
|
110
|
+
const grpcStreamMethods: string[] = [];
|
|
111
|
+
for (const method of grpcStreamMethods) {
|
|
112
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
113
|
+
GrpcStreamMethod("ExchangeRatesService", method)(constructor.prototype[method], method, descriptor);
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export const EXCHANGE_RATES_SERVICE_NAME = "ExchangeRatesService";
|
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.201",
|
|
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,75 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package exchange_rates;
|
|
4
|
+
|
|
5
|
+
option csharp_namespace = "ExchangeRates";
|
|
6
|
+
option java_multiple_files = true;
|
|
7
|
+
option java_package = "com.arbiwallet.exchange.rates";
|
|
8
|
+
|
|
9
|
+
service ExchangeRatesService {
|
|
10
|
+
rpc CalculateExchange(CalculateExchangeRequest) returns (CalculateExchangeResponse);
|
|
11
|
+
rpc GetExchangeCalculation(GetExchangeCalculationRequest) returns (GetExchangeCalculationResponse);
|
|
12
|
+
rpc GetExchanheRates(GetExchanheRatesRequest) returns (GetExchanheRatesResponse);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
message CalculateExchangeRequest {
|
|
16
|
+
int64 manager_user_id = 1;
|
|
17
|
+
string input_currency = 2;
|
|
18
|
+
string output_currency = 3;
|
|
19
|
+
string currency_for_amount = 4;
|
|
20
|
+
double amount = 5;
|
|
21
|
+
optional double adjustment = 6;
|
|
22
|
+
optional double promo_discount = 7;
|
|
23
|
+
optional int64 customer_id = 8;
|
|
24
|
+
optional bool disable_rounding = 9;
|
|
25
|
+
optional double fixed_rate = 10;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
message CalculateExchangeResponse {
|
|
29
|
+
bool result = 1;
|
|
30
|
+
optional int64 calculation_id = 2;
|
|
31
|
+
double input_currency_quantity = 3;
|
|
32
|
+
double output_currency_quantity = 4;
|
|
33
|
+
string exchange_rate_for_message = 5;
|
|
34
|
+
double exchange_rate = 6;
|
|
35
|
+
double real_exchange_rate = 7;
|
|
36
|
+
double final_percent = 8;
|
|
37
|
+
double adjustment = 9;
|
|
38
|
+
bool has_customer = 10;
|
|
39
|
+
optional int64 customer_id = 11;
|
|
40
|
+
repeated int64 available_agents = 12;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
message GetExchangeCalculationRequest {
|
|
44
|
+
optional int64 calculation_id = 1;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
message ExchangeCalculation {
|
|
48
|
+
int64 id = 1;
|
|
49
|
+
optional int64 customer_id = 2;
|
|
50
|
+
optional int64 manager_id = 3;
|
|
51
|
+
int64 input_currency_id = 4;
|
|
52
|
+
int64 output_currency_id = 5;
|
|
53
|
+
int64 currency_for_amount_id = 6;
|
|
54
|
+
double amount = 7;
|
|
55
|
+
double input_currency_quantity = 8;
|
|
56
|
+
double output_currency_quantity = 9;
|
|
57
|
+
double exchange_rate = 10;
|
|
58
|
+
double real_exchange_rate = 11;
|
|
59
|
+
double final_percent = 12;
|
|
60
|
+
double adjustment = 13;
|
|
61
|
+
double promo_discount = 14;
|
|
62
|
+
string created_at = 15;
|
|
63
|
+
string updated_at = 16;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
message GetExchangeCalculationResponse {
|
|
67
|
+
bool result = 1;
|
|
68
|
+
optional ExchangeCalculation calculation = 2;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
message GetExchanheRatesRequest {}
|
|
72
|
+
|
|
73
|
+
message GetExchanheRatesResponse {
|
|
74
|
+
string data_json = 1;
|
|
75
|
+
}
|