@riocrypto/common 1.0.488 → 1.0.490

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.
@@ -0,0 +1,82 @@
1
+ import { AxiosInstance, AxiosStatic } from "axios";
2
+ import { Admin } from "../types/admin";
3
+ import { BankPayout } from "../types/bank-payout";
4
+ import { BusinessUser } from "../types/business-user";
5
+ import { BusinessUserInput } from "../types/business-user-input";
6
+ import { BusinessUserUpdate } from "../types/business-user-update";
7
+ import { CheckedAddress } from "../types/checked-address";
8
+ import { Country } from "../types/country";
9
+ import { Fiat } from "../types/fiat";
10
+ import { Order } from "../types/order";
11
+ import { OrderInput } from "../types/order-input";
12
+ import { Partner } from "../types/partner";
13
+ import { PaymentMethod } from "../types/payment-method";
14
+ import { PayoutMethod } from "../types/payout-method";
15
+ import { RioSettings } from "../types/rio-settings";
16
+ import { RioSettingsUpdate } from "../types/rio-settings-update";
17
+ import { SecurityQuestion } from "../types/security-question";
18
+ import { User } from "../types/user";
19
+ import { UserInput } from "../types/user-input";
20
+ import { UserUpdate } from "../types/user-update";
21
+ export declare class RioClient {
22
+ private axios;
23
+ constructor(axios: AxiosStatic | AxiosInstance);
24
+ getOrders(): Promise<Order[]>;
25
+ getUsers(): Promise<User[]>;
26
+ getBusinessUsers(): Promise<BusinessUser[]>;
27
+ signin(email: string, password: string): Promise<any>;
28
+ updateUser(userId: string, update: UserUpdate): Promise<User>;
29
+ updateBusinessUser(businessUserId: string, update: BusinessUserUpdate): Promise<BusinessUser>;
30
+ updateAdminUserPassword({ password, newPassword, }: {
31
+ password: string;
32
+ newPassword: string;
33
+ }): Promise<Admin>;
34
+ getAdminUser(): Promise<any>;
35
+ signoutAdmin(): Promise<void>;
36
+ getRioSettings(): Promise<RioSettings>;
37
+ createRioSettings(rioSettings: {
38
+ platformFee: number;
39
+ }): Promise<void>;
40
+ updateRioSettings(update: RioSettingsUpdate): Promise<void>;
41
+ confirmBankPayment(orderId: string): Promise<any>;
42
+ getUser(): Promise<User>;
43
+ getBusinessUser(): Promise<BusinessUser>;
44
+ createUser(user: UserInput): Promise<void>;
45
+ createBusinessUser(businessUser: BusinessUserInput): Promise<BusinessUser>;
46
+ createBrokerCustomer(businessUser: BusinessUserInput): Promise<BusinessUser>;
47
+ sendPhoneAuthCode(phoneNumber: string): Promise<void>;
48
+ authExists(phoneNumber: string): Promise<boolean>;
49
+ addSecurityQuestion(question: SecurityQuestion, answer: string): Promise<void>;
50
+ uploadCOI(businessUserId: string, formData: FormData): Promise<BusinessUser>;
51
+ uploadKYCReport(businessUserId: string, formData: FormData): Promise<BusinessUser>;
52
+ getSecurityQuestion(): Promise<SecurityQuestion>;
53
+ signout(): Promise<void>;
54
+ verifyPhoneCode(phoneNumber: string, code: string): Promise<void>;
55
+ createAuth(password: string): Promise<void>;
56
+ resetPassword(answer: string, password: string): Promise<void>;
57
+ createBuyOrder(order: OrderInput): Promise<Order>;
58
+ createSellOrder(order: OrderInput): Promise<Order>;
59
+ getOrder(id: string): Promise<Order>;
60
+ initBankPayout(oid: string, accountNumber: string): Promise<BankPayout>;
61
+ getBankPayout(orderId: string): Promise<BankPayout>;
62
+ checkAddress(address: string, crypto: Crypto): Promise<CheckedAddress>;
63
+ getSupportedPaymentMethods(fiat: Fiat, country: Country): Promise<PaymentMethod[]>;
64
+ getBrokerCustomers(): Promise<BusinessUser[]>;
65
+ getSupportedPayoutMethods(fiat: Fiat, country: Country): Promise<PayoutMethod[]>;
66
+ getPartnerLayout(partnerId: string): Promise<Partner>;
67
+ createClipCardPayment(orderId: string): Promise<{
68
+ paymentId: string;
69
+ paymentRequestUrl: string;
70
+ }>;
71
+ createConektaPayment(orderId: string): Promise<{
72
+ checkoutRequestId: string;
73
+ }>;
74
+ createKushkiPayment(orderId: string, token: string): Promise<{
75
+ paymentId: string;
76
+ }>;
77
+ createKushkiBankPayment(orderId: string): Promise<any>;
78
+ createSPEIPayment(orderId: string): Promise<any>;
79
+ createSPIDPayment(orderId: string): Promise<any>;
80
+ createSWIFTPayment(orderId: string): Promise<any>;
81
+ createInterbankPayment(orderId: string): Promise<any>;
82
+ }
@@ -0,0 +1,331 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.RioClient = void 0;
13
+ class RioClient {
14
+ constructor(axios) {
15
+ this.axios = axios;
16
+ }
17
+ getOrders() {
18
+ return __awaiter(this, void 0, void 0, function* () {
19
+ const { data } = yield this.axios.get(`/api/orders`);
20
+ return data;
21
+ });
22
+ }
23
+ getUsers() {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ const { data } = yield this.axios.get(`/api/users`);
26
+ return data;
27
+ });
28
+ }
29
+ getBusinessUsers() {
30
+ return __awaiter(this, void 0, void 0, function* () {
31
+ const { data } = yield this.axios.get(`/api/business/users`);
32
+ return data;
33
+ });
34
+ }
35
+ signin(email, password) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ const { data } = yield this.axios.post(`/api/admin/signin`, {
38
+ email,
39
+ password,
40
+ });
41
+ return data;
42
+ });
43
+ }
44
+ updateUser(userId, update) {
45
+ return __awaiter(this, void 0, void 0, function* () {
46
+ const { data } = yield this.axios.patch(`/api/users/${userId}`, update);
47
+ return data;
48
+ });
49
+ }
50
+ updateBusinessUser(businessUserId, update) {
51
+ return __awaiter(this, void 0, void 0, function* () {
52
+ const { data } = yield this.axios.patch(`/api/business/users/${businessUserId}`, update);
53
+ return data;
54
+ });
55
+ }
56
+ updateAdminUserPassword({ password, newPassword, }) {
57
+ return __awaiter(this, void 0, void 0, function* () {
58
+ const { data } = yield this.axios.patch(`/api/admin`, {
59
+ password,
60
+ newPassword,
61
+ });
62
+ return data;
63
+ });
64
+ }
65
+ getAdminUser() {
66
+ return __awaiter(this, void 0, void 0, function* () {
67
+ const { data } = yield this.axios.get(`/api/admin`);
68
+ return data;
69
+ });
70
+ }
71
+ signoutAdmin() {
72
+ return __awaiter(this, void 0, void 0, function* () {
73
+ yield this.axios.post("/api/admin/signout", {});
74
+ });
75
+ }
76
+ getRioSettings() {
77
+ return __awaiter(this, void 0, void 0, function* () {
78
+ const { data } = yield this.axios.get(`/api/settings`);
79
+ return data;
80
+ });
81
+ }
82
+ createRioSettings(rioSettings) {
83
+ return __awaiter(this, void 0, void 0, function* () {
84
+ yield this.axios.post(`/api/settings`, rioSettings);
85
+ });
86
+ }
87
+ updateRioSettings(update) {
88
+ return __awaiter(this, void 0, void 0, function* () {
89
+ const { data } = yield this.axios.patch(`/api/settings`, update);
90
+ return data;
91
+ });
92
+ }
93
+ confirmBankPayment(orderId) {
94
+ return __awaiter(this, void 0, void 0, function* () {
95
+ const { data } = yield this.axios.post(`/api/payments/bank/confirm`, {
96
+ orderId,
97
+ });
98
+ return data;
99
+ });
100
+ }
101
+ getUser() {
102
+ return __awaiter(this, void 0, void 0, function* () {
103
+ const { data } = yield this.axios.get("/api/users/current");
104
+ return data;
105
+ });
106
+ }
107
+ getBusinessUser() {
108
+ return __awaiter(this, void 0, void 0, function* () {
109
+ const { data } = yield this.axios.get("/api/business/users/current");
110
+ return data;
111
+ });
112
+ }
113
+ createUser(user) {
114
+ return __awaiter(this, void 0, void 0, function* () {
115
+ yield this.axios.post("/api/users/current-auth", user);
116
+ });
117
+ }
118
+ createBusinessUser(businessUser) {
119
+ return __awaiter(this, void 0, void 0, function* () {
120
+ const response = yield this.axios.post("/api/business/users/current-auth", businessUser);
121
+ return response.data;
122
+ });
123
+ }
124
+ createBrokerCustomer(businessUser) {
125
+ return __awaiter(this, void 0, void 0, function* () {
126
+ const response = yield this.axios.post("/api/business/users/broker-customers/current-auth", businessUser);
127
+ return response.data;
128
+ });
129
+ }
130
+ sendPhoneAuthCode(phoneNumber) {
131
+ return __awaiter(this, void 0, void 0, function* () {
132
+ yield this.axios.post("/api/auth/sendCode", {
133
+ phoneNumber,
134
+ });
135
+ });
136
+ }
137
+ authExists(phoneNumber) {
138
+ return __awaiter(this, void 0, void 0, function* () {
139
+ const response = yield this.axios.post("/api/auth/exists", {
140
+ phoneNumber,
141
+ });
142
+ return response.data.exists;
143
+ });
144
+ }
145
+ addSecurityQuestion(question, answer) {
146
+ return __awaiter(this, void 0, void 0, function* () {
147
+ yield this.axios.post("/api/auth/security-question", {
148
+ question,
149
+ answer,
150
+ });
151
+ });
152
+ }
153
+ uploadCOI(businessUserId, formData) {
154
+ return __awaiter(this, void 0, void 0, function* () {
155
+ const { data } = yield this.axios.patch(`/api/business/users/${businessUserId}/coi`, formData);
156
+ return data;
157
+ });
158
+ }
159
+ uploadKYCReport(businessUserId, formData) {
160
+ return __awaiter(this, void 0, void 0, function* () {
161
+ const { data } = yield this.axios.patch(`/api/business/users/${businessUserId}/kyc-report`, formData);
162
+ return data;
163
+ });
164
+ }
165
+ getSecurityQuestion() {
166
+ return __awaiter(this, void 0, void 0, function* () {
167
+ const response = yield this.axios.get("/api/auth/security-question", {});
168
+ return response.data.question;
169
+ });
170
+ }
171
+ signout() {
172
+ return __awaiter(this, void 0, void 0, function* () {
173
+ yield this.axios.post("/api/auth/signout", {});
174
+ });
175
+ }
176
+ verifyPhoneCode(phoneNumber, code) {
177
+ return __awaiter(this, void 0, void 0, function* () {
178
+ yield this.axios.post("/api/auth/verifycode", {
179
+ phoneNumber,
180
+ code,
181
+ });
182
+ });
183
+ }
184
+ createAuth(password) {
185
+ return __awaiter(this, void 0, void 0, function* () {
186
+ yield this.axios.post("/api/auth", {
187
+ password,
188
+ });
189
+ });
190
+ }
191
+ resetPassword(answer, password) {
192
+ return __awaiter(this, void 0, void 0, function* () {
193
+ yield this.axios.patch("/api/auth/password", {
194
+ answer,
195
+ password,
196
+ });
197
+ });
198
+ }
199
+ createBuyOrder(order) {
200
+ return __awaiter(this, void 0, void 0, function* () {
201
+ const response = yield this.axios.post("/api/orders/buy", order);
202
+ return response.data;
203
+ });
204
+ }
205
+ createSellOrder(order) {
206
+ return __awaiter(this, void 0, void 0, function* () {
207
+ const response = yield this.axios.post("/api/orders/sell", order);
208
+ return response.data;
209
+ });
210
+ }
211
+ getOrder(id) {
212
+ return __awaiter(this, void 0, void 0, function* () {
213
+ const response = yield this.axios.get(`/api/orders/${id}`);
214
+ return response.data;
215
+ });
216
+ }
217
+ initBankPayout(oid, accountNumber) {
218
+ return __awaiter(this, void 0, void 0, function* () {
219
+ const response = yield this.axios.post(`/api/payouts/bank`, {
220
+ orderId: oid,
221
+ accountNumber,
222
+ });
223
+ return response.data;
224
+ });
225
+ }
226
+ getBankPayout(orderId) {
227
+ return __awaiter(this, void 0, void 0, function* () {
228
+ const response = yield this.axios.get(`/api/payouts/bank?orderId=${orderId}`);
229
+ return response.data;
230
+ });
231
+ }
232
+ checkAddress(address, crypto) {
233
+ return __awaiter(this, void 0, void 0, function* () {
234
+ const response = yield this.axios.post(`/api/kyt/address`, {
235
+ address,
236
+ crypto,
237
+ });
238
+ return response.data;
239
+ });
240
+ }
241
+ getSupportedPaymentMethods(fiat, country) {
242
+ return __awaiter(this, void 0, void 0, function* () {
243
+ const response = yield this.axios.get(`/api/payment-methods/supported?fiat=${fiat}&country=${country}`);
244
+ return response.data;
245
+ });
246
+ }
247
+ getBrokerCustomers() {
248
+ return __awaiter(this, void 0, void 0, function* () {
249
+ const response = yield this.axios.get(`/api/business/users/broker-customers`);
250
+ return response.data;
251
+ });
252
+ }
253
+ getSupportedPayoutMethods(fiat, country) {
254
+ return __awaiter(this, void 0, void 0, function* () {
255
+ const response = yield this.axios.get(`/api/payout-methods/supported?fiat=${fiat}&country=${country}`);
256
+ return response.data;
257
+ });
258
+ }
259
+ getPartnerLayout(partnerId) {
260
+ return __awaiter(this, void 0, void 0, function* () {
261
+ const { data } = yield this.axios.get(`/api/partners/${partnerId}/layout`);
262
+ return data;
263
+ });
264
+ }
265
+ createClipCardPayment(orderId) {
266
+ return __awaiter(this, void 0, void 0, function* () {
267
+ const { data } = yield this.axios.post(`/api/payments/card/clip`, {
268
+ orderId,
269
+ });
270
+ return data;
271
+ });
272
+ }
273
+ createConektaPayment(orderId) {
274
+ return __awaiter(this, void 0, void 0, function* () {
275
+ const { data } = yield this.axios.post(`/api/payments/card/conekta`, {
276
+ orderId,
277
+ });
278
+ return data;
279
+ });
280
+ }
281
+ createKushkiPayment(orderId, token) {
282
+ return __awaiter(this, void 0, void 0, function* () {
283
+ const { data } = yield this.axios.post(`/api/payments/card/kushki`, {
284
+ orderId,
285
+ token,
286
+ });
287
+ return data;
288
+ });
289
+ }
290
+ createKushkiBankPayment(orderId) {
291
+ return __awaiter(this, void 0, void 0, function* () {
292
+ const { data } = yield this.axios.post(`/api/payments/bank/kushki`, {
293
+ orderId,
294
+ });
295
+ return data;
296
+ });
297
+ }
298
+ createSPEIPayment(orderId) {
299
+ return __awaiter(this, void 0, void 0, function* () {
300
+ const { data } = yield this.axios.post(`/api/payments/bank/spei`, {
301
+ orderId,
302
+ });
303
+ return data;
304
+ });
305
+ }
306
+ createSPIDPayment(orderId) {
307
+ return __awaiter(this, void 0, void 0, function* () {
308
+ const { data } = yield this.axios.post(`/api/payments/bank/spid`, {
309
+ orderId,
310
+ });
311
+ return data;
312
+ });
313
+ }
314
+ createSWIFTPayment(orderId) {
315
+ return __awaiter(this, void 0, void 0, function* () {
316
+ const { data } = yield this.axios.post(`/api/payments/bank/swift`, {
317
+ orderId,
318
+ });
319
+ return data;
320
+ });
321
+ }
322
+ createInterbankPayment(orderId) {
323
+ return __awaiter(this, void 0, void 0, function* () {
324
+ const { data } = yield this.axios.post(`/api/payments/bank/interbank`, {
325
+ orderId,
326
+ });
327
+ return data;
328
+ });
329
+ }
330
+ }
331
+ exports.RioClient = RioClient;
package/build/index.d.ts CHANGED
@@ -176,4 +176,5 @@ export * from "./clients/gueno-client";
176
176
  export * from "./clients/fireblocks-client";
177
177
  export * from "./clients/kapstar-client";
178
178
  export * from "./clients/etherscan-client";
179
+ export * from "./clients/rio-client";
179
180
  export * from "./helpers/get-user-helper";
package/build/index.js CHANGED
@@ -192,4 +192,5 @@ __exportStar(require("./clients/gueno-client"), exports);
192
192
  __exportStar(require("./clients/fireblocks-client"), exports);
193
193
  __exportStar(require("./clients/kapstar-client"), exports);
194
194
  __exportStar(require("./clients/etherscan-client"), exports);
195
+ __exportStar(require("./clients/rio-client"), exports);
195
196
  __exportStar(require("./helpers/get-user-helper"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common",
3
- "version": "1.0.488",
3
+ "version": "1.0.490",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",