hollaex-node-lib 2.14.1 → 2.15.1
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 +74 -2
- package/example/hollaex.js +17 -29
- package/kit.js +1506 -1
- package/package.json +1 -1
- package/.drone.yml +0 -59
- package/LICENSE +0 -21
package/README.md
CHANGED
|
@@ -77,6 +77,38 @@ client
|
|
|
77
77
|
| `cancelOrder` | <ul><li>**orderId**: HollaEx Network order ID</li></ul> | Cancel a specific order with its ID |
|
|
78
78
|
| `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 |
|
|
79
79
|
|
|
80
|
+
### Available admin functions:
|
|
81
|
+
|
|
82
|
+
| Command | Parameters | Description |
|
|
83
|
+
| - | - | - |
|
|
84
|
+
| `getExchangeInfo` | | Get admin exchange information
|
|
85
|
+
| `getExchangeDeposits` | <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.limit**: Amount of deposits per page. Maximum: 50. Default: 50</li><li>**opts.page**: Page of deposit 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.status**: Confirmed status of the deposits to get. Leave blank to get all confirmed and unconfirmed deposits</li><li>**opts.dismissed**: Dismissed status of the deposits to get. Leave blank to get all dismissed and undismissed </li>deposits<li>**opts.rejected**: Rejected status of the deposits to get. Leave blank to get all rejected and unrejected deposits</li><li>**opts.processing**: Processing status of the deposits to get. Leave blank to get all processing and unprocessing deposits </li><li>**opts.waiting**: Waiting status of the deposits to get. Leave blank to get all waiting and unwaiting deposits</li><li>**opts.transactionId**: Deposits with specific transaction ID.</li><li>**opts.address**: Deposits with specific address.</li><li>**opts.format**: Custom format of data set. Enum: ['all', 'csv']</li></ul> | Retrieve list of the user's deposits by admin |
|
|
86
|
+
| `getExchangeWithdrawals` | <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.status**: Confirmed status of the withdrawals to get. Leave blank to get all confirmed and unconfirmed withdrawals</li><li>**opts.dismissed**: Dismissed status of the withdrawals to get. Leave blank to get all dismissed and undismissed withdrawals</li><li>**opts.rejected**: Rejected status of the withdrawals to get. Leave blank to get all rejected and unrejected withdrawals</li><li>**opts.processing**: Processing status of the withdrawals to get. Leave blank to get all processing and unprocessing withdrawals</li><li>**opts.waiting**: Waiting status of the withdrawals to get. Leave blank to get all waiting and unwaiting withdrawals</li><li>**opts.limit**: Amount of withdrawals per page. Maximum: 50. Default: 50</li><li>**opts.page**: Page of withdrawal 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.transactionId**: Withdrawals with specific transaction ID.</li><li>**opts.address**: Withdrawals with specific address.</li><li>**opts.format**: Custom format of data set. Enum: ['all', 'csv']</li></ul> | Retrieve list of the user's withdrawals by admin |
|
|
87
|
+
| `getExchangeBalance` | | Retrieve admin's wallet balance |
|
|
88
|
+
| `transferExchangeAsset` | <ul><li>**senderId**: The identifier of the sender</li><li>**receiverId**: The identifier of the receiver</li><li>**currency**: The currency to specify</li><li>**amount**: The amount to specify</li><li>**opts.description**: The description field</li><li>**opts.email**: The email field</li></ul> | Transfer exchange asset by admin |
|
|
89
|
+
| `createExchangeDeposit` | <ul><li>**userId**: The identifier of the user</li><li>**currency**: The currency to specify</li><li>**amount**: The amount to specify</li><li>**opts.transactionId**: deposit with specific transaction ID.</li><li>**opts.status**: The status field to confirm the deposit</li><li>**opts.email**: The email field</li><li>**opts.fee**: The fee to specify</li></ul> | Create exchange deposit by admin |
|
|
90
|
+
| `updateExchangeDeposit` | <ul><li>**transactionId**: Deposits with specific transaction ID.</li><li>**opts.updatedTransactionId**: Deposits with updated transaction id</li><li>**opts.updatedAddress**: Deposits with updated address</li><li>**opts.status**: Confirmed status of the deposits to set. </li><li>**opts.dismissed**: Dismissed status of the deposits to set.</li><li>**opts.rejected**: Rejected status of the deposits to set. </li><li>**opts.processing**: Processing status of the deposits to set. </li><li>**opts.waiting**: Waiting status of the deposits to set.</li><li>**opts.email**: Email</li></ul> | Update exchange deposit by admin |
|
|
91
|
+
| `createExchangeWithdrawal` | <ul><li>**userId**: The identifier of the user</li><li>**currency**: The currency to specify</li><li>**amount**: The amount to specify</li><li>**opts.transactionId**: Withdrawal with specific transaction ID.</li><li>**opts.status**: The status field to confirm the withdrawal</li><li>**opts.email**: The email field</li><li>**opts.fee**: The fee to specify</li></ul> | Create exchange withdrawal by admin |
|
|
92
|
+
| `updateExchangeWithdrawal` | <ul><li>**transactionId**: Withdrawals with specific transaction ID.</li><li>**opts.updatedTransactionId**: Withdrawals with updated transaction id</li><li>**opts.updatedAddress**: Withdrawals with updated address</li><li>**opts.status**: Confirmed status of the withdrawals to set. </li><li>**opts.dismissed**: Dismissed status of the withdrawals to set.</li><li>**opts.rejected**: Rejected status of the withdrawals to set. </li><li>**opts.processing**: Processing status of the withdrawals to set.</li><li>**opts.waiting**: Waiting status of the withdrawals to set.</li><li>**opts.email**: Email</li></ul> | Update Exchange Withdrawal |
|
|
93
|
+
| `checkExchangeDepositStatus` | <ul><li>**userId**: The identifier of the user</li><li>**currency**: The currency to filter by, pass undefined to receive data on all currencies</li><li>**transactionId**: Deposits with specific transaction ID.</li><li>**address**: Deposits with specific address.</li><li>**network**: The network info</li><li>**opts.isTestnet**: The info on whether it's a testnet or not</li></ul> | Check exchange deposit status |
|
|
94
|
+
| `settleExchangeFees` | <ul><li>**opts.userId**: The identifier of the user</li></ul> | Set exchange fees by admin |
|
|
95
|
+
| `getExchangeTrades` | <ul><li>**opts.userId**: The identifier of the user</li><li>**opts.side**: The order side (buy or side)</li><li>**opts.limit**: Amount of trades per page. Maximum: 50. Default: 50</li><li>**opts.page**: Page of trades 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 trade 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 user's trades by admin |
|
|
96
|
+
| `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 |
|
|
97
|
+
| `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 |
|
|
98
|
+
| `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 |
|
|
99
|
+
| `createExchangeUser` | <ul><li>**email**: The mail address for the user</li<li>**password**: The password for the user</li></ul> | Create exchange user |
|
|
100
|
+
| `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 |
|
|
101
|
+
| `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 |
|
|
102
|
+
| `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 |
|
|
103
|
+
| `getExchangeUserBalance` | <ul><li>**userId**: The identifier of the user</li></ul> | Retrieve user's login info by admin |
|
|
104
|
+
| `createExchangeUserBank` | <ul><li>**userId**: The identifier of the user</li><li>**bankAccount**: Array of objects with bank account info</li></ul> | Create bank account for user by admin |
|
|
105
|
+
| `getExchangeUserLogins` | <ul><li>**opts.userId**: The identifier of the user</li><li>**opts.limit**: Amount of logins per page. Maximum: 50. Default: 50</li><li>**opts.page**: Page of referral 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></ul> | Retrieve user's login info by admin |
|
|
106
|
+
| `deactivateExchangeUser` | <ul><li>**userId**: The identifier of the user to deactivate their exchange account</li></ul> | Deactivate exchange user account by admin |
|
|
107
|
+
| `deactivateExchangeUserOtp` | <ul><li>**userId**: The identifier of the user to deactivate their otp</li></ul> | Deactivate user otp by admin |
|
|
108
|
+
| `getExchangeUserReferrals` | <ul><li>**userId**: The identifier of the user to filter by</li><li>**opts.limit**: Amount of referrals per page. Maximum: 50. Default: 50</li><li>**opts.page**: Page of referral 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></ul> | Retrieve user's referrals info by admin |
|
|
109
|
+
| `getExchangeUserReferrer` | <ul><li>**userId**: The identifier of the user to filter by</li></ul> | Retrieve user's referer info by admin |
|
|
110
|
+
|
|
111
|
+
|
|
80
112
|
### Websocket
|
|
81
113
|
|
|
82
114
|
#### Functions
|
|
@@ -111,10 +143,15 @@ client.unsubscribe(['orderbook']);
|
|
|
111
143
|
|
|
112
144
|
Here is the list of channels you can subscribe to:
|
|
113
145
|
|
|
114
|
-
- `orderbook`
|
|
115
|
-
- `
|
|
146
|
+
- `orderbook` (Available publicly)
|
|
147
|
+
- `trade` (Available publicly)
|
|
116
148
|
- `order` (Only available with authentication. Receive order updates)
|
|
149
|
+
- `usertrade` (Only available with authentication. Receive user trades)
|
|
117
150
|
- `wallet` (Only available with authentication. Receive balance updates)
|
|
151
|
+
- `deposit` (Only available with authentication. Receive deposit notifications)
|
|
152
|
+
- `withdrawal` (Only available with authentication. Receive withdrawal notifications)
|
|
153
|
+
- `admin` (Only available with authentication for the exchange administrator. Receive exchange operations such as deposits and withdrawals of all users)
|
|
154
|
+
|
|
118
155
|
|
|
119
156
|
For public channels (`orderbook`, `trade`), you can subscribe to specific symbols as follows:
|
|
120
157
|
`orderbook:xht-usdt`, `trade:xht-usdt`. Not passing a symbol will subscribe to all symbols.
|
|
@@ -309,6 +346,41 @@ These are exapmles of data responses from the server.
|
|
|
309
346
|
"time": 1608022610
|
|
310
347
|
}
|
|
311
348
|
```
|
|
349
|
+
- **deposit**: Updates related to the user's private information are as follows:
|
|
350
|
+
|
|
351
|
+
```json
|
|
352
|
+
{
|
|
353
|
+
"topic": "deposit",
|
|
354
|
+
"action": "insert",
|
|
355
|
+
"user_id": 1,
|
|
356
|
+
"data": {
|
|
357
|
+
"amount": 1,
|
|
358
|
+
"currency": "xht",
|
|
359
|
+
"status": "COMPLETED",
|
|
360
|
+
"transaction_id": "123",
|
|
361
|
+
...
|
|
362
|
+
},
|
|
363
|
+
"time": 1608021684
|
|
364
|
+
}
|
|
365
|
+
```
|
|
366
|
+
- **withdrawal**: Updates related to the user's private information are as follows:
|
|
367
|
+
|
|
368
|
+
```json
|
|
369
|
+
{
|
|
370
|
+
"topic": "withdrawal",
|
|
371
|
+
"action": "insert",
|
|
372
|
+
"user_id": 1,
|
|
373
|
+
"data": {
|
|
374
|
+
"amount": 1,
|
|
375
|
+
"currency": "xht",
|
|
376
|
+
"status": "COMPLETED",
|
|
377
|
+
"transaction_id": "123",
|
|
378
|
+
...
|
|
379
|
+
},
|
|
380
|
+
"time": 1608021684
|
|
381
|
+
}
|
|
382
|
+
```
|
|
383
|
+
|
|
312
384
|
## Example
|
|
313
385
|
|
|
314
386
|
You can run the example by going to example folder and running:
|
package/example/hollaex.js
CHANGED
|
@@ -1,27 +1,19 @@
|
|
|
1
1
|
const HollaEx = require('../index');
|
|
2
2
|
require('dotenv').load();
|
|
3
3
|
|
|
4
|
-
const API_KEY = process.env.API_KEY || '
|
|
5
|
-
const API_SECRET = process.env.API_SECRET || '
|
|
6
|
-
const client = new HollaEx({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
// console.log(data);
|
|
18
|
-
// // console.log('The volume is', data.volume);
|
|
19
|
-
// // const withdrawal = await client.makeWithdrawal('xht', 1, '0x97e13fccfe2edab7e8077d0f2ac69fe984cfe7f7', { network: 'eth' });
|
|
20
|
-
// // console.log(withdrawal);
|
|
21
|
-
// })
|
|
22
|
-
// .catch((err) => {
|
|
23
|
-
// console.log(err);
|
|
24
|
-
// });
|
|
4
|
+
const API_KEY = process.env.API_KEY || '';
|
|
5
|
+
const API_SECRET = process.env.API_SECRET || '';
|
|
6
|
+
const client = new HollaEx({ apiKey: API_KEY, apiSecret: API_SECRET });
|
|
7
|
+
|
|
8
|
+
client
|
|
9
|
+
.getTicker('xht-usdt')
|
|
10
|
+
.then((data) => {
|
|
11
|
+
console.log(data);
|
|
12
|
+
console.log('The volume is', data.volume);
|
|
13
|
+
})
|
|
14
|
+
.catch((err) => {
|
|
15
|
+
console.log(err);
|
|
16
|
+
});
|
|
25
17
|
|
|
26
18
|
// connect to websocket
|
|
27
19
|
/*
|
|
@@ -30,7 +22,7 @@ const client = new HollaEx({ apiURL: 'https://api.sandbox.hollaex.com', apiKey:
|
|
|
30
22
|
symbols : xht-usdt
|
|
31
23
|
*/
|
|
32
24
|
|
|
33
|
-
client.connect(['
|
|
25
|
+
client.connect(['trade']);
|
|
34
26
|
|
|
35
27
|
client.ws.on('message', (data) => {
|
|
36
28
|
data = JSON.parse(data);
|
|
@@ -38,11 +30,7 @@ client.ws.on('message', (data) => {
|
|
|
38
30
|
});
|
|
39
31
|
|
|
40
32
|
|
|
41
|
-
client.ws.on('error', (error) => {
|
|
42
|
-
console.log(error);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
33
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
34
|
+
setTimeout(() => {
|
|
35
|
+
client.disconnect();
|
|
36
|
+
}, 10000);
|