@arbiwallet/contracts 1.0.202 → 1.0.204
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_core.ts +203 -0
- package/gen/exchange_rates.ts +35 -22
- package/gen/google/protobuf/struct.ts +197 -0
- package/package.json +1 -1
- package/proto/exchange_core.proto +158 -0
- package/proto/exchange_rates.proto +39 -27
|
@@ -0,0 +1,203 @@
|
|
|
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_core.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { wrappers } from "protobufjs";
|
|
10
|
+
import { Observable } from "rxjs";
|
|
11
|
+
import { Struct } from "./google/protobuf/struct";
|
|
12
|
+
|
|
13
|
+
export const protobufPackage = "exchange_core";
|
|
14
|
+
|
|
15
|
+
export interface CreateExchangeOrderRequest {
|
|
16
|
+
inputAmount: number;
|
|
17
|
+
outputAmount: number;
|
|
18
|
+
inputCurrency: string;
|
|
19
|
+
outputCurrency: string;
|
|
20
|
+
withdrawType: string;
|
|
21
|
+
customer: string;
|
|
22
|
+
receiveBank?: string | undefined;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface CreateExchangeOrderResponse {
|
|
26
|
+
success: boolean;
|
|
27
|
+
statusCode: number;
|
|
28
|
+
orderId?: string | undefined;
|
|
29
|
+
message?: string | undefined;
|
|
30
|
+
warning?: string | undefined;
|
|
31
|
+
error?: string | undefined;
|
|
32
|
+
errors: string[];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface CreateExchangePaymentRequest {
|
|
36
|
+
managerUserId?: string | undefined;
|
|
37
|
+
managerId?: string | undefined;
|
|
38
|
+
calculationId?: string | undefined;
|
|
39
|
+
agentId: number;
|
|
40
|
+
amount?: number | undefined;
|
|
41
|
+
customerId?: string | undefined;
|
|
42
|
+
cryptoNetwork?: string | undefined;
|
|
43
|
+
customerSource?: string | undefined;
|
|
44
|
+
customerReferrer?: string | undefined;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface CreateExchangePaymentResult {
|
|
48
|
+
paymentId: string;
|
|
49
|
+
paymentUuid: string;
|
|
50
|
+
amount: number;
|
|
51
|
+
status: number;
|
|
52
|
+
agent: string;
|
|
53
|
+
walletId?: string | undefined;
|
|
54
|
+
cryptoNetwork?: string | undefined;
|
|
55
|
+
cryptoAddress?: string | undefined;
|
|
56
|
+
arbiLink?: string | undefined;
|
|
57
|
+
paymentLink?: string | undefined;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface CreateExchangePaymentResponse {
|
|
61
|
+
ok: boolean;
|
|
62
|
+
result?: CreateExchangePaymentResult | undefined;
|
|
63
|
+
error?: string | undefined;
|
|
64
|
+
validationErrors?: { [key: string]: any } | undefined;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface HandlePaymentWebhookRequest {
|
|
68
|
+
jsonPayload: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface HandlePaymentWebhookResponse {
|
|
72
|
+
ok: boolean;
|
|
73
|
+
status: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface GetExchangePaymentsRequest {
|
|
77
|
+
page?: number | undefined;
|
|
78
|
+
limit?: number | undefined;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface GetExchangePaymentsItem {
|
|
82
|
+
paymentId: string;
|
|
83
|
+
paymentUuid: string;
|
|
84
|
+
amount: number;
|
|
85
|
+
status: number;
|
|
86
|
+
paymentAgentStatus?: string | undefined;
|
|
87
|
+
paymentLink?: string | undefined;
|
|
88
|
+
qrLink?: string | undefined;
|
|
89
|
+
cryptoAddress?: string | undefined;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface GetExchangePaymentsResponse {
|
|
93
|
+
payments: GetExchangePaymentsItem[];
|
|
94
|
+
page: number;
|
|
95
|
+
limit: number;
|
|
96
|
+
total: number;
|
|
97
|
+
totalPages: number;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface CreateExchangeDealRequest {
|
|
101
|
+
managerUserId?: string | undefined;
|
|
102
|
+
managerId?: string | undefined;
|
|
103
|
+
calculationId?: string | undefined;
|
|
104
|
+
paymentId?: string | undefined;
|
|
105
|
+
methodId: string;
|
|
106
|
+
inputWalletId: string;
|
|
107
|
+
outputWalletId: string;
|
|
108
|
+
inputAmount?: number | undefined;
|
|
109
|
+
outputAmount?: number | undefined;
|
|
110
|
+
factOutputAmount?: number | undefined;
|
|
111
|
+
inputCurrencyId?: string | undefined;
|
|
112
|
+
outputCurrencyId?: string | undefined;
|
|
113
|
+
customerId?: string | undefined;
|
|
114
|
+
expensesForCourier?: number | undefined;
|
|
115
|
+
includeInTotalCalculation?: boolean | undefined;
|
|
116
|
+
oneCurrencyExchange?: boolean | undefined;
|
|
117
|
+
receivedFromDealer?: boolean | undefined;
|
|
118
|
+
receivedFromDealerWalletId?: string | undefined;
|
|
119
|
+
customerDocName?: string | undefined;
|
|
120
|
+
customerDocNationality?: string | undefined;
|
|
121
|
+
customerDocNumber?: string | undefined;
|
|
122
|
+
customerSource?: string | undefined;
|
|
123
|
+
customerReferrer?: string | undefined;
|
|
124
|
+
receipts: number[];
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface CreateExchangeDealResult {
|
|
128
|
+
exchangeId: string;
|
|
129
|
+
customerId: string;
|
|
130
|
+
inputAmount: number;
|
|
131
|
+
inputCurrencyId: string;
|
|
132
|
+
outputAmount: number;
|
|
133
|
+
outputCurrencyId: string;
|
|
134
|
+
status: string;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export interface CreateExchangeDealResponse {
|
|
138
|
+
ok: boolean;
|
|
139
|
+
result?: CreateExchangeDealResult | undefined;
|
|
140
|
+
error?: string | undefined;
|
|
141
|
+
validationErrors?: { [key: string]: any } | undefined;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export const EXCHANGE_CORE_PACKAGE_NAME = "exchange_core";
|
|
145
|
+
|
|
146
|
+
wrappers[".google.protobuf.Struct"] = { fromObject: Struct.wrap, toObject: Struct.unwrap } as any;
|
|
147
|
+
|
|
148
|
+
export interface ExchangeCoreServiceClient {
|
|
149
|
+
createExchangeOrder(request: CreateExchangeOrderRequest): Observable<CreateExchangeOrderResponse>;
|
|
150
|
+
|
|
151
|
+
createExchangePayment(request: CreateExchangePaymentRequest): Observable<CreateExchangePaymentResponse>;
|
|
152
|
+
|
|
153
|
+
handlePaymentWebhook(request: HandlePaymentWebhookRequest): Observable<HandlePaymentWebhookResponse>;
|
|
154
|
+
|
|
155
|
+
getExchangePayments(request: GetExchangePaymentsRequest): Observable<GetExchangePaymentsResponse>;
|
|
156
|
+
|
|
157
|
+
createExchangeDeal(request: CreateExchangeDealRequest): Observable<CreateExchangeDealResponse>;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export interface ExchangeCoreServiceController {
|
|
161
|
+
createExchangeOrder(
|
|
162
|
+
request: CreateExchangeOrderRequest,
|
|
163
|
+
): Promise<CreateExchangeOrderResponse> | Observable<CreateExchangeOrderResponse> | CreateExchangeOrderResponse;
|
|
164
|
+
|
|
165
|
+
createExchangePayment(
|
|
166
|
+
request: CreateExchangePaymentRequest,
|
|
167
|
+
): Promise<CreateExchangePaymentResponse> | Observable<CreateExchangePaymentResponse> | CreateExchangePaymentResponse;
|
|
168
|
+
|
|
169
|
+
handlePaymentWebhook(
|
|
170
|
+
request: HandlePaymentWebhookRequest,
|
|
171
|
+
): Promise<HandlePaymentWebhookResponse> | Observable<HandlePaymentWebhookResponse> | HandlePaymentWebhookResponse;
|
|
172
|
+
|
|
173
|
+
getExchangePayments(
|
|
174
|
+
request: GetExchangePaymentsRequest,
|
|
175
|
+
): Promise<GetExchangePaymentsResponse> | Observable<GetExchangePaymentsResponse> | GetExchangePaymentsResponse;
|
|
176
|
+
|
|
177
|
+
createExchangeDeal(
|
|
178
|
+
request: CreateExchangeDealRequest,
|
|
179
|
+
): Promise<CreateExchangeDealResponse> | Observable<CreateExchangeDealResponse> | CreateExchangeDealResponse;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export function ExchangeCoreServiceControllerMethods() {
|
|
183
|
+
return function (constructor: Function) {
|
|
184
|
+
const grpcMethods: string[] = [
|
|
185
|
+
"createExchangeOrder",
|
|
186
|
+
"createExchangePayment",
|
|
187
|
+
"handlePaymentWebhook",
|
|
188
|
+
"getExchangePayments",
|
|
189
|
+
"createExchangeDeal",
|
|
190
|
+
];
|
|
191
|
+
for (const method of grpcMethods) {
|
|
192
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
193
|
+
GrpcMethod("ExchangeCoreService", method)(constructor.prototype[method], method, descriptor);
|
|
194
|
+
}
|
|
195
|
+
const grpcStreamMethods: string[] = [];
|
|
196
|
+
for (const method of grpcStreamMethods) {
|
|
197
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
198
|
+
GrpcStreamMethod("ExchangeCoreService", method)(constructor.prototype[method], method, descriptor);
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export const EXCHANGE_CORE_SERVICE_NAME = "ExchangeCoreService";
|
package/gen/exchange_rates.ts
CHANGED
|
@@ -6,26 +6,29 @@
|
|
|
6
6
|
|
|
7
7
|
/* eslint-disable */
|
|
8
8
|
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { wrappers } from "protobufjs";
|
|
9
10
|
import { Observable } from "rxjs";
|
|
11
|
+
import { Struct } from "./google/protobuf/struct";
|
|
10
12
|
|
|
11
13
|
export const protobufPackage = "exchange_rates";
|
|
12
14
|
|
|
13
15
|
export interface CalculateExchangeRequest {
|
|
14
|
-
managerUserId:
|
|
16
|
+
managerUserId: string;
|
|
17
|
+
managerId?: string | undefined;
|
|
15
18
|
inputCurrency: string;
|
|
16
19
|
outputCurrency: string;
|
|
17
20
|
currencyForAmount: string;
|
|
18
21
|
amount: number;
|
|
19
22
|
adjustment?: number | undefined;
|
|
20
23
|
promoDiscount?: number | undefined;
|
|
21
|
-
customerId?:
|
|
24
|
+
customerId?: string | undefined;
|
|
22
25
|
disableRounding?: boolean | undefined;
|
|
23
26
|
fixedRate?: number | undefined;
|
|
24
27
|
}
|
|
25
28
|
|
|
26
|
-
export interface
|
|
29
|
+
export interface CalculateExchangeResult {
|
|
27
30
|
result: boolean;
|
|
28
|
-
calculationId?:
|
|
31
|
+
calculationId?: string | undefined;
|
|
29
32
|
inputCurrencyQuantity: number;
|
|
30
33
|
outputCurrencyQuantity: number;
|
|
31
34
|
exchangeRateForMessage: string;
|
|
@@ -34,21 +37,28 @@ export interface CalculateExchangeResponse {
|
|
|
34
37
|
finalPercent: number;
|
|
35
38
|
adjustment: number;
|
|
36
39
|
hasCustomer: boolean;
|
|
37
|
-
customerId?:
|
|
40
|
+
customerId?: string | undefined;
|
|
38
41
|
availableAgents: number[];
|
|
39
42
|
}
|
|
40
43
|
|
|
44
|
+
export interface CalculateExchangeResponse {
|
|
45
|
+
ok: boolean;
|
|
46
|
+
result?: CalculateExchangeResult | undefined;
|
|
47
|
+
error?: string | undefined;
|
|
48
|
+
validationErrors?: { [key: string]: any } | undefined;
|
|
49
|
+
}
|
|
50
|
+
|
|
41
51
|
export interface GetExchangeCalculationRequest {
|
|
42
|
-
calculationId
|
|
52
|
+
calculationId: string;
|
|
43
53
|
}
|
|
44
54
|
|
|
45
55
|
export interface ExchangeCalculation {
|
|
46
|
-
id:
|
|
47
|
-
customerId?:
|
|
48
|
-
managerId?:
|
|
49
|
-
inputCurrencyId:
|
|
50
|
-
outputCurrencyId:
|
|
51
|
-
currencyForAmountId:
|
|
56
|
+
id: string;
|
|
57
|
+
customerId?: string | undefined;
|
|
58
|
+
managerId?: string | undefined;
|
|
59
|
+
inputCurrencyId: string;
|
|
60
|
+
outputCurrencyId: string;
|
|
61
|
+
currencyForAmountId: string;
|
|
52
62
|
amount: number;
|
|
53
63
|
inputCurrencyQuantity: number;
|
|
54
64
|
outputCurrencyQuantity: number;
|
|
@@ -62,25 +72,28 @@ export interface ExchangeCalculation {
|
|
|
62
72
|
}
|
|
63
73
|
|
|
64
74
|
export interface GetExchangeCalculationResponse {
|
|
65
|
-
|
|
66
|
-
|
|
75
|
+
exist: boolean;
|
|
76
|
+
result?: ExchangeCalculation | undefined;
|
|
67
77
|
}
|
|
68
78
|
|
|
69
|
-
export interface
|
|
79
|
+
export interface GetExchangeRatesRequest {
|
|
70
80
|
}
|
|
71
81
|
|
|
72
|
-
export interface
|
|
73
|
-
|
|
82
|
+
export interface GetExchangeRatesResponse {
|
|
83
|
+
exist: boolean;
|
|
84
|
+
result?: string | undefined;
|
|
74
85
|
}
|
|
75
86
|
|
|
76
87
|
export const EXCHANGE_RATES_PACKAGE_NAME = "exchange_rates";
|
|
77
88
|
|
|
89
|
+
wrappers[".google.protobuf.Struct"] = { fromObject: Struct.wrap, toObject: Struct.unwrap } as any;
|
|
90
|
+
|
|
78
91
|
export interface ExchangeRatesServiceClient {
|
|
79
92
|
calculateExchange(request: CalculateExchangeRequest): Observable<CalculateExchangeResponse>;
|
|
80
93
|
|
|
81
94
|
getExchangeCalculation(request: GetExchangeCalculationRequest): Observable<GetExchangeCalculationResponse>;
|
|
82
95
|
|
|
83
|
-
|
|
96
|
+
getExchangeRates(request: GetExchangeRatesRequest): Observable<GetExchangeRatesResponse>;
|
|
84
97
|
}
|
|
85
98
|
|
|
86
99
|
export interface ExchangeRatesServiceController {
|
|
@@ -95,14 +108,14 @@ export interface ExchangeRatesServiceController {
|
|
|
95
108
|
| Observable<GetExchangeCalculationResponse>
|
|
96
109
|
| GetExchangeCalculationResponse;
|
|
97
110
|
|
|
98
|
-
|
|
99
|
-
request:
|
|
100
|
-
): Promise<
|
|
111
|
+
getExchangeRates(
|
|
112
|
+
request: GetExchangeRatesRequest,
|
|
113
|
+
): Promise<GetExchangeRatesResponse> | Observable<GetExchangeRatesResponse> | GetExchangeRatesResponse;
|
|
101
114
|
}
|
|
102
115
|
|
|
103
116
|
export function ExchangeRatesServiceControllerMethods() {
|
|
104
117
|
return function (constructor: Function) {
|
|
105
|
-
const grpcMethods: string[] = ["calculateExchange", "getExchangeCalculation", "
|
|
118
|
+
const grpcMethods: string[] = ["calculateExchange", "getExchangeCalculation", "getExchangeRates"];
|
|
106
119
|
for (const method of grpcMethods) {
|
|
107
120
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
108
121
|
GrpcMethod("ExchangeRatesService", method)(constructor.prototype[method], method, descriptor);
|
|
@@ -0,0 +1,197 @@
|
|
|
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: google/protobuf/struct.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { wrappers } from "protobufjs";
|
|
9
|
+
|
|
10
|
+
export const protobufPackage = "google.protobuf";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* `NullValue` is a singleton enumeration to represent the null value for the
|
|
14
|
+
* `Value` type union.
|
|
15
|
+
*
|
|
16
|
+
* The JSON representation for `NullValue` is JSON `null`.
|
|
17
|
+
*/
|
|
18
|
+
export enum NullValue {
|
|
19
|
+
/** NULL_VALUE - Null value. */
|
|
20
|
+
NULL_VALUE = 0,
|
|
21
|
+
UNRECOGNIZED = -1,
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* `Struct` represents a structured data value, consisting of fields
|
|
26
|
+
* which map to dynamically typed values. In some languages, `Struct`
|
|
27
|
+
* might be supported by a native representation. For example, in
|
|
28
|
+
* scripting languages like JS a struct is represented as an
|
|
29
|
+
* object. The details of that representation are described together
|
|
30
|
+
* with the proto support for the language.
|
|
31
|
+
*
|
|
32
|
+
* The JSON representation for `Struct` is JSON object.
|
|
33
|
+
*/
|
|
34
|
+
export interface Struct {
|
|
35
|
+
/** Unordered map of dynamically typed values. */
|
|
36
|
+
fields: { [key: string]: any | undefined };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface Struct_FieldsEntry {
|
|
40
|
+
key: string;
|
|
41
|
+
value: any | undefined;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* `Value` represents a dynamically typed value which can be either
|
|
46
|
+
* null, a number, a string, a boolean, a recursive struct value, or a
|
|
47
|
+
* list of values. A producer of value is expected to set one of these
|
|
48
|
+
* variants. Absence of any variant indicates an error.
|
|
49
|
+
*
|
|
50
|
+
* The JSON representation for `Value` is JSON value.
|
|
51
|
+
*/
|
|
52
|
+
export interface Value {
|
|
53
|
+
/** Represents a null value. */
|
|
54
|
+
nullValue?:
|
|
55
|
+
| NullValue
|
|
56
|
+
| undefined;
|
|
57
|
+
/** Represents a double value. */
|
|
58
|
+
numberValue?:
|
|
59
|
+
| number
|
|
60
|
+
| undefined;
|
|
61
|
+
/** Represents a string value. */
|
|
62
|
+
stringValue?:
|
|
63
|
+
| string
|
|
64
|
+
| undefined;
|
|
65
|
+
/** Represents a boolean value. */
|
|
66
|
+
boolValue?:
|
|
67
|
+
| boolean
|
|
68
|
+
| undefined;
|
|
69
|
+
/** Represents a structured value. */
|
|
70
|
+
structValue?:
|
|
71
|
+
| { [key: string]: any }
|
|
72
|
+
| undefined;
|
|
73
|
+
/** Represents a repeated `Value`. */
|
|
74
|
+
listValue?: Array<any> | undefined;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* `ListValue` is a wrapper around a repeated field of values.
|
|
79
|
+
*
|
|
80
|
+
* The JSON representation for `ListValue` is JSON array.
|
|
81
|
+
*/
|
|
82
|
+
export interface ListValue {
|
|
83
|
+
/** Repeated field of dynamically typed values. */
|
|
84
|
+
values: any[];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export const GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf";
|
|
88
|
+
|
|
89
|
+
function createBaseStruct(): Struct {
|
|
90
|
+
return { fields: {} };
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export const Struct: MessageFns<Struct> & StructWrapperFns = {
|
|
94
|
+
wrap(object: { [key: string]: any } | undefined): Struct {
|
|
95
|
+
const struct = createBaseStruct();
|
|
96
|
+
|
|
97
|
+
if (object !== undefined) {
|
|
98
|
+
for (const key of globalThis.Object.keys(object)) {
|
|
99
|
+
struct.fields[key] = Value.wrap(object[key]);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return struct;
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
unwrap(message: Struct): { [key: string]: any } {
|
|
106
|
+
const object: { [key: string]: any } = {};
|
|
107
|
+
if (message.fields) {
|
|
108
|
+
for (const key of globalThis.Object.keys(message.fields)) {
|
|
109
|
+
object[key] = Value.unwrap(message.fields[key]);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return object;
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
function createBaseValue(): Value {
|
|
117
|
+
return {};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export const Value: MessageFns<Value> & AnyValueWrapperFns = {
|
|
121
|
+
wrap(value: any): Value {
|
|
122
|
+
const result = {} as any;
|
|
123
|
+
if (value === null) {
|
|
124
|
+
result.nullValue = NullValue.NULL_VALUE;
|
|
125
|
+
} else if (typeof value === "boolean") {
|
|
126
|
+
result.boolValue = value;
|
|
127
|
+
} else if (typeof value === "number") {
|
|
128
|
+
result.numberValue = value;
|
|
129
|
+
} else if (typeof value === "string") {
|
|
130
|
+
result.stringValue = value;
|
|
131
|
+
} else if (globalThis.Array.isArray(value)) {
|
|
132
|
+
result.listValue = ListValue.wrap(value);
|
|
133
|
+
} else if (typeof value === "object") {
|
|
134
|
+
result.structValue = Struct.wrap(value);
|
|
135
|
+
} else if (typeof value !== "undefined") {
|
|
136
|
+
throw new globalThis.Error("Unsupported any value type: " + typeof value);
|
|
137
|
+
}
|
|
138
|
+
return result;
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
unwrap(message: any): string | number | boolean | Object | null | Array<any> | undefined {
|
|
142
|
+
if (message?.hasOwnProperty("stringValue") && message.stringValue !== undefined) {
|
|
143
|
+
return message.stringValue;
|
|
144
|
+
} else if (message?.hasOwnProperty("numberValue") && message?.numberValue !== undefined) {
|
|
145
|
+
return message.numberValue;
|
|
146
|
+
} else if (message?.hasOwnProperty("boolValue") && message?.boolValue !== undefined) {
|
|
147
|
+
return message.boolValue;
|
|
148
|
+
} else if (message?.hasOwnProperty("structValue") && message?.structValue !== undefined) {
|
|
149
|
+
return Struct.unwrap(message.structValue as any);
|
|
150
|
+
} else if (message?.hasOwnProperty("listValue") && message?.listValue !== undefined) {
|
|
151
|
+
return ListValue.unwrap(message.listValue);
|
|
152
|
+
} else if (message?.hasOwnProperty("nullValue") && message?.nullValue !== undefined) {
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
return undefined;
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
function createBaseListValue(): ListValue {
|
|
160
|
+
return { values: [] };
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export const ListValue: MessageFns<ListValue> & ListValueWrapperFns = {
|
|
164
|
+
wrap(array: Array<any> | undefined): ListValue {
|
|
165
|
+
const result = createBaseListValue();
|
|
166
|
+
result.values = (array ?? []).map(Value.wrap);
|
|
167
|
+
return result;
|
|
168
|
+
},
|
|
169
|
+
|
|
170
|
+
unwrap(message: ListValue): Array<any> {
|
|
171
|
+
if (message?.hasOwnProperty("values") && globalThis.Array.isArray(message.values)) {
|
|
172
|
+
return message.values.map(Value.unwrap);
|
|
173
|
+
} else {
|
|
174
|
+
return message as any;
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
wrappers[".google.protobuf.Struct"] = { fromObject: Struct.wrap, toObject: Struct.unwrap } as any;
|
|
180
|
+
|
|
181
|
+
export interface MessageFns<T> {
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export interface StructWrapperFns {
|
|
185
|
+
wrap(object: { [key: string]: any } | undefined): Struct;
|
|
186
|
+
unwrap(message: Struct): { [key: string]: any };
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export interface AnyValueWrapperFns {
|
|
190
|
+
wrap(value: any): Value;
|
|
191
|
+
unwrap(message: any): string | number | boolean | Object | null | Array<any> | undefined;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export interface ListValueWrapperFns {
|
|
195
|
+
wrap(array: Array<any> | undefined): ListValue;
|
|
196
|
+
unwrap(message: ListValue): Array<any>;
|
|
197
|
+
}
|
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.204",
|
|
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,158 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package exchange_core;
|
|
4
|
+
|
|
5
|
+
import "google/protobuf/struct.proto";
|
|
6
|
+
|
|
7
|
+
option csharp_namespace = "ExchangeCore";
|
|
8
|
+
option java_multiple_files = true;
|
|
9
|
+
option java_package = "com.arbiwallet.exchange.core";
|
|
10
|
+
|
|
11
|
+
service ExchangeCoreService {
|
|
12
|
+
rpc CreateExchangeOrder(CreateExchangeOrderRequest) returns (CreateExchangeOrderResponse);
|
|
13
|
+
|
|
14
|
+
rpc CreateExchangePayment(CreateExchangePaymentRequest) returns (CreateExchangePaymentResponse);
|
|
15
|
+
rpc HandlePaymentWebhook(HandlePaymentWebhookRequest) returns (HandlePaymentWebhookResponse);
|
|
16
|
+
rpc GetExchangePayments(GetExchangePaymentsRequest) returns (GetExchangePaymentsResponse);
|
|
17
|
+
|
|
18
|
+
rpc CreateExchangeDeal(CreateExchangeDealRequest) returns (CreateExchangeDealResponse);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
message CreateExchangeOrderRequest {
|
|
22
|
+
double input_amount = 1;
|
|
23
|
+
double output_amount = 2;
|
|
24
|
+
string input_currency = 3;
|
|
25
|
+
string output_currency = 4;
|
|
26
|
+
string withdraw_type = 5;
|
|
27
|
+
string customer = 6;
|
|
28
|
+
optional string receive_bank = 7;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
message CreateExchangeOrderResponse {
|
|
32
|
+
bool success = 1;
|
|
33
|
+
int32 status_code = 2;
|
|
34
|
+
optional string order_id = 3;
|
|
35
|
+
optional string message = 4;
|
|
36
|
+
optional string warning = 5;
|
|
37
|
+
optional string error = 6;
|
|
38
|
+
repeated string errors = 7;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
message CreateExchangePaymentRequest {
|
|
42
|
+
optional string manager_user_id = 1;
|
|
43
|
+
optional string manager_id = 2;
|
|
44
|
+
|
|
45
|
+
optional string calculation_id = 3;
|
|
46
|
+
int32 agent_id = 4;
|
|
47
|
+
optional double amount = 5;
|
|
48
|
+
optional string customer_id = 6;
|
|
49
|
+
optional string crypto_network = 7;
|
|
50
|
+
optional string customer_source = 8;
|
|
51
|
+
optional string customer_referrer = 9;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
message CreateExchangePaymentResult {
|
|
55
|
+
string payment_id = 1;
|
|
56
|
+
string payment_uuid = 2;
|
|
57
|
+
double amount = 3;
|
|
58
|
+
int32 status = 4;
|
|
59
|
+
string agent = 5;
|
|
60
|
+
optional string wallet_id = 6;
|
|
61
|
+
optional string crypto_network = 7;
|
|
62
|
+
optional string crypto_address = 8;
|
|
63
|
+
optional string arbi_link = 9;
|
|
64
|
+
optional string payment_link = 10;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
message CreateExchangePaymentResponse {
|
|
68
|
+
bool ok = 1;
|
|
69
|
+
optional CreateExchangePaymentResult result = 2;
|
|
70
|
+
optional string error = 3;
|
|
71
|
+
optional google.protobuf.Struct validationErrors = 4;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
message HandlePaymentWebhookRequest {
|
|
75
|
+
string json_payload = 1;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
message HandlePaymentWebhookResponse {
|
|
79
|
+
bool ok = 1;
|
|
80
|
+
string status = 2;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
message GetExchangePaymentsRequest {
|
|
84
|
+
optional int32 page = 1;
|
|
85
|
+
optional int32 limit = 2;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
message GetExchangePaymentsItem {
|
|
89
|
+
string payment_id = 1;
|
|
90
|
+
string payment_uuid = 2;
|
|
91
|
+
double amount = 3;
|
|
92
|
+
int32 status = 4;
|
|
93
|
+
optional string payment_agent_status = 5;
|
|
94
|
+
optional string payment_link = 6;
|
|
95
|
+
optional string qr_link = 7;
|
|
96
|
+
optional string crypto_address = 8;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
message GetExchangePaymentsResponse {
|
|
100
|
+
repeated GetExchangePaymentsItem payments = 1;
|
|
101
|
+
int32 page = 2;
|
|
102
|
+
int32 limit = 3;
|
|
103
|
+
int32 total = 4;
|
|
104
|
+
int32 total_pages = 5;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
message CreateExchangeDealRequest {
|
|
108
|
+
optional string manager_user_id = 1;
|
|
109
|
+
optional string manager_id = 2;
|
|
110
|
+
|
|
111
|
+
optional string calculation_id = 3;
|
|
112
|
+
optional string payment_id = 4;
|
|
113
|
+
|
|
114
|
+
string method_id = 5;
|
|
115
|
+
string input_wallet_id = 6;
|
|
116
|
+
string output_wallet_id = 7;
|
|
117
|
+
|
|
118
|
+
optional double input_amount = 8;
|
|
119
|
+
optional double output_amount = 9;
|
|
120
|
+
optional double fact_output_amount = 10;
|
|
121
|
+
|
|
122
|
+
optional string input_currency_id = 11;
|
|
123
|
+
optional string output_currency_id = 12;
|
|
124
|
+
|
|
125
|
+
optional string customer_id = 13;
|
|
126
|
+
|
|
127
|
+
optional double expenses_for_courier = 14;
|
|
128
|
+
optional bool include_in_total_calculation = 15;
|
|
129
|
+
optional bool one_currency_exchange = 16;
|
|
130
|
+
optional bool received_from_dealer = 17;
|
|
131
|
+
optional string received_from_dealer_wallet_id = 18;
|
|
132
|
+
|
|
133
|
+
optional string customer_doc_name = 19;
|
|
134
|
+
optional string customer_doc_nationality = 20;
|
|
135
|
+
optional string customer_doc_number = 21;
|
|
136
|
+
|
|
137
|
+
optional string customer_source = 22;
|
|
138
|
+
optional string customer_referrer = 23;
|
|
139
|
+
|
|
140
|
+
repeated double receipts = 25;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
message CreateExchangeDealResult {
|
|
144
|
+
string exchange_id = 1;
|
|
145
|
+
string customer_id = 2;
|
|
146
|
+
double input_amount = 3;
|
|
147
|
+
string input_currency_id = 4;
|
|
148
|
+
double output_amount = 5;
|
|
149
|
+
string output_currency_id = 6;
|
|
150
|
+
string status = 7;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
message CreateExchangeDealResponse {
|
|
154
|
+
bool ok = 1;
|
|
155
|
+
optional CreateExchangeDealResult result = 2;
|
|
156
|
+
optional string error = 3;
|
|
157
|
+
optional google.protobuf.Struct validationErrors = 4;
|
|
158
|
+
}
|
|
@@ -2,6 +2,8 @@ syntax = "proto3";
|
|
|
2
2
|
|
|
3
3
|
package exchange_rates;
|
|
4
4
|
|
|
5
|
+
import "google/protobuf/struct.proto";
|
|
6
|
+
|
|
5
7
|
option csharp_namespace = "ExchangeRates";
|
|
6
8
|
option java_multiple_files = true;
|
|
7
9
|
option java_package = "com.arbiwallet.exchange.rates";
|
|
@@ -9,25 +11,27 @@ option java_package = "com.arbiwallet.exchange.rates";
|
|
|
9
11
|
service ExchangeRatesService {
|
|
10
12
|
rpc CalculateExchange(CalculateExchangeRequest) returns (CalculateExchangeResponse);
|
|
11
13
|
rpc GetExchangeCalculation(GetExchangeCalculationRequest) returns (GetExchangeCalculationResponse);
|
|
12
|
-
rpc
|
|
14
|
+
rpc GetExchangeRates(GetExchangeRatesRequest) returns (GetExchangeRatesResponse);
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
message CalculateExchangeRequest {
|
|
16
|
-
|
|
17
|
-
string
|
|
18
|
-
|
|
19
|
-
string
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
optional
|
|
24
|
-
optional
|
|
25
|
-
optional
|
|
18
|
+
string manager_user_id = 1;
|
|
19
|
+
optional string manager_id = 2;
|
|
20
|
+
|
|
21
|
+
string input_currency = 3;
|
|
22
|
+
string output_currency = 4;
|
|
23
|
+
string currency_for_amount = 5;
|
|
24
|
+
double amount = 6;
|
|
25
|
+
optional double adjustment = 7;
|
|
26
|
+
optional double promo_discount = 8;
|
|
27
|
+
optional string customer_id = 9;
|
|
28
|
+
optional bool disable_rounding = 10;
|
|
29
|
+
optional double fixed_rate = 11;
|
|
26
30
|
}
|
|
27
31
|
|
|
28
|
-
message
|
|
32
|
+
message CalculateExchangeResult {
|
|
29
33
|
bool result = 1;
|
|
30
|
-
optional
|
|
34
|
+
optional string calculation_id = 2;
|
|
31
35
|
double input_currency_quantity = 3;
|
|
32
36
|
double output_currency_quantity = 4;
|
|
33
37
|
string exchange_rate_for_message = 5;
|
|
@@ -36,21 +40,28 @@ message CalculateExchangeResponse {
|
|
|
36
40
|
double final_percent = 8;
|
|
37
41
|
double adjustment = 9;
|
|
38
42
|
bool has_customer = 10;
|
|
39
|
-
optional
|
|
40
|
-
repeated
|
|
43
|
+
optional string customer_id = 11;
|
|
44
|
+
repeated int32 available_agents = 12;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
message CalculateExchangeResponse {
|
|
48
|
+
bool ok = 1;
|
|
49
|
+
optional CalculateExchangeResult result = 2;
|
|
50
|
+
optional string error = 3;
|
|
51
|
+
optional google.protobuf.Struct validationErrors = 4;
|
|
41
52
|
}
|
|
42
53
|
|
|
43
54
|
message GetExchangeCalculationRequest {
|
|
44
|
-
|
|
55
|
+
string calculation_id = 1;
|
|
45
56
|
}
|
|
46
57
|
|
|
47
58
|
message ExchangeCalculation {
|
|
48
|
-
|
|
49
|
-
optional
|
|
50
|
-
optional
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
59
|
+
string id = 1;
|
|
60
|
+
optional string customer_id = 2;
|
|
61
|
+
optional string manager_id = 3;
|
|
62
|
+
string input_currency_id = 4;
|
|
63
|
+
string output_currency_id = 5;
|
|
64
|
+
string currency_for_amount_id = 6;
|
|
54
65
|
double amount = 7;
|
|
55
66
|
double input_currency_quantity = 8;
|
|
56
67
|
double output_currency_quantity = 9;
|
|
@@ -64,12 +75,13 @@ message ExchangeCalculation {
|
|
|
64
75
|
}
|
|
65
76
|
|
|
66
77
|
message GetExchangeCalculationResponse {
|
|
67
|
-
bool
|
|
68
|
-
optional ExchangeCalculation
|
|
78
|
+
bool exist = 1;
|
|
79
|
+
optional ExchangeCalculation result = 2;
|
|
69
80
|
}
|
|
70
81
|
|
|
71
|
-
message
|
|
82
|
+
message GetExchangeRatesRequest {}
|
|
72
83
|
|
|
73
|
-
message
|
|
74
|
-
|
|
84
|
+
message GetExchangeRatesResponse {
|
|
85
|
+
bool exist = 1;
|
|
86
|
+
optional string result = 2;
|
|
75
87
|
}
|