hollaex-node-lib 2.18.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 +5 -1
- package/kit.js +190 -31
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -102,8 +102,9 @@ client
|
|
|
102
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 |
|
|
103
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 |
|
|
104
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 |
|
|
105
|
-
| `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 |
|
|
106
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 |
|
|
107
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 |
|
|
108
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 |
|
|
109
110
|
| `getExchangeUserBalance` | <ul><li>**userId**: The identifier of the user</li></ul> | Retrieve user's login info by admin |
|
|
@@ -117,6 +118,9 @@ client
|
|
|
117
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 |
|
|
118
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 |
|
|
119
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 |
|
|
120
124
|
|
|
121
125
|
|
|
122
126
|
### Websocket
|
package/kit.js
CHANGED
|
@@ -208,7 +208,7 @@ class HollaExKit {
|
|
|
208
208
|
) {
|
|
209
209
|
const verb = 'GET';
|
|
210
210
|
let path = `${this.baseUrl}/user/deposits`;
|
|
211
|
-
let params = '?'
|
|
211
|
+
let params = '?';
|
|
212
212
|
|
|
213
213
|
if (isString(opts.currency)) {
|
|
214
214
|
params += `¤cy=${opts.currency}`;
|
|
@@ -318,7 +318,7 @@ class HollaExKit {
|
|
|
318
318
|
) {
|
|
319
319
|
const verb = 'GET';
|
|
320
320
|
let path = `${this.baseUrl}/user/withdrawals`;
|
|
321
|
-
let params = '?'
|
|
321
|
+
let params = '?';
|
|
322
322
|
|
|
323
323
|
if (isString(opts.currency)) {
|
|
324
324
|
params += `¤cy=${opts.currency}`;
|
|
@@ -1828,15 +1828,23 @@ class HollaExKit {
|
|
|
1828
1828
|
* Create exchange user
|
|
1829
1829
|
* @param {string} email - The mail address for the user
|
|
1830
1830
|
* @param {string} password - The password for the user
|
|
1831
|
+
* @param {string} opts.referral - The referral code for the user
|
|
1831
1832
|
* @return {object} A JSON object with message
|
|
1832
1833
|
*/
|
|
1833
|
-
createExchangeUser(email, password
|
|
1834
|
+
createExchangeUser(email, password, opts = {
|
|
1835
|
+
referral: null
|
|
1836
|
+
}) {
|
|
1834
1837
|
const verb = 'POST';
|
|
1835
1838
|
let path = `${this.baseUrl}/admin/user`;
|
|
1836
1839
|
const data = {
|
|
1837
1840
|
email,
|
|
1838
1841
|
password
|
|
1839
1842
|
};
|
|
1843
|
+
|
|
1844
|
+
|
|
1845
|
+
if (isString(opts.referral)) {
|
|
1846
|
+
data.referral = opts.referral;
|
|
1847
|
+
};
|
|
1840
1848
|
|
|
1841
1849
|
const headers = generateHeaders(
|
|
1842
1850
|
this.headers,
|
|
@@ -1986,6 +1994,30 @@ class HollaExKit {
|
|
|
1986
1994
|
}
|
|
1987
1995
|
|
|
1988
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
|
+
|
|
1989
2021
|
|
|
1990
2022
|
/**
|
|
1991
2023
|
* Create wallet for exchange user
|
|
@@ -2420,11 +2452,11 @@ class HollaExKit {
|
|
|
2420
2452
|
};
|
|
2421
2453
|
|
|
2422
2454
|
if(isString(opts.title)) {
|
|
2423
|
-
data.title = opts.title
|
|
2455
|
+
data.title = opts.title;
|
|
2424
2456
|
}
|
|
2425
2457
|
|
|
2426
2458
|
if(isString(opts.text)) {
|
|
2427
|
-
data.text = opts.text
|
|
2459
|
+
data.text = opts.text;
|
|
2428
2460
|
}
|
|
2429
2461
|
|
|
2430
2462
|
const headers = generateHeaders(
|
|
@@ -2445,39 +2477,166 @@ class HollaExKit {
|
|
|
2445
2477
|
* @param {string} opts.format - Custom format of data set. Enum: ['all', 'csv']
|
|
2446
2478
|
* @return {object} A JSON object with referral info
|
|
2447
2479
|
*/
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
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?`;
|
|
2457
2489
|
|
|
2458
2490
|
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2491
|
+
if (isNumber(opts.userId)) {
|
|
2492
|
+
path += `&user_id=${opts.userId}`;
|
|
2493
|
+
}
|
|
2462
2494
|
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2495
|
+
if (isString(opts.currency)) {
|
|
2496
|
+
path += `¤cy=${opts.currency}`;
|
|
2497
|
+
}
|
|
2466
2498
|
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2499
|
+
if (isString(opts.format) && ['csv', 'all'].includes(opts.format)) {
|
|
2500
|
+
path += `&format=${opts.format}`;
|
|
2501
|
+
}
|
|
2470
2502
|
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
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
|
+
}
|
|
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;
|
|
2479
2627
|
}
|
|
2480
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
|
+
|
|
2481
2640
|
/**
|
|
2482
2641
|
* Connect to hollaEx websocket and listen to an event
|
|
2483
2642
|
* @param {array} events - The events to listen to
|