hollaex-node-lib 2.17.0 → 2.19.0
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/README.md +9 -1
- package/kit.js +531 -174
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -79,6 +79,9 @@ client
|
|
|
79
79
|
| `createOrder` | <ul><li>**symbol**: HollaEx trading symbol e.g. `xht-usdt`</li><li>**side** (_enum_=[`buy`, `sell`]): Order side</li><li>**size**: Size of order to place</li><li>**type**: (_enum_=[`market`, `limit`] Order type</li><li>**price**: (_required if limit order type_) Order price</li><li>**opts**: Object with additional params</li><li>**opts.stop**: (_optional_) Stop price for order</li><li>**opts.meta**: (_optional_) Object with additional meta configurations</li><li>**opts.meta.post_only**: (_optional_, _default_=`false`) Make post only order </li><li>**opts.meta.note**: (_optional_) Custom note for order</li></ul> | Create a new order |
|
|
80
80
|
| `cancelOrder` | <ul><li>**orderId**: HollaEx Network order ID</li></ul> | Cancel a specific order with its ID |
|
|
81
81
|
| `cancelAllOrders` | <ul><li>**symbol**: HollaEx trading symbol e.g. `xht-usdt`</li></ul> | Cancel all the active orders of a user, filtered by currency pair symbol |
|
|
82
|
+
| `getMiniCharts` | <ul><li>**assets**: The list of assets to get the mini charts for</li><li>**opts.from**: (_optional_) Start Date</li><li>**opts.to**: (_optional_) End Date</li><li>**opts.quote**: (_optional_) Quote asset to receive prices based on</li></ul> | Get trade history HOLCV for all pairs |
|
|
83
|
+
| `getQuickTradeQuote` | <ul><li>**spending_currency**: Currency symbol of the spending currency</li><li>**receiving_currency**: Currency symbol of the receiving currency</li><li>**opts.spending_amount**: (_optional_) Spending amount</li><li>**opts.receiving_amount**: (_optional_) Receiving amount</li></ul> | Get Quick Trade Quote |
|
|
84
|
+
| `executeOrder` | <ul><li>**token**: Token</li></ul> | Execute Order |
|
|
82
85
|
|
|
83
86
|
### Available admin functions:
|
|
84
87
|
|
|
@@ -99,8 +102,9 @@ client
|
|
|
99
102
|
| `getExchangeOrders` | <ul><li>**opts.userId**: The identifier of the user</li><li>**opts.side**: The order side (buy or side)</li><li>**opts.status**: The order's status e.g open, filled, canceled etc</li><li>**opts.open**: The info on whether the order is active or not </li><li>**opts.side**: The order side (buy or side)</li><li>**opts.limit**: Amount of orders per page. Maximum: 50. Default: 50</li><li>**opts.page**: Page of order data. Default: 1</li><li>**opts.symbol**: The symbol-pair to filter by, pass undefined to receive data on all currencies</li><li>**opts.orderBy:** The field to order data by e.g. amount, id.</li><li>**opts.order:** Ascending (asc) or descending (desc).</li><li>**opts.startDate:** Start date of query in ISO8601 format.</li><li>**opts.endDate:** End date of query in ISO8601 format.</li></ul> | Retrieve user's orders by admin |
|
|
100
103
|
| `cancelExchangeUserOrder` | <ul><li>**userId**: The identifier of the user</li><li>**orderId**: The identifier of the order</li></ul> | Cancel user's order by order id |
|
|
101
104
|
| `getExchangeUsers` | <ul><li>**opts**: Optional parameters</li><li>**opts.userId**: The identifier of the user to filter by</li><li>**opts.search**: The search text to filter by, pass undefined to receive data on all fields</li><li>**opts.pending**: The pending field to filter by, pass undefined to receive all data</li><li>**opts.pendingType**: Th pending type info to filter by, pass undefined to receive data</li><li>**opts.limit**: Amount of users per page. Maximum: 50. Default: 50</li><li>**opts.page**: Page of user data. Default: 1</li><li>**opts.orderBy**: The field to order data by e.g. amount, id.</li><li>**opts.order**: Ascending (asc) or descending (desc).</li><li>**opts.startDate**: Start date of query in ISO8601 format.</li><li>**opts.endDate**: End date of query in ISO8601 format.</li><li>**opts.format**: Custom format of data set. Enum: ['all', 'csv']</li></ul> | Retrieve list of the user info by admin |
|
|
102
|
-
| `createExchangeUser` | <ul><li>**email**: The mail address for the user</li
|
|
105
|
+
| `createExchangeUser` | <ul><li>**email**: The mail address for the user</li><li>**password**: The password for the user</li><li>**opts.referral**: The referral code for the user</li></ul> | Create exchange user |
|
|
103
106
|
| `updateExchangeUser` | <ul><li>**userId**: The identifier of the user to filter by</li><li>**opts.meta**: The field to update user meta info</li><li>**opts.overwrite**: the field to set overwrite option along with meta object</li><li>**opts.role**: The field to update user role ('admin', 'supervisor', 'support', 'kyc', 'communicator', 'user')</li><li>**opts.note**: The field to update user note </li><li>**opts.verification_level**: The field to set user's verification level</li></ul> | Update exchange user |
|
|
107
|
+
| `deleteExchangeUser` | <ul><li>**user_id**: The id for the user</li></ul> | Delete exchange user |
|
|
104
108
|
| `createExchangeUserWallet` | <ul><li>**userId**: The identifier of the user</li><li>**crypto**: The coin for the wallet e.g btc, eth</li><li>**opts.network**: The network info </li></ul> | Create wallet for exchange user |
|
|
105
109
|
| `getExchangeUserWallet` | <ul><li>**opts.userId**: The identifier of the user to filter by</li><li>**opts.limit**: Amount of users per page. Maximum: 50. Default: 50</li><li>**opts.currency**: The currency to filter by</li><li>**opts.page**: Page of user data. Default: 1</li><li>**opts.orderBy**: The field to order data by e.g. amount, id.</li><li>**opts.order**: Ascending (asc) or descending (desc).</li><li>**opts.startDate**: Start date of query in ISO8601 format.</li><li>**opts.endDate**: End date of query in ISO8601 format.</li><li>**opts.address**: Address of crypto</li><li>**opts.isValid**: Specify whether or not wallet is valid</li><li>**opts.network**: Crypto network of currency</li><li>**opts.format**: Custom format of data set. Enum: ['all', 'csv']</li></ul> | Retrieve users' wallets by admin |
|
|
106
110
|
| `getExchangeUserBalance` | <ul><li>**userId**: The identifier of the user</li></ul> | Retrieve user's login info by admin |
|
|
@@ -113,6 +117,10 @@ client
|
|
|
113
117
|
| `sendExchangeUserEmail` | <ul><li>**userId**: The identifier of the user</li><li>**mailType**: The mail type for the email payload</li><li>**data**: The content of the mail</li></ul> | Send email to exchange user account by admin |
|
|
114
118
|
| `sendRawEmail` | <ul><li>**receivers**: The array of emails to send mail</li><li>**html**: The stringified html content</li><li>**opts.title**: The title of the mail</li><li>**opts.text**: The text of the mail</li></ul> | Send email to users with custom html by admin |
|
|
115
119
|
| `getOraclePrice` | <ul><li>**assets**: Assets to convert</li><li>**opts.quote**: Quote coin to convert to</li><li>**opts.amount**: Amount to convert</li></ul> | Retrieve price conversion |
|
|
120
|
+
| `getExchangeUserBalances` | <ul><li>**opts.userId**: The identifier of the user to filter by</li><li>**opts.currency**: The currency to filter by, pass undefined to receive data on all currencies</li><li>**opts.format**: Custom format of data set. Enum: ['all', 'csv']</li></ul> | Retrieve user's balances by admin |
|
|
121
|
+
| `createOrderByAdmin` | <ul><li>**user_id**: User id for the order</li><li>**symbol**: Currency symbol of the order e.g. xht-usdt</li><li>**size**: Amount of the order</li><li>**side**: Order Side, buy or sell</li><li>**type**: Order Type, limit or market</li><li>**price**: Order Price</li></ul> | Create order on behalf of user |
|
|
122
|
+
| `createTradeByAdmin` | <ul><li>**maker_id**: User id for the maker</li><li>**user_id**: User id for the taker</li><li>**user_id**: fee in percentage for the maker</li><li>**user_id**: fee in percentage for the taker</li><li>**symbol**: Currency symbol of the order e.g. xht-usdt</li><li>**size**: Amount of the order</li><li>**side**: Order Side, buy or sell</li><li>**price**: Order Price</li></ul> | Create order on behalf of user |
|
|
123
|
+
| `createWithdrawalByAdmin` | <ul><li>**user_id**: User id for the withdrawal process</li><li>**address**: Specific address for the withdrawal</li><li>**amount**: Size of the withdrawal</li><li>**currency**: Currency symbol of the withdrawal</li><li>**opts.network**: Blockchain network</li></ul> | Create withdrawal on behalf of users |
|
|
116
124
|
|
|
117
125
|
|
|
118
126
|
### Websocket
|
package/kit.js
CHANGED
|
@@ -4,7 +4,7 @@ const WebSocket = require('ws');
|
|
|
4
4
|
const moment = require('moment');
|
|
5
5
|
const { createRequest, createSignature, generateHeaders, isDatetime, sanitizeDate } = require('./utils');
|
|
6
6
|
const { setWsHeartbeat } = require('ws-heartbeat/client');
|
|
7
|
-
const { each, union, isNumber, isString, isPlainObject, isBoolean, isObject } = require('lodash');
|
|
7
|
+
const { each, union, isNumber, isString, isPlainObject, isBoolean, isObject, isArray } = require('lodash');
|
|
8
8
|
class HollaExKit {
|
|
9
9
|
constructor(
|
|
10
10
|
opts = {
|
|
@@ -207,64 +207,67 @@ class HollaExKit {
|
|
|
207
207
|
}
|
|
208
208
|
) {
|
|
209
209
|
const verb = 'GET';
|
|
210
|
-
let path = `${this.baseUrl}/user/deposits
|
|
210
|
+
let path = `${this.baseUrl}/user/deposits`;
|
|
211
|
+
let params = '?';
|
|
211
212
|
|
|
212
213
|
if (isString(opts.currency)) {
|
|
213
|
-
|
|
214
|
+
params += `¤cy=${opts.currency}`;
|
|
214
215
|
}
|
|
215
216
|
|
|
216
217
|
if (isNumber(opts.limit)) {
|
|
217
|
-
|
|
218
|
+
params += `&limit=${opts.limit}`;
|
|
218
219
|
}
|
|
219
220
|
|
|
220
221
|
if (isNumber(opts.page)) {
|
|
221
|
-
|
|
222
|
+
params += `&page=${opts.page}`;
|
|
222
223
|
}
|
|
223
224
|
|
|
224
225
|
if (isString(opts.orderBy)) {
|
|
225
|
-
|
|
226
|
+
params += `&order_by=${opts.orderBy}`;
|
|
226
227
|
}
|
|
227
228
|
|
|
228
229
|
if (isString(opts.order)) {
|
|
229
|
-
|
|
230
|
+
params += `&order=${opts.order}`;
|
|
230
231
|
}
|
|
231
232
|
|
|
232
233
|
if (isDatetime(opts.startDate)) {
|
|
233
|
-
|
|
234
|
+
params += `&start_date=${sanitizeDate(opts.startDate)}`;
|
|
234
235
|
}
|
|
235
236
|
|
|
236
237
|
if (isDatetime(opts.endDate)) {
|
|
237
|
-
|
|
238
|
+
params += `&end_date=${sanitizeDate(opts.endDate)}`;
|
|
238
239
|
}
|
|
239
240
|
|
|
240
241
|
if (isString(opts.address)) {
|
|
241
|
-
|
|
242
|
+
params += `&address=${opts.address}`;
|
|
242
243
|
}
|
|
243
244
|
|
|
244
245
|
if (isString(opts.transactionId)) {
|
|
245
|
-
|
|
246
|
+
params += `&transaction_id=${opts.transactionId}`;
|
|
246
247
|
}
|
|
247
248
|
|
|
248
249
|
if (isBoolean(opts.status)) {
|
|
249
|
-
|
|
250
|
+
params += `&status=${opts.status}`;
|
|
250
251
|
}
|
|
251
252
|
|
|
252
253
|
if (isBoolean(opts.dismissed)) {
|
|
253
|
-
|
|
254
|
+
params += `&dismissed=${opts.dismissed}`;
|
|
254
255
|
}
|
|
255
256
|
|
|
256
257
|
if (isBoolean(opts.rejected)) {
|
|
257
|
-
|
|
258
|
+
params += `&rejected=${opts.rejected}`;
|
|
258
259
|
}
|
|
259
260
|
|
|
260
261
|
if (isBoolean(opts.processing)) {
|
|
261
|
-
|
|
262
|
+
params += `&processing=${opts.processing}`;
|
|
262
263
|
}
|
|
263
264
|
|
|
264
265
|
if (isBoolean(opts.waiting)) {
|
|
265
|
-
|
|
266
|
+
params += `&waiting=${opts.waiting}`;
|
|
266
267
|
}
|
|
267
268
|
|
|
269
|
+
if (params.length > 1) path += params;
|
|
270
|
+
|
|
268
271
|
const headers = generateHeaders(
|
|
269
272
|
this.headers,
|
|
270
273
|
this.apiSecret,
|
|
@@ -314,64 +317,65 @@ class HollaExKit {
|
|
|
314
317
|
}
|
|
315
318
|
) {
|
|
316
319
|
const verb = 'GET';
|
|
317
|
-
let path = `${this.baseUrl}/user/withdrawals
|
|
320
|
+
let path = `${this.baseUrl}/user/withdrawals`;
|
|
321
|
+
let params = '?';
|
|
318
322
|
|
|
319
323
|
if (isString(opts.currency)) {
|
|
320
|
-
|
|
324
|
+
params += `¤cy=${opts.currency}`;
|
|
321
325
|
}
|
|
322
326
|
|
|
323
327
|
if (isNumber(opts.limit)) {
|
|
324
|
-
|
|
328
|
+
params += `&limit=${opts.limit}`;
|
|
325
329
|
}
|
|
326
330
|
|
|
327
331
|
if (isNumber(opts.page)) {
|
|
328
|
-
|
|
332
|
+
params += `&page=${opts.page}`;
|
|
329
333
|
}
|
|
330
334
|
|
|
331
335
|
if (isString(opts.orderBy)) {
|
|
332
|
-
|
|
336
|
+
params += `&order_by=${opts.orderBy}`;
|
|
333
337
|
}
|
|
334
338
|
|
|
335
339
|
if (isString(opts.order)) {
|
|
336
|
-
|
|
340
|
+
params += `&order=${opts.order}`;
|
|
337
341
|
}
|
|
338
342
|
|
|
339
343
|
if (isDatetime(opts.startDate)) {
|
|
340
|
-
|
|
344
|
+
params += `&start_date=${sanitizeDate(opts.startDate)}`;
|
|
341
345
|
}
|
|
342
346
|
|
|
343
347
|
if (isDatetime(opts.endDate)) {
|
|
344
|
-
|
|
348
|
+
params += `&end_date=${sanitizeDate(opts.endDate)}`;
|
|
345
349
|
}
|
|
346
350
|
|
|
347
351
|
if (isString(opts.address)) {
|
|
348
|
-
|
|
352
|
+
params += `&address=${opts.address}`;
|
|
349
353
|
}
|
|
350
354
|
|
|
351
355
|
if (isString(opts.transactionId)) {
|
|
352
|
-
|
|
356
|
+
params += `&transaction_id=${opts.transactionId}`;
|
|
353
357
|
}
|
|
354
358
|
|
|
355
359
|
if (isBoolean(opts.status)) {
|
|
356
|
-
|
|
360
|
+
params += `&status=${opts.status}`;
|
|
357
361
|
}
|
|
358
362
|
|
|
359
363
|
if (isBoolean(opts.dismissed)) {
|
|
360
|
-
|
|
364
|
+
params += `&dismissed=${opts.dismissed}`;
|
|
361
365
|
}
|
|
362
366
|
|
|
363
367
|
if (isBoolean(opts.rejected)) {
|
|
364
|
-
|
|
368
|
+
params += `&rejected=${opts.rejected}`;
|
|
365
369
|
}
|
|
366
370
|
|
|
367
371
|
if (isBoolean(opts.processing)) {
|
|
368
|
-
|
|
372
|
+
params += `&processing=${opts.processing}`;
|
|
369
373
|
}
|
|
370
374
|
|
|
371
375
|
if (isBoolean(opts.waiting)) {
|
|
372
|
-
|
|
376
|
+
params += `&waiting=${opts.waiting}`;
|
|
373
377
|
}
|
|
374
|
-
|
|
378
|
+
if (params.length > 1) path += params;
|
|
375
379
|
const headers = generateHeaders(
|
|
376
380
|
this.headers,
|
|
377
381
|
this.apiSecret,
|
|
@@ -443,40 +447,43 @@ class HollaExKit {
|
|
|
443
447
|
}
|
|
444
448
|
) {
|
|
445
449
|
const verb = 'GET';
|
|
446
|
-
let path = `${this.baseUrl}/user/trades
|
|
450
|
+
let path = `${this.baseUrl}/user/trades`;
|
|
451
|
+
let params = '?';
|
|
447
452
|
|
|
448
453
|
if (isString(opts.symbol)) {
|
|
449
|
-
|
|
454
|
+
params += `&symbol=${opts.symbol}`;
|
|
450
455
|
}
|
|
451
456
|
|
|
452
457
|
if (isNumber(opts.limit)) {
|
|
453
|
-
|
|
458
|
+
params += `&limit=${opts.limit}`;
|
|
454
459
|
}
|
|
455
460
|
|
|
456
461
|
if (isNumber(opts.page)) {
|
|
457
|
-
|
|
462
|
+
params += `&page=${opts.page}`;
|
|
458
463
|
}
|
|
459
464
|
|
|
460
465
|
if (isString(opts.orderBy)) {
|
|
461
|
-
|
|
466
|
+
params += `&order_by=${opts.orderBy}`;
|
|
462
467
|
}
|
|
463
468
|
|
|
464
469
|
if (isString(opts.order)) {
|
|
465
|
-
|
|
470
|
+
params += `&order=${opts.order}`;
|
|
466
471
|
}
|
|
467
472
|
|
|
468
473
|
if (isDatetime(opts.startDate)) {
|
|
469
|
-
|
|
474
|
+
params += `&start_date=${sanitizeDate(opts.startDate)}`;
|
|
470
475
|
}
|
|
471
476
|
|
|
472
477
|
if (isDatetime(opts.endDate)) {
|
|
473
|
-
|
|
478
|
+
params += `&end_date=${sanitizeDate(opts.endDate)}`;
|
|
474
479
|
}
|
|
475
480
|
|
|
476
481
|
if (isString(opts.format) && ['csv', 'all'].includes(opts.format)) {
|
|
477
|
-
|
|
482
|
+
params += `&format=${opts.format}`;
|
|
478
483
|
}
|
|
479
484
|
|
|
485
|
+
if (params.length > 1) path += params;
|
|
486
|
+
|
|
480
487
|
const headers = generateHeaders(
|
|
481
488
|
this.headers,
|
|
482
489
|
this.apiSecret,
|
|
@@ -534,48 +541,51 @@ class HollaExKit {
|
|
|
534
541
|
}
|
|
535
542
|
) {
|
|
536
543
|
const verb = 'GET';
|
|
537
|
-
let path = `${this.baseUrl}/orders
|
|
544
|
+
let path = `${this.baseUrl}/orders`;
|
|
545
|
+
let params = '?';
|
|
538
546
|
|
|
539
547
|
if (isString(opts.symbol)) {
|
|
540
|
-
|
|
548
|
+
params += `&symbol=${opts.symbol}`;
|
|
541
549
|
}
|
|
542
550
|
|
|
543
551
|
if (isString(opts.side) && (opts.side.toLowerCase() === 'buy' || opts.side.toLowerCase() === 'sell')) {
|
|
544
|
-
|
|
552
|
+
params += `&side=${opts.side}`;
|
|
545
553
|
}
|
|
546
554
|
|
|
547
555
|
if (isString(opts.status)) {
|
|
548
|
-
|
|
556
|
+
params += `&status=${opts.status}`;
|
|
549
557
|
}
|
|
550
558
|
|
|
551
559
|
if (isBoolean(opts.open)) {
|
|
552
|
-
|
|
560
|
+
params += `&open=${opts.open}`;
|
|
553
561
|
}
|
|
554
562
|
|
|
555
563
|
if (isNumber(opts.limit)) {
|
|
556
|
-
|
|
564
|
+
params += `&limit=${opts.limit}`;
|
|
557
565
|
}
|
|
558
566
|
|
|
559
567
|
if (isNumber(opts.page)) {
|
|
560
|
-
|
|
568
|
+
params += `&page=${opts.page}`;
|
|
561
569
|
}
|
|
562
570
|
|
|
563
571
|
if (isString(opts.orderBy)) {
|
|
564
|
-
|
|
572
|
+
params += `&order_by=${opts.orderBy}`;
|
|
565
573
|
}
|
|
566
574
|
|
|
567
575
|
if (isString(opts.order)) {
|
|
568
|
-
|
|
576
|
+
params += `&order=${opts.order}`;
|
|
569
577
|
}
|
|
570
578
|
|
|
571
579
|
if (isDatetime(opts.startDate)) {
|
|
572
|
-
|
|
580
|
+
params += `&start_date=${sanitizeDate(opts.startDate)}`;
|
|
573
581
|
}
|
|
574
582
|
|
|
575
583
|
if (isDatetime(opts.endDate)) {
|
|
576
|
-
|
|
584
|
+
params += `&end_date=${sanitizeDate(opts.endDate)}`;
|
|
577
585
|
}
|
|
578
586
|
|
|
587
|
+
if (params.length > 1) path += params;
|
|
588
|
+
|
|
579
589
|
const headers = generateHeaders(
|
|
580
590
|
this.headers,
|
|
581
591
|
this.apiSecret,
|
|
@@ -690,19 +700,21 @@ class HollaExKit {
|
|
|
690
700
|
}
|
|
691
701
|
) {
|
|
692
702
|
const verb = 'GET';
|
|
693
|
-
let path = `${this.baseUrl}/oracle/prices
|
|
703
|
+
let path = `${this.baseUrl}/oracle/prices`;
|
|
704
|
+
let params = '?';
|
|
694
705
|
|
|
695
706
|
if (isArray(assets)) {
|
|
696
|
-
|
|
707
|
+
params += `&assets=${assets}`;
|
|
697
708
|
}
|
|
698
709
|
|
|
699
710
|
if (isString(opts.quote)) {
|
|
700
|
-
|
|
711
|
+
params += `"e=${opts.quote}`;
|
|
701
712
|
}
|
|
702
713
|
|
|
703
714
|
if (isNumber(opts.amount)) {
|
|
704
|
-
|
|
715
|
+
params += `&amount=${opts.amount}`;
|
|
705
716
|
}
|
|
717
|
+
if (params.length > 1) path += params;
|
|
706
718
|
|
|
707
719
|
const headers = generateHeaders(
|
|
708
720
|
this.headers,
|
|
@@ -714,6 +726,126 @@ class HollaExKit {
|
|
|
714
726
|
return createRequest(verb, `${this.apiUrl}${path}`, headers);
|
|
715
727
|
}
|
|
716
728
|
|
|
729
|
+
|
|
730
|
+
/**
|
|
731
|
+
* Get trade history HOLCV for all pairs
|
|
732
|
+
* @param {array} assets - The list of assets to get the mini charts for
|
|
733
|
+
* @param {string} opts.from - Start Date
|
|
734
|
+
* @param {string} opts.to - End data
|
|
735
|
+
* @param {string} opts.quote - Quote asset to receive prices based on
|
|
736
|
+
* @return {object} A JSON object with trade history info
|
|
737
|
+
*/
|
|
738
|
+
getMiniCharts(
|
|
739
|
+
assets,
|
|
740
|
+
opts = {
|
|
741
|
+
from: null,
|
|
742
|
+
to: null,
|
|
743
|
+
quote: null,
|
|
744
|
+
}
|
|
745
|
+
) {
|
|
746
|
+
const verb = 'GET';
|
|
747
|
+
let path = `${this.baseUrl}/minicharts`;
|
|
748
|
+
let params = '?';
|
|
749
|
+
|
|
750
|
+
if (isArray(assets)) {
|
|
751
|
+
params += `&assets=${opts.assets}`;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
if (isString(opts.from)) {
|
|
755
|
+
params += `&from=${opts.from}`;
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
if (isString(opts.to)) {
|
|
759
|
+
params += `&to=${opts.to}`;
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
if (isString(opts.quote)) {
|
|
763
|
+
params += `"e=${opts.quote}`;
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
if (params.length > 1) path += params;
|
|
767
|
+
|
|
768
|
+
const headers = generateHeaders(
|
|
769
|
+
this.headers,
|
|
770
|
+
this.apiSecret,
|
|
771
|
+
verb,
|
|
772
|
+
path,
|
|
773
|
+
this.apiExpiresAfter
|
|
774
|
+
);
|
|
775
|
+
return createRequest(verb, `${this.apiUrl}${path}`, headers);
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
/**
|
|
779
|
+
* Get Quick Trade Quote
|
|
780
|
+
* @param {string} spending_currency - Currency symbol of the spending currency
|
|
781
|
+
* @param {string} receiving_currency - Currency symbol of the receiving currency
|
|
782
|
+
* @param {string} opts.spending_amount - Spending amount
|
|
783
|
+
* @param {string} opts.receiving_amount - Receiving amount
|
|
784
|
+
*/
|
|
785
|
+
getQuickTradeQuote(
|
|
786
|
+
spending_currency,
|
|
787
|
+
receiving_currency,
|
|
788
|
+
opts = {
|
|
789
|
+
spending_amount: null,
|
|
790
|
+
receiving_amount: null,
|
|
791
|
+
}
|
|
792
|
+
) {
|
|
793
|
+
const verb = 'GET';
|
|
794
|
+
let path = `${this.baseUrl}/quick-trade`;
|
|
795
|
+
let params = '?';
|
|
796
|
+
|
|
797
|
+
if (isString(spending_currency)) {
|
|
798
|
+
params += `&spending_currency=${spending_currency}`;
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
if (isString(receiving_currency)) {
|
|
802
|
+
params += `&receiving_currency=${receiving_currency}`;
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
if (isString(opts.spending_amount)) {
|
|
806
|
+
params += `&spending_amount=${opts.spending_amount}`;
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
if (isString(opts.receiving_amount)) {
|
|
810
|
+
params += `&receiving_amount=${opts.receiving_amount}`;
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
if (params.length > 1) path += params;
|
|
814
|
+
|
|
815
|
+
const headers = generateHeaders(
|
|
816
|
+
this.headers,
|
|
817
|
+
this.apiSecret,
|
|
818
|
+
verb,
|
|
819
|
+
path,
|
|
820
|
+
this.apiExpiresAfter
|
|
821
|
+
);
|
|
822
|
+
return createRequest(verb, `${this.apiUrl}${path}`, headers);
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
/**
|
|
826
|
+
* Execute Order
|
|
827
|
+
* @param {string} token - Token
|
|
828
|
+
*/
|
|
829
|
+
executeOrder(
|
|
830
|
+
token
|
|
831
|
+
) {
|
|
832
|
+
const verb = 'POST';
|
|
833
|
+
let path = `${this.baseUrl}/order/execute`;
|
|
834
|
+
const data = {
|
|
835
|
+
token
|
|
836
|
+
};
|
|
837
|
+
|
|
838
|
+
const headers = generateHeaders(
|
|
839
|
+
this.headers,
|
|
840
|
+
this.apiSecret,
|
|
841
|
+
verb,
|
|
842
|
+
path,
|
|
843
|
+
this.apiExpiresAfter,
|
|
844
|
+
data
|
|
845
|
+
);
|
|
846
|
+
return createRequest(verb, `${this.apiUrl}${path}`, headers, { data });
|
|
847
|
+
}
|
|
848
|
+
|
|
717
849
|
/**
|
|
718
850
|
* Get admin exchange information
|
|
719
851
|
* @return {object} A json object with the admin exchange information
|
|
@@ -773,73 +905,75 @@ class HollaExKit {
|
|
|
773
905
|
}
|
|
774
906
|
) {
|
|
775
907
|
const verb = 'GET';
|
|
776
|
-
let path = `${this.baseUrl}/admin/deposits
|
|
777
|
-
|
|
908
|
+
let path = `${this.baseUrl}/admin/deposits`;
|
|
909
|
+
let params = '?';
|
|
778
910
|
|
|
779
911
|
if (isNumber(opts.userId)) {
|
|
780
|
-
|
|
912
|
+
params += `&user_id=${opts.userId}`;
|
|
781
913
|
}
|
|
782
914
|
|
|
783
915
|
if (isString(opts.currency)) {
|
|
784
|
-
|
|
916
|
+
params += `¤cy=${opts.currency}`;
|
|
785
917
|
}
|
|
786
918
|
|
|
787
919
|
if (isNumber(opts.limit)) {
|
|
788
|
-
|
|
920
|
+
params += `&limit=${opts.limit}`;
|
|
789
921
|
}
|
|
790
922
|
|
|
791
923
|
if (isNumber(opts.page)) {
|
|
792
|
-
|
|
924
|
+
params += `&page=${opts.page}`;
|
|
793
925
|
}
|
|
794
926
|
|
|
795
927
|
if (isString(opts.orderBy)) {
|
|
796
|
-
|
|
928
|
+
params += `&order_by=${opts.orderBy}`;
|
|
797
929
|
}
|
|
798
930
|
|
|
799
931
|
if (isString(opts.order) && (opts.order === 'asc' || opts.order === 'desc')) {
|
|
800
|
-
|
|
932
|
+
params += `&order=${opts.order}`;
|
|
801
933
|
}
|
|
802
934
|
|
|
803
935
|
if (isDatetime(opts.startDate)) {
|
|
804
|
-
|
|
936
|
+
params += `&start_date=${sanitizeDate(opts.startDate)}`;
|
|
805
937
|
}
|
|
806
938
|
|
|
807
939
|
if (isDatetime(opts.endDate)) {
|
|
808
|
-
|
|
940
|
+
params += `&end_date=${sanitizeDate(opts.endDate)}`;
|
|
809
941
|
}
|
|
810
942
|
|
|
811
943
|
if (isBoolean(opts.status)) {
|
|
812
|
-
|
|
944
|
+
params += `&status=${opts.status}`;
|
|
813
945
|
}
|
|
814
946
|
|
|
815
947
|
if (isBoolean(opts.dismissed)) {
|
|
816
|
-
|
|
948
|
+
params += `&dismissed=${opts.dismissed}`;
|
|
817
949
|
}
|
|
818
950
|
|
|
819
951
|
if (isBoolean(opts.rejected)) {
|
|
820
|
-
|
|
952
|
+
params += `&rejected=${opts.rejected}`;
|
|
821
953
|
}
|
|
822
954
|
|
|
823
955
|
if (isBoolean(opts.processing)) {
|
|
824
|
-
|
|
956
|
+
params += `&processing=${opts.processing}`;
|
|
825
957
|
}
|
|
826
958
|
|
|
827
959
|
if (isBoolean(opts.waiting)) {
|
|
828
|
-
|
|
960
|
+
params += `&waiting=${opts.waiting}`;
|
|
829
961
|
}
|
|
830
962
|
|
|
831
963
|
if (isString(opts.transactionId)) {
|
|
832
|
-
|
|
964
|
+
params += `&transaction_id=${opts.transactionId}`;
|
|
833
965
|
}
|
|
834
966
|
|
|
835
967
|
if (isString(opts.address)) {
|
|
836
|
-
|
|
968
|
+
params += `&address=${opts.address}`;
|
|
837
969
|
}
|
|
838
970
|
|
|
839
971
|
if (isString(opts.format) && ['csv', 'all'].includes(opts.format)) {
|
|
840
|
-
|
|
972
|
+
params += `&format=${opts.format}`;
|
|
841
973
|
}
|
|
842
974
|
|
|
975
|
+
if (params.length > 1) path += params;
|
|
976
|
+
|
|
843
977
|
const headers = generateHeaders(
|
|
844
978
|
this.headers,
|
|
845
979
|
this.apiSecret,
|
|
@@ -892,72 +1026,74 @@ class HollaExKit {
|
|
|
892
1026
|
}
|
|
893
1027
|
) {
|
|
894
1028
|
const verb = 'GET';
|
|
895
|
-
let path = `${this.baseUrl}/admin/withdrawals
|
|
1029
|
+
let path = `${this.baseUrl}/admin/withdrawals`;
|
|
1030
|
+
let params = '?';
|
|
896
1031
|
|
|
897
1032
|
if (isString(opts.currency)) {
|
|
898
|
-
|
|
1033
|
+
params += `¤cy=${opts.currency}`;
|
|
899
1034
|
}
|
|
900
1035
|
|
|
901
1036
|
if (isNumber(opts.userId)) {
|
|
902
|
-
|
|
1037
|
+
params += `&user_id=${opts.userId}`;
|
|
903
1038
|
}
|
|
904
1039
|
|
|
905
1040
|
if (isString(opts.transactionId)) {
|
|
906
|
-
|
|
1041
|
+
params += `&transaction_id=${opts.transactionId}`;
|
|
907
1042
|
}
|
|
908
1043
|
|
|
909
1044
|
if (isString(opts.address)) {
|
|
910
|
-
|
|
1045
|
+
params += `&address=${opts.address}`;
|
|
911
1046
|
}
|
|
912
1047
|
|
|
913
1048
|
if (isNumber(opts.limit)) {
|
|
914
|
-
|
|
1049
|
+
params += `&limit=${opts.limit}`;
|
|
915
1050
|
}
|
|
916
1051
|
|
|
917
1052
|
if (isNumber(opts.page)) {
|
|
918
|
-
|
|
1053
|
+
params += `&page=${opts.page}`;
|
|
919
1054
|
}
|
|
920
1055
|
|
|
921
1056
|
if (isString(opts.orderBy)) {
|
|
922
|
-
|
|
1057
|
+
params += `&order_by=${opts.orderBy}`;
|
|
923
1058
|
}
|
|
924
1059
|
|
|
925
1060
|
if (isString(opts.order) && (opts.order === 'asc' || opts.order === 'desc')) {
|
|
926
|
-
|
|
1061
|
+
params += `&order=${opts.order}`;
|
|
927
1062
|
}
|
|
928
1063
|
|
|
929
1064
|
if (isDatetime(opts.startDate)) {
|
|
930
|
-
|
|
1065
|
+
params += `&start_date=${sanitizeDate(opts.startDate)}`;
|
|
931
1066
|
}
|
|
932
1067
|
|
|
933
1068
|
if (isDatetime(opts.endDate)) {
|
|
934
|
-
|
|
1069
|
+
params += `&end_date=${sanitizeDate(opts.endDate)}`;
|
|
935
1070
|
}
|
|
936
1071
|
|
|
937
1072
|
if (isBoolean(opts.status)) {
|
|
938
|
-
|
|
1073
|
+
params += `&status=${opts.status}`;
|
|
939
1074
|
}
|
|
940
1075
|
|
|
941
1076
|
if (isBoolean(opts.dismissed)) {
|
|
942
|
-
|
|
1077
|
+
params += `&dismissed=${opts.dismissed}`;
|
|
943
1078
|
}
|
|
944
1079
|
|
|
945
1080
|
if (isBoolean(opts.rejected)) {
|
|
946
|
-
|
|
1081
|
+
params += `&rejected=${opts.rejected}`;
|
|
947
1082
|
}
|
|
948
1083
|
|
|
949
1084
|
if (isBoolean(opts.processing)) {
|
|
950
|
-
|
|
1085
|
+
params += `&processing=${opts.processing}`;
|
|
951
1086
|
}
|
|
952
1087
|
|
|
953
1088
|
if (isBoolean(opts.waiting)) {
|
|
954
|
-
|
|
1089
|
+
params += `&waiting=${opts.waiting}`;
|
|
955
1090
|
}
|
|
956
1091
|
|
|
957
1092
|
if (isString(opts.format) && ['csv', 'all'].includes(opts.format)) {
|
|
958
|
-
|
|
1093
|
+
params += `&format=${opts.format}`;
|
|
959
1094
|
}
|
|
960
1095
|
|
|
1096
|
+
if (params.length > 1) path += params;
|
|
961
1097
|
const headers = generateHeaders(
|
|
962
1098
|
this.headers,
|
|
963
1099
|
this.apiSecret,
|
|
@@ -1006,7 +1142,7 @@ class HollaExKit {
|
|
|
1006
1142
|
}
|
|
1007
1143
|
) {
|
|
1008
1144
|
const verb = 'POST';
|
|
1009
|
-
let path = `${this.baseUrl}/admin/transfer
|
|
1145
|
+
let path = `${this.baseUrl}/admin/transfer`;
|
|
1010
1146
|
const data = {
|
|
1011
1147
|
sender_id: senderId,
|
|
1012
1148
|
receiver_id: receiverId,
|
|
@@ -1120,7 +1256,7 @@ class HollaExKit {
|
|
|
1120
1256
|
}
|
|
1121
1257
|
) {
|
|
1122
1258
|
const verb = 'PUT';
|
|
1123
|
-
let path = `${this.baseUrl}/admin/mint
|
|
1259
|
+
let path = `${this.baseUrl}/admin/mint`;
|
|
1124
1260
|
const data = {
|
|
1125
1261
|
transaction_id: transactionId
|
|
1126
1262
|
};
|
|
@@ -1196,7 +1332,7 @@ class HollaExKit {
|
|
|
1196
1332
|
}
|
|
1197
1333
|
) {
|
|
1198
1334
|
const verb = 'POST';
|
|
1199
|
-
let path = `${this.baseUrl}/admin/burn
|
|
1335
|
+
let path = `${this.baseUrl}/admin/burn`;
|
|
1200
1336
|
const data = {
|
|
1201
1337
|
user_id: userId,
|
|
1202
1338
|
currency,
|
|
@@ -1259,7 +1395,7 @@ class HollaExKit {
|
|
|
1259
1395
|
}
|
|
1260
1396
|
) {
|
|
1261
1397
|
const verb = 'PUT';
|
|
1262
|
-
let path = `${this.baseUrl}/admin/burn
|
|
1398
|
+
let path = `${this.baseUrl}/admin/burn`;
|
|
1263
1399
|
const data = {
|
|
1264
1400
|
transaction_id: transactionId
|
|
1265
1401
|
};
|
|
@@ -1331,27 +1467,31 @@ class HollaExKit {
|
|
|
1331
1467
|
}
|
|
1332
1468
|
) {
|
|
1333
1469
|
const verb = 'GET';
|
|
1334
|
-
let path = `${this.baseUrl}/admin/check-transaction
|
|
1335
|
-
|
|
1470
|
+
let path = `${this.baseUrl}/admin/check-transaction`;
|
|
1471
|
+
let params = '?';
|
|
1472
|
+
|
|
1336
1473
|
if (isString(currency)) {
|
|
1337
|
-
|
|
1474
|
+
params += `¤cy=${currency}`;
|
|
1338
1475
|
}
|
|
1339
1476
|
|
|
1340
1477
|
if (isString(transactionId)) {
|
|
1341
|
-
|
|
1478
|
+
params += `&transaction_id=${transactionId}`;
|
|
1342
1479
|
}
|
|
1343
1480
|
|
|
1344
1481
|
if (isString(address)) {
|
|
1345
|
-
|
|
1482
|
+
params += `&address=${address}`;
|
|
1346
1483
|
}
|
|
1347
1484
|
|
|
1348
1485
|
if (isString(network)) {
|
|
1349
|
-
|
|
1486
|
+
params += `&network=${network}`;
|
|
1350
1487
|
}
|
|
1351
1488
|
|
|
1352
1489
|
if (isBoolean(opts.isTestnet)) {
|
|
1353
|
-
|
|
1490
|
+
params += `&is_testnet=${opts.isTestnet}`;
|
|
1354
1491
|
}
|
|
1492
|
+
|
|
1493
|
+
if (params.length > 1) path += params;
|
|
1494
|
+
|
|
1355
1495
|
const headers = generateHeaders(
|
|
1356
1496
|
this.headers,
|
|
1357
1497
|
this.apiSecret,
|
|
@@ -1417,43 +1557,46 @@ class HollaExKit {
|
|
|
1417
1557
|
}
|
|
1418
1558
|
) {
|
|
1419
1559
|
const verb = 'GET';
|
|
1420
|
-
let path = `${this.baseUrl}/admin/trades
|
|
1560
|
+
let path = `${this.baseUrl}/admin/trades`;
|
|
1561
|
+
let params = '?';
|
|
1421
1562
|
|
|
1422
1563
|
if (isNumber(opts.userId)) {
|
|
1423
|
-
|
|
1564
|
+
params += `&user_id=${opts.userId}`;
|
|
1424
1565
|
}
|
|
1425
1566
|
|
|
1426
1567
|
if (isNumber(opts.limit)) {
|
|
1427
|
-
|
|
1568
|
+
params += `&limit=${opts.limit}`;
|
|
1428
1569
|
}
|
|
1429
1570
|
|
|
1430
1571
|
if (isNumber(opts.page)) {
|
|
1431
|
-
|
|
1572
|
+
params += `&page=${opts.page}`;
|
|
1432
1573
|
}
|
|
1433
1574
|
|
|
1434
1575
|
if (isString(opts.symbol)) {
|
|
1435
|
-
|
|
1576
|
+
params += `&symbol=${opts.symbol}`;
|
|
1436
1577
|
}
|
|
1437
1578
|
|
|
1438
1579
|
if (isString(opts.orderBy)) {
|
|
1439
|
-
|
|
1580
|
+
params += `&order_by=${opts.orderBy}`;
|
|
1440
1581
|
}
|
|
1441
1582
|
|
|
1442
1583
|
if (isString(opts.order) && (opts.order === 'asc' || opts.order === 'desc')) {
|
|
1443
|
-
|
|
1584
|
+
params += `&order=${opts.order}`;
|
|
1444
1585
|
}
|
|
1445
1586
|
|
|
1446
1587
|
if (isDatetime(opts.startDate)) {
|
|
1447
|
-
|
|
1588
|
+
params += `&start_date=${sanitizeDate(opts.startDate)}`;
|
|
1448
1589
|
}
|
|
1449
1590
|
|
|
1450
1591
|
if (isDatetime(opts.endDate)) {
|
|
1451
|
-
|
|
1592
|
+
params += `&end_date=${sanitizeDate(opts.endDate)}`;
|
|
1452
1593
|
}
|
|
1453
1594
|
|
|
1454
1595
|
if (isString(opts.format) && ['csv', 'all'].includes(opts.format)) {
|
|
1455
|
-
|
|
1596
|
+
params += `&format=${opts.format}`;
|
|
1456
1597
|
}
|
|
1598
|
+
|
|
1599
|
+
if (params.length > 1) path += params;
|
|
1457
1600
|
|
|
1458
1601
|
const headers = generateHeaders(
|
|
1459
1602
|
this.headers,
|
|
@@ -1497,52 +1640,55 @@ class HollaExKit {
|
|
|
1497
1640
|
}
|
|
1498
1641
|
) {
|
|
1499
1642
|
const verb = 'GET';
|
|
1500
|
-
let path = `${this.baseUrl}/admin/orders
|
|
1643
|
+
let path = `${this.baseUrl}/admin/orders`;
|
|
1644
|
+
let params = '?';
|
|
1501
1645
|
|
|
1502
1646
|
if (isNumber(opts.userId)) {
|
|
1503
|
-
|
|
1647
|
+
params += `&user_id=${opts.userId}`;
|
|
1504
1648
|
}
|
|
1505
1649
|
|
|
1506
1650
|
if (isString(opts.side) && (opts.side === 'buy' || opts.side === 'sell')) {
|
|
1507
|
-
|
|
1651
|
+
params += `&side=${opts.side}`;
|
|
1508
1652
|
}
|
|
1509
1653
|
|
|
1510
1654
|
if (isString(opts.status)) {
|
|
1511
|
-
|
|
1655
|
+
params += `&status=${opts.status}`;
|
|
1512
1656
|
}
|
|
1513
1657
|
|
|
1514
1658
|
if (isBoolean(opts.open)) {
|
|
1515
|
-
|
|
1659
|
+
params += `&open=${opts.open}`;
|
|
1516
1660
|
}
|
|
1517
1661
|
|
|
1518
1662
|
if (isNumber(opts.limit)) {
|
|
1519
|
-
|
|
1663
|
+
params += `&limit=${opts.limit}`;
|
|
1520
1664
|
}
|
|
1521
1665
|
|
|
1522
1666
|
if (isNumber(opts.page)) {
|
|
1523
|
-
|
|
1667
|
+
params += `&page=${opts.page}`;
|
|
1524
1668
|
}
|
|
1525
1669
|
|
|
1526
1670
|
if (isString(opts.symbol)) {
|
|
1527
|
-
|
|
1671
|
+
params += `&symbol=${opts.symbol}`;
|
|
1528
1672
|
}
|
|
1529
1673
|
|
|
1530
1674
|
if (isString(opts.orderBy)) {
|
|
1531
|
-
|
|
1675
|
+
params += `&order_by=${opts.orderBy}`;
|
|
1532
1676
|
}
|
|
1533
1677
|
|
|
1534
1678
|
if (isString(opts.order) && (opts.order === 'asc' || opts.order === 'desc')) {
|
|
1535
|
-
|
|
1679
|
+
params += `&order=${opts.order}`;
|
|
1536
1680
|
}
|
|
1537
1681
|
|
|
1538
1682
|
if (isDatetime(opts.startDate)) {
|
|
1539
|
-
|
|
1683
|
+
params += `&start_date=${sanitizeDate(opts.startDate)}`;
|
|
1540
1684
|
}
|
|
1541
1685
|
|
|
1542
1686
|
if (isDatetime(opts.endDate)) {
|
|
1543
|
-
|
|
1687
|
+
params += `&end_date=${sanitizeDate(opts.endDate)}`;
|
|
1544
1688
|
}
|
|
1545
1689
|
|
|
1690
|
+
if (params.length > 1) path += params;
|
|
1691
|
+
|
|
1546
1692
|
const headers = generateHeaders(
|
|
1547
1693
|
this.headers,
|
|
1548
1694
|
this.apiSecret,
|
|
@@ -1561,15 +1707,18 @@ class HollaExKit {
|
|
|
1561
1707
|
*/
|
|
1562
1708
|
cancelExchangeUserOrder(userId, orderId) {
|
|
1563
1709
|
const verb = 'DELETE';
|
|
1564
|
-
let path = `${this.baseUrl}/admin/order
|
|
1710
|
+
let path = `${this.baseUrl}/admin/order`;
|
|
1711
|
+
let params = '?';
|
|
1565
1712
|
|
|
1566
1713
|
if (isString(orderId)) {
|
|
1567
|
-
|
|
1714
|
+
params += `&order_id=${orderId}`;
|
|
1568
1715
|
}
|
|
1569
1716
|
|
|
1570
1717
|
if (isNumber(userId)) {
|
|
1571
|
-
|
|
1718
|
+
params += `&user_id=${userId}`;
|
|
1572
1719
|
}
|
|
1720
|
+
|
|
1721
|
+
if (params.length > 1) path += params;
|
|
1573
1722
|
const headers = generateHeaders(
|
|
1574
1723
|
this.headers,
|
|
1575
1724
|
this.apiSecret,
|
|
@@ -1613,55 +1762,57 @@ class HollaExKit {
|
|
|
1613
1762
|
}
|
|
1614
1763
|
) {
|
|
1615
1764
|
const verb = 'GET';
|
|
1616
|
-
let path = `${this.baseUrl}/admin/users
|
|
1765
|
+
let path = `${this.baseUrl}/admin/users`;
|
|
1766
|
+
let params = '?';
|
|
1617
1767
|
|
|
1618
1768
|
if (isNumber(opts.userId)) {
|
|
1619
|
-
|
|
1769
|
+
params += `&id=${opts.userId}`;
|
|
1620
1770
|
}
|
|
1621
1771
|
|
|
1622
1772
|
if (isString(opts.search)) {
|
|
1623
|
-
|
|
1773
|
+
params += `&search=${opts.search}`;
|
|
1624
1774
|
}
|
|
1625
1775
|
|
|
1626
1776
|
if (isString(opts.type)) {
|
|
1627
|
-
|
|
1777
|
+
params += `&type=${opts.type}`;
|
|
1628
1778
|
}
|
|
1629
1779
|
|
|
1630
1780
|
if (isBoolean(opts.pending)) {
|
|
1631
|
-
|
|
1781
|
+
params += `&pending=${opts.pending}`;
|
|
1632
1782
|
}
|
|
1633
1783
|
|
|
1634
1784
|
if (isString(opts.pendingType) && (opts.pendingType === 'id' ||opts.pendingType === 'bank')) {
|
|
1635
|
-
|
|
1785
|
+
params += `&pending_type=${opts.pendingType}`;
|
|
1636
1786
|
}
|
|
1637
1787
|
|
|
1638
1788
|
if (isNumber(opts.limit)) {
|
|
1639
|
-
|
|
1789
|
+
params += `&limit=${opts.limit}`;
|
|
1640
1790
|
}
|
|
1641
1791
|
|
|
1642
1792
|
if (isNumber(opts.page)) {
|
|
1643
|
-
|
|
1793
|
+
params += `&page=${opts.page}`;
|
|
1644
1794
|
}
|
|
1645
1795
|
|
|
1646
1796
|
if (isString(opts.orderBy)) {
|
|
1647
|
-
|
|
1797
|
+
params += `&order_by=${opts.orderBy}`;
|
|
1648
1798
|
}
|
|
1649
1799
|
|
|
1650
1800
|
if (isString(opts.order) && (opts.order === 'asc' || opts.order === 'desc')) {
|
|
1651
|
-
|
|
1801
|
+
params += `&order=${opts.order}`;
|
|
1652
1802
|
}
|
|
1653
1803
|
|
|
1654
1804
|
if (isDatetime(opts.startDate)) {
|
|
1655
|
-
|
|
1805
|
+
params += `&start_date=${sanitizeDate(opts.startDate)}`;
|
|
1656
1806
|
}
|
|
1657
1807
|
|
|
1658
1808
|
if (isDatetime(opts.endDate)) {
|
|
1659
|
-
|
|
1809
|
+
params += `&end_date=${sanitizeDate(opts.endDate)}`;
|
|
1660
1810
|
}
|
|
1661
1811
|
|
|
1662
1812
|
if (isString(opts.format) && ['csv', 'all'].includes(opts.format)) {
|
|
1663
|
-
|
|
1813
|
+
params += `&format=${opts.format}`;
|
|
1664
1814
|
}
|
|
1815
|
+
if (params.length > 1) path += params;
|
|
1665
1816
|
|
|
1666
1817
|
const headers = generateHeaders(
|
|
1667
1818
|
this.headers,
|
|
@@ -1677,15 +1828,23 @@ class HollaExKit {
|
|
|
1677
1828
|
* Create exchange user
|
|
1678
1829
|
* @param {string} email - The mail address for the user
|
|
1679
1830
|
* @param {string} password - The password for the user
|
|
1831
|
+
* @param {string} opts.referral - The referral code for the user
|
|
1680
1832
|
* @return {object} A JSON object with message
|
|
1681
1833
|
*/
|
|
1682
|
-
createExchangeUser(email, password
|
|
1834
|
+
createExchangeUser(email, password, opts = {
|
|
1835
|
+
referral: null
|
|
1836
|
+
}) {
|
|
1683
1837
|
const verb = 'POST';
|
|
1684
1838
|
let path = `${this.baseUrl}/admin/user`;
|
|
1685
1839
|
const data = {
|
|
1686
1840
|
email,
|
|
1687
1841
|
password
|
|
1688
1842
|
};
|
|
1843
|
+
|
|
1844
|
+
|
|
1845
|
+
if (isString(opts.referral)) {
|
|
1846
|
+
data.referral = opts.referral;
|
|
1847
|
+
};
|
|
1689
1848
|
|
|
1690
1849
|
const headers = generateHeaders(
|
|
1691
1850
|
this.headers,
|
|
@@ -1835,6 +1994,30 @@ class HollaExKit {
|
|
|
1835
1994
|
}
|
|
1836
1995
|
|
|
1837
1996
|
}
|
|
1997
|
+
|
|
1998
|
+
/**
|
|
1999
|
+
* Delete exchange user
|
|
2000
|
+
* @param {number} user_id - The id for the user
|
|
2001
|
+
* @return {object} A JSON object with message
|
|
2002
|
+
*/
|
|
2003
|
+
deleteExchangeUser(user_id) {
|
|
2004
|
+
const verb = 'DELETE';
|
|
2005
|
+
let path = `${this.baseUrl}/admin/user`;
|
|
2006
|
+
const data = {
|
|
2007
|
+
user_id
|
|
2008
|
+
};
|
|
2009
|
+
|
|
2010
|
+
const headers = generateHeaders(
|
|
2011
|
+
this.headers,
|
|
2012
|
+
this.apiSecret,
|
|
2013
|
+
verb,
|
|
2014
|
+
path,
|
|
2015
|
+
this.apiExpiresAfter,
|
|
2016
|
+
data
|
|
2017
|
+
);
|
|
2018
|
+
return createRequest(verb, `${this.apiUrl}${path}`, headers, { data });
|
|
2019
|
+
}
|
|
2020
|
+
|
|
1838
2021
|
|
|
1839
2022
|
/**
|
|
1840
2023
|
* Create wallet for exchange user
|
|
@@ -1907,55 +2090,58 @@ class HollaExKit {
|
|
|
1907
2090
|
}
|
|
1908
2091
|
) {
|
|
1909
2092
|
const verb = 'GET';
|
|
1910
|
-
let path = `${this.baseUrl}/admin/user/wallet
|
|
2093
|
+
let path = `${this.baseUrl}/admin/user/wallet`;
|
|
2094
|
+
let params = '?';
|
|
1911
2095
|
|
|
1912
2096
|
if (isNumber(opts.userId)) {
|
|
1913
|
-
|
|
2097
|
+
params += `&user_id=${opts.userId}`;
|
|
1914
2098
|
}
|
|
1915
2099
|
|
|
1916
2100
|
if (isString(opts.currency)) {
|
|
1917
|
-
|
|
2101
|
+
params += `¤cy=${opts.currency}`;
|
|
1918
2102
|
}
|
|
1919
2103
|
|
|
1920
2104
|
if (isString(opts.address)) {
|
|
1921
|
-
|
|
2105
|
+
params += `&address=${opts.address}`;
|
|
1922
2106
|
}
|
|
1923
2107
|
|
|
1924
2108
|
if (isString(opts.network)) {
|
|
1925
|
-
|
|
2109
|
+
params += `&network=${opts.network}`;
|
|
1926
2110
|
}
|
|
1927
2111
|
|
|
1928
2112
|
if (isBoolean(opts.isValid)) {
|
|
1929
|
-
|
|
2113
|
+
params += `&is_valid=${opts.isValid}`;
|
|
1930
2114
|
}
|
|
1931
2115
|
|
|
1932
2116
|
if (isNumber(opts.limit)) {
|
|
1933
|
-
|
|
2117
|
+
params += `&limit=${opts.limit}`;
|
|
1934
2118
|
}
|
|
1935
2119
|
|
|
1936
2120
|
if (isNumber(opts.page)) {
|
|
1937
|
-
|
|
2121
|
+
params += `&page=${opts.page}`;
|
|
1938
2122
|
}
|
|
1939
2123
|
|
|
1940
2124
|
if (isString(opts.orderBy)) {
|
|
1941
|
-
|
|
2125
|
+
params += `&order_by=${opts.orderBy}`;
|
|
1942
2126
|
}
|
|
1943
2127
|
|
|
1944
2128
|
if (isString(opts.order) && (opts.order === 'asc' || opts.order === 'desc')) {
|
|
1945
|
-
|
|
2129
|
+
params += `&order=${opts.order}`;
|
|
1946
2130
|
}
|
|
1947
2131
|
|
|
1948
2132
|
if (isDatetime(opts.startDate)) {
|
|
1949
|
-
|
|
2133
|
+
params += `&start_date=${sanitizeDate(opts.startDate)}`;
|
|
1950
2134
|
}
|
|
1951
2135
|
|
|
1952
2136
|
if (isDatetime(opts.endDate)) {
|
|
1953
|
-
|
|
2137
|
+
params += `&end_date=${sanitizeDate(opts.endDate)}`;
|
|
1954
2138
|
}
|
|
1955
2139
|
|
|
1956
2140
|
if (isString(opts.format) && ['csv', 'all'].includes(opts.format)) {
|
|
1957
|
-
|
|
2141
|
+
params += `&format=${opts.format}`;
|
|
1958
2142
|
}
|
|
2143
|
+
|
|
2144
|
+
if (params.length > 1) path += params;
|
|
1959
2145
|
|
|
1960
2146
|
const headers = generateHeaders(
|
|
1961
2147
|
this.headers,
|
|
@@ -2040,40 +2226,43 @@ class HollaExKit {
|
|
|
2040
2226
|
}
|
|
2041
2227
|
) {
|
|
2042
2228
|
const verb = 'GET';
|
|
2043
|
-
let path = `${this.baseUrl}/admin/logins
|
|
2229
|
+
let path = `${this.baseUrl}/admin/logins`;
|
|
2230
|
+
let params = '?';
|
|
2044
2231
|
|
|
2045
2232
|
if (isNumber(opts.userId)) {
|
|
2046
|
-
|
|
2233
|
+
params += `&user_id=${opts.userId}`;
|
|
2047
2234
|
}
|
|
2048
2235
|
|
|
2049
2236
|
if (isNumber(opts.limit)) {
|
|
2050
|
-
|
|
2237
|
+
params += `&limit=${opts.limit}`;
|
|
2051
2238
|
}
|
|
2052
2239
|
|
|
2053
2240
|
if (isNumber(opts.page)) {
|
|
2054
|
-
|
|
2241
|
+
params += `&page=${opts.page}`;
|
|
2055
2242
|
}
|
|
2056
2243
|
|
|
2057
2244
|
if (isString(opts.orderBy)) {
|
|
2058
|
-
|
|
2245
|
+
params += `&order_by=${opts.orderBy}`;
|
|
2059
2246
|
}
|
|
2060
2247
|
|
|
2061
2248
|
if (isString(opts.order) && (opts.order === 'asc' || opts.order === 'desc')) {
|
|
2062
|
-
|
|
2249
|
+
params += `&order=${opts.order}`;
|
|
2063
2250
|
}
|
|
2064
2251
|
|
|
2065
2252
|
if (isDatetime(opts.startDate)) {
|
|
2066
|
-
|
|
2253
|
+
params += `&start_date=${sanitizeDate(opts.startDate)}`;
|
|
2067
2254
|
}
|
|
2068
2255
|
|
|
2069
2256
|
if (isDatetime(opts.endDate)) {
|
|
2070
|
-
|
|
2257
|
+
params += `&end_date=${sanitizeDate(opts.endDate)}`;
|
|
2071
2258
|
}
|
|
2072
2259
|
|
|
2073
2260
|
if (isString(opts.format) && ['csv', 'all'].includes(opts.format)) {
|
|
2074
|
-
|
|
2261
|
+
params += `&format=${opts.format}`;
|
|
2075
2262
|
}
|
|
2076
2263
|
|
|
2264
|
+
if (params.length > 1) path += params;
|
|
2265
|
+
|
|
2077
2266
|
const headers = generateHeaders(
|
|
2078
2267
|
this.headers,
|
|
2079
2268
|
this.apiSecret,
|
|
@@ -2154,36 +2343,38 @@ class HollaExKit {
|
|
|
2154
2343
|
}
|
|
2155
2344
|
) {
|
|
2156
2345
|
const verb = 'GET';
|
|
2157
|
-
let path = `${this.baseUrl}/admin/user/affiliation
|
|
2158
|
-
|
|
2346
|
+
let path = `${this.baseUrl}/admin/user/affiliation`;
|
|
2347
|
+
let params = '?';
|
|
2159
2348
|
|
|
2160
2349
|
if (isNumber(userId)) {
|
|
2161
|
-
|
|
2350
|
+
params += `&user_id=${userId}`;
|
|
2162
2351
|
}
|
|
2163
2352
|
|
|
2164
2353
|
if (isNumber(opts.limit)) {
|
|
2165
|
-
|
|
2354
|
+
params += `&limit=${opts.limit}`;
|
|
2166
2355
|
}
|
|
2167
2356
|
|
|
2168
2357
|
if (isNumber(opts.page)) {
|
|
2169
|
-
|
|
2358
|
+
params += `&page=${opts.page}`;
|
|
2170
2359
|
}
|
|
2171
2360
|
|
|
2172
2361
|
if (isString(opts.orderBy)) {
|
|
2173
|
-
|
|
2362
|
+
params += `&order_by=${opts.orderBy}`;
|
|
2174
2363
|
}
|
|
2175
2364
|
|
|
2176
2365
|
if (isString(opts.order) && (opts.order === 'asc' || opts.order === 'desc')) {
|
|
2177
|
-
|
|
2366
|
+
params += `&order=${opts.order}`;
|
|
2178
2367
|
}
|
|
2179
2368
|
|
|
2180
2369
|
if (isDatetime(opts.startDate)) {
|
|
2181
|
-
|
|
2370
|
+
params += `&start_date=${sanitizeDate(opts.startDate)}`;
|
|
2182
2371
|
}
|
|
2183
2372
|
|
|
2184
2373
|
if (isDatetime(opts.endDate)) {
|
|
2185
|
-
|
|
2374
|
+
params += `&end_date=${sanitizeDate(opts.endDate)}`;
|
|
2186
2375
|
}
|
|
2376
|
+
|
|
2377
|
+
if (params.length > 1) path += params;
|
|
2187
2378
|
|
|
2188
2379
|
|
|
2189
2380
|
const headers = generateHeaders(
|
|
@@ -2261,11 +2452,11 @@ class HollaExKit {
|
|
|
2261
2452
|
};
|
|
2262
2453
|
|
|
2263
2454
|
if(isString(opts.title)) {
|
|
2264
|
-
data.title = opts.title
|
|
2455
|
+
data.title = opts.title;
|
|
2265
2456
|
}
|
|
2266
2457
|
|
|
2267
2458
|
if(isString(opts.text)) {
|
|
2268
|
-
data.text = opts.text
|
|
2459
|
+
data.text = opts.text;
|
|
2269
2460
|
}
|
|
2270
2461
|
|
|
2271
2462
|
const headers = generateHeaders(
|
|
@@ -2279,7 +2470,173 @@ class HollaExKit {
|
|
|
2279
2470
|
return createRequest(verb, `${this.apiUrl}${path}`, headers, { data });
|
|
2280
2471
|
}
|
|
2281
2472
|
|
|
2473
|
+
/**
|
|
2474
|
+
* Retrieve user's balances by admin
|
|
2475
|
+
* @param {number} opts.userId - The identifier of the user to filter by
|
|
2476
|
+
* @param {number} opts.currency - The currency to filter by, pass undefined to receive data on all currencies
|
|
2477
|
+
* @param {string} opts.format - Custom format of data set. Enum: ['all', 'csv']
|
|
2478
|
+
* @return {object} A JSON object with referral info
|
|
2479
|
+
*/
|
|
2480
|
+
getExchangeUserBalances(
|
|
2481
|
+
opts = {
|
|
2482
|
+
userId: null,
|
|
2483
|
+
currency: null,
|
|
2484
|
+
format: null
|
|
2485
|
+
}
|
|
2486
|
+
) {
|
|
2487
|
+
const verb = 'GET';
|
|
2488
|
+
let path = `${this.baseUrl}/admin/balances?`;
|
|
2489
|
+
|
|
2490
|
+
|
|
2491
|
+
if (isNumber(opts.userId)) {
|
|
2492
|
+
path += `&user_id=${opts.userId}`;
|
|
2493
|
+
}
|
|
2494
|
+
|
|
2495
|
+
if (isString(opts.currency)) {
|
|
2496
|
+
path += `¤cy=${opts.currency}`;
|
|
2497
|
+
}
|
|
2498
|
+
|
|
2499
|
+
if (isString(opts.format) && ['csv', 'all'].includes(opts.format)) {
|
|
2500
|
+
path += `&format=${opts.format}`;
|
|
2501
|
+
}
|
|
2502
|
+
|
|
2503
|
+
const headers = generateHeaders(
|
|
2504
|
+
this.headers,
|
|
2505
|
+
this.apiSecret,
|
|
2506
|
+
verb,
|
|
2507
|
+
path,
|
|
2508
|
+
this.apiExpiresAfter
|
|
2509
|
+
);
|
|
2510
|
+
return createRequest(verb, `${this.apiUrl}${path}`, headers);
|
|
2511
|
+
}
|
|
2512
|
+
|
|
2513
|
+
/**
|
|
2514
|
+
* Create order on behalf of user
|
|
2515
|
+
* @param {number} user_id - User id for the order
|
|
2516
|
+
* @param {string} symbol - Currency symbol of the order e.g. xht-usdt
|
|
2517
|
+
* @param {number} size - Size of the order
|
|
2518
|
+
* @param {number} price - Order Price
|
|
2519
|
+
* @param {string} side - Order Side, buy or sell
|
|
2520
|
+
* @param {string} type - Order Type, limit or market
|
|
2521
|
+
*/
|
|
2522
|
+
createOrderByAdmin(
|
|
2523
|
+
user_id,
|
|
2524
|
+
symbol,
|
|
2525
|
+
size,
|
|
2526
|
+
price,
|
|
2527
|
+
side,
|
|
2528
|
+
type
|
|
2529
|
+
) {
|
|
2530
|
+
const verb = 'POST';
|
|
2531
|
+
let path = `${this.baseUrl}/admin/order`;
|
|
2532
|
+
|
|
2533
|
+
const data = {
|
|
2534
|
+
user_id,
|
|
2535
|
+
size,
|
|
2536
|
+
side,
|
|
2537
|
+
type,
|
|
2538
|
+
price,
|
|
2539
|
+
symbol
|
|
2540
|
+
};
|
|
2541
|
+
|
|
2542
|
+
const headers = generateHeaders(
|
|
2543
|
+
this.headers,
|
|
2544
|
+
this.apiSecret,
|
|
2545
|
+
verb,
|
|
2546
|
+
path,
|
|
2547
|
+
this.apiExpiresAfter,
|
|
2548
|
+
data
|
|
2549
|
+
);
|
|
2550
|
+
return createRequest(verb, `${this.apiUrl}${path}`, headers, { data });
|
|
2551
|
+
}
|
|
2282
2552
|
|
|
2553
|
+
/**
|
|
2554
|
+
* Create trade on behalf of users
|
|
2555
|
+
* @param {number} maker_id - User id for the maker
|
|
2556
|
+
* @param {number} taker_id - User id for the taker
|
|
2557
|
+
* @param {number} maker_fee - fee in percentage for the maker
|
|
2558
|
+
* @param {number} taker_fee - fee in percentage for the taker
|
|
2559
|
+
* @param {string} symbol - Currency symbol of the order e.g. xht-usdt
|
|
2560
|
+
* @param {number} size - Size of the order
|
|
2561
|
+
* @param {number} price - Order Price
|
|
2562
|
+
* @param {string} side - Order Side, buy or sell
|
|
2563
|
+
*/
|
|
2564
|
+
createTradeByAdmin(
|
|
2565
|
+
maker_id,
|
|
2566
|
+
taker_id,
|
|
2567
|
+
maker_fee,
|
|
2568
|
+
taker_fee,
|
|
2569
|
+
symbol,
|
|
2570
|
+
size,
|
|
2571
|
+
price,
|
|
2572
|
+
side,
|
|
2573
|
+
) {
|
|
2574
|
+
const verb = 'POST';
|
|
2575
|
+
let path = `${this.baseUrl}/admin/trade`;
|
|
2576
|
+
|
|
2577
|
+
const data = {
|
|
2578
|
+
maker_id,
|
|
2579
|
+
taker_id,
|
|
2580
|
+
maker_fee,
|
|
2581
|
+
taker_fee,
|
|
2582
|
+
symbol,
|
|
2583
|
+
size,
|
|
2584
|
+
price,
|
|
2585
|
+
side,
|
|
2586
|
+
};
|
|
2587
|
+
|
|
2588
|
+
const headers = generateHeaders(
|
|
2589
|
+
this.headers,
|
|
2590
|
+
this.apiSecret,
|
|
2591
|
+
verb,
|
|
2592
|
+
path,
|
|
2593
|
+
this.apiExpiresAfter,
|
|
2594
|
+
data
|
|
2595
|
+
);
|
|
2596
|
+
return createRequest(verb, `${this.apiUrl}${path}`, headers, { data });
|
|
2597
|
+
}
|
|
2598
|
+
/**
|
|
2599
|
+
* Create withdrawal on behalf of users
|
|
2600
|
+
* @param {number} user_id - User id for the withdrawal process
|
|
2601
|
+
* @param {string} address - Specific address for the withdrawal
|
|
2602
|
+
* @param {number} amount - Size of the withdrawal
|
|
2603
|
+
* @param {string} currency - Currency symbol of the withdrawal
|
|
2604
|
+
* @param {string} opts.network - Blockchain network
|
|
2605
|
+
*/
|
|
2606
|
+
createWithdrawalByAdmin(
|
|
2607
|
+
user_id,
|
|
2608
|
+
address,
|
|
2609
|
+
amount,
|
|
2610
|
+
currency,
|
|
2611
|
+
opts = {
|
|
2612
|
+
network: null
|
|
2613
|
+
}
|
|
2614
|
+
) {
|
|
2615
|
+
const verb = 'POST';
|
|
2616
|
+
let path = `${this.baseUrl}/admin/withdrawal`;
|
|
2617
|
+
|
|
2618
|
+
const data = {
|
|
2619
|
+
user_id,
|
|
2620
|
+
address,
|
|
2621
|
+
amount,
|
|
2622
|
+
currency
|
|
2623
|
+
};
|
|
2624
|
+
|
|
2625
|
+
if(isString(opts.network)) {
|
|
2626
|
+
data.network = opts.network;
|
|
2627
|
+
}
|
|
2628
|
+
|
|
2629
|
+
const headers = generateHeaders(
|
|
2630
|
+
this.headers,
|
|
2631
|
+
this.apiSecret,
|
|
2632
|
+
verb,
|
|
2633
|
+
path,
|
|
2634
|
+
this.apiExpiresAfter,
|
|
2635
|
+
data
|
|
2636
|
+
);
|
|
2637
|
+
return createRequest(verb, `${this.apiUrl}${path}`, headers, { data });
|
|
2638
|
+
}
|
|
2639
|
+
|
|
2283
2640
|
/**
|
|
2284
2641
|
* Connect to hollaEx websocket and listen to an event
|
|
2285
2642
|
* @param {array} events - The events to listen to
|