hollaex-node-lib 2.19.3 → 2.19.5

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 CHANGED
@@ -92,10 +92,10 @@ client
92
92
  | `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 |
93
93
  | `getExchangeBalance` | | Retrieve admin's wallet balance |
94
94
  | `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 |
95
- | `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 |
96
- | `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 |
97
- | `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 |
98
- | `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 |
95
+ | `mint (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 |
96
+ | `updateMint (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 |
97
+ | `burn (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 |
98
+ | `updateBurn (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 |
99
99
  | `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 |
100
100
  | `settleExchangeFees` | <ul><li>**opts.userId**: The identifier of the user</li></ul> | Set exchange fees by admin |
101
101
  | `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 |
@@ -123,10 +123,12 @@ client
123
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 |
124
124
  | `getExchangeStakesByAdmin` | <ul><li>**opts.limit**: Number of elements to return. Default: 50. Maximum: 100</li><li>**opts.page**: Page of data to retrieve</li><li>**opts.order_by**: Field to order data</li><li>**opts.order**: Direction to order (asc/desc)</li><li>**opts.start_date**: Starting date of queried data in ISO8601 format</li><li>**opts.end_date**: Ending date of queried data in ISO8601 format</li><li>**opts.format**: Specify data format (csv/all)</li></ul> | Get exchange stakes for admin |
125
125
  | `createExchangeStakesByAdmin` | <ul><li>**name**: Name of the stake pool </li><li>**user_id**: User ID associated with the stake pool</li><li>**currency**: Currency of the stake pool</li><li>**account_id**: Account ID</li><li>**apy**: Annual Percentage Yield</li><li>**min_amount**: Minimum stake amount</li><li>**max_amount**: Maximum stake amount</li><li>**early_unstake**: Whether early unstake is allowed</li><li>**status**: Pool status (uninitialized/active/paused/terminated)</li><li>**opts.reward_currency**: Currency for rewards</li><li>**opts.duration**: Duration in days</li><li>**opts.slashing**: Whether slashing is enabled</li><li>**opts.slashing_earning_percentage**: Slashing percentage for earnings</li><li>**opts.slashing_principle_percentage**: Slashing percentage for principle</li><li>**opts.onboarding**: Whether pool is for onboarding</li><li>**opts.disclaimer**: Disclaimer text</li></ul> | Create exchange stakes for admin |
126
- | `updateExchangeStakesByAdmin` | <ul><li>**id**: ID of the stake pool to update</li><li>**opts.name**: Name of the stake pool </li><li>**opts.user_id**: User ID associated with the stake pool</li><li>**opts.currency**: Currency of the stake pool</li><li>**opts.reward_currency**: Currency for rewards</li><li>**opts.account_id**: Account ID</li><li>**opts.apy**: Annual Percentage Yield</li><li>**opts.duration**: Duration in days</li><li>**opts.slashing**: Whether slashing is enabled</li><li>**opts.slashing_earning_percentage**: Slashing percentage for earnings</li><li>**opts.slashing_principle_percentage**: Slashing percentage for principle</li><li>**opts.early_unstake**: Whether early unstake is allowed</li><li>**opts.min_amount**: Minimum stake amount</li><li>**opts.max_amount**: Maximum stake amount</li><li>**opts.status**: Pool status (uninitialized/active/paused/terminated)</li><li>**opts.onboarding**: Whether pool is for onboarding</li><li>**opts.disclaimer**: Disclaimer text</li></ul> | Update exchange stakes for admin |
126
+ | `updateExchangeStakesByAdmin` | <ul><li>**id**: ID of the stake pool to update</li><li>**opts.name**: Name of the stake pool </li><li>**opts.category**: Category of the stake pool</li><li>**opts.user_id**: User ID associated with the stake pool</li><li>**opts.currency**: Currency of the stake pool</li><li>**opts.reward_currency**: Currency for rewards</li><li>**opts.account_id**: Account ID</li><li>**opts.apy**: Annual Percentage Yield</li><li>**opts.duration**: Duration in days</li><li>**opts.slashing**: Whether slashing is enabled</li><li>**opts.slashing_earning_percentage**: Slashing percentage for earnings</li><li>**opts.slashing_principle_percentage**: Slashing percentage for principle</li><li>**opts.early_unstake**: Whether early unstake is allowed</li><li>**opts.min_amount**: Minimum stake amount</li><li>**opts.max_amount**: Maximum stake amount</li><li>**opts.status**: Pool status (uninitialized/active/paused/terminated)</li><li>**opts.onboarding**: Whether pool is for onboarding</li><li>**opts.disclaimer**: Disclaimer text</li></ul> | Update exchange stakes for admin |
127
127
  | `deleteExchangeStakesByAdmin` | <ul><li>**id**: ID of the stake pool to delete</li></ul> | Delete exchange stakes for admin |
128
128
  | `getExchangeStakersByAdmin` | <ul><li>**opts.id**: Unique identifier for the staker entry</li><li>**opts.user_id**: The ID of the user who has locked funds and staked</li><li>**opts.stake_id**: The ID of the stake pool</li><li>**opts.currency**: The currency in which the user staked</li><li>**opts.reward**: The amount the user has received as rewards</li><li>**opts.slashed**: The amount slashed</li><li>**opts.limit**: Number of elements to return. Default: 50. Maximum: 100</li><li>**opts.page**: Page of data to retrieve</li><li>**opts.order_by**: Field to order data</li><li>**opts.order**: Direction to order (asc/desc)</li><li>**opts.start_date**: Starting date of queried data in ISO8601 format</li><li>**opts.end_date**: Ending date of queried data in ISO8601 format</li><li>**opts.format**: Specify data format (csv/all)</li></ul> | Get exchange stakers of users for admin |
129
+ | `updateExchangeStakerByAdmin` | <ul><li>**id**: ID of the staker entry to update</li><li>**opts.nav**: Net asset value</li><li>**opts.reward**: Reward amount</li><li>**opts.status**: Staker status (staking/unstaking/closed)</li></ul> | Update exchange staker values for admin |
129
130
  | `getStakeAnalyticsByAdmin` | <ul><li>No parameters needed</li></ul> | Get staking and unstaking amounts |
131
+ | `disableUserWithdrawalByAdmin` | <ul><li>**user_id**: The ID of the user to disable withdrawals for</li><li>**opts.expiry_date**: ISO date‑time string when the block expires</li></ul> | Block a user’s withdrawal ability |
130
132
 
131
133
  ### Websocket
132
134
 
@@ -1,21 +1,21 @@
1
1
  const HollaEx = require('../index');
2
2
  require('dotenv').load();
3
3
 
4
- const API_KEY = process.env.API_KEY || '28f1da41a9c436dcf659cc6257700e2b239bea4b';
5
- const API_SECRET = process.env.API_SECRET || '27451f237cb685d669f9addc84b93c8982a3e69bb31f3acbf6';
4
+ const API_KEY = process.env.API_KEY || '';
5
+ const API_SECRET = process.env.API_SECRET || '';
6
6
  const client = new HollaEx({
7
- apiURL: 'https://api.sandbox.hollaex.com',
8
- wsURL: 'wss://api.sandbox.hollaex.com/stream',
7
+ apiURL: 'https://api.hollaex.com',
8
+ wsURL: 'wss://api.hollaex.com/stream',
9
9
  baseURL: '/v2',
10
10
  apiKey: API_KEY,
11
11
  apiSecret: API_SECRET
12
12
  });
13
13
 
14
14
  client
15
- .getExchangeUsers({ bank_key: 'iban', bank_value: 'asvsdf' })
15
+ .getTicker('xht-usdt')
16
16
  .then((data) => {
17
17
  console.log(data);
18
- // console.log('The volume is', data.volume);
18
+ console.log('The volume is', data.volume);
19
19
  })
20
20
  .catch((err) => {
21
21
  console.log(err);
@@ -28,12 +28,12 @@ client
28
28
  symbols : xht-usdt
29
29
  */
30
30
 
31
- // client.connect(['orderbook:xht-usdt']);
31
+ client.connect(['orderbook:xht-usdt']);
32
32
 
33
- // client.ws.on('message', (data) => {
34
- // data = JSON.parse(data);
35
- // console.log(data);
36
- // });
33
+ client.ws.on('message', (data) => {
34
+ data = JSON.parse(data);
35
+ console.log(data);
36
+ });
37
37
 
38
38
 
39
39
 
package/kit.js CHANGED
@@ -969,6 +969,7 @@ class HollaExKit {
969
969
  }
970
970
 
971
971
  if (isString(opts.format) && ['csv', 'all'].includes(opts.format)) {
972
+ path += '/csv';
972
973
  params += `&format=${opts.format}`;
973
974
  }
974
975
 
@@ -1090,6 +1091,7 @@ class HollaExKit {
1090
1091
  }
1091
1092
 
1092
1093
  if (isString(opts.format) && ['csv', 'all'].includes(opts.format)) {
1094
+ path += '/csv';
1093
1095
  params += `&format=${opts.format}`;
1094
1096
  }
1095
1097
 
@@ -1181,7 +1183,7 @@ class HollaExKit {
1181
1183
  * @param {number} opts.fee - The fee to specify
1182
1184
  * @return {object} A JSON object with deposit info
1183
1185
  */
1184
- createExchangeDeposit(
1186
+ mint(
1185
1187
  userId,
1186
1188
  currency,
1187
1189
  amount,
@@ -1189,7 +1191,9 @@ class HollaExKit {
1189
1191
  transactionId: null,
1190
1192
  status: null,
1191
1193
  email: null,
1192
- fee: null
1194
+ fee: null,
1195
+ address: null,
1196
+ description: null
1193
1197
  }
1194
1198
  ) {
1195
1199
  const verb = 'POST';
@@ -1217,6 +1221,14 @@ class HollaExKit {
1217
1221
  data.fee = opts.fee;
1218
1222
  }
1219
1223
 
1224
+ if (isString(opts.address)) {
1225
+ data.address = opts.address;
1226
+ }
1227
+
1228
+ if (isString(opts.description)) {
1229
+ data.description = opts.description;
1230
+ }
1231
+
1220
1232
  const headers = generateHeaders(
1221
1233
  this.headers,
1222
1234
  this.apiSecret,
@@ -1227,6 +1239,10 @@ class HollaExKit {
1227
1239
  );
1228
1240
  return createRequest(verb, `${this.apiUrl}${path}`, headers, { data });
1229
1241
  }
1242
+ // to support backward compatibility
1243
+ createExchangeDeposit(...args) {
1244
+ return this.mint(...args);
1245
+ }
1230
1246
 
1231
1247
  /**
1232
1248
  * Update exchange deposit by admin
@@ -1241,7 +1257,7 @@ class HollaExKit {
1241
1257
  * @param {boolean} opts.email - Email
1242
1258
  * @return {object} A JSON object with deposit info
1243
1259
  */
1244
- updateExchangeDeposit(
1260
+ updateMint(
1245
1261
  transactionId,
1246
1262
  opts = {
1247
1263
  updatedTransactionId: null,
@@ -1308,6 +1324,10 @@ class HollaExKit {
1308
1324
  return createRequest(verb, `${this.apiUrl}${path}`, headers, { data });
1309
1325
 
1310
1326
  }
1327
+ // to support backward compatibility
1328
+ updateExchangeDeposit(...args) {
1329
+ return this.updateMint(...args);
1330
+ }
1311
1331
 
1312
1332
  /**
1313
1333
  * Create exchange withdrawal by admin
@@ -1320,7 +1340,7 @@ class HollaExKit {
1320
1340
  * @param {number} opts.fee - The fee to specify
1321
1341
  * @return {object} A JSON object with withdrawal info
1322
1342
  */
1323
- createExchangeWithdrawal(
1343
+ burn(
1324
1344
  userId,
1325
1345
  currency,
1326
1346
  amount,
@@ -1328,7 +1348,9 @@ class HollaExKit {
1328
1348
  transactionId: null,
1329
1349
  status: null,
1330
1350
  email: null,
1331
- fee: null
1351
+ fee: null,
1352
+ address: null,
1353
+ description: null
1332
1354
  }
1333
1355
  ) {
1334
1356
  const verb = 'POST';
@@ -1356,6 +1378,14 @@ class HollaExKit {
1356
1378
  data.fee = opts.fee;
1357
1379
  }
1358
1380
 
1381
+ if (isString(opts.address)) {
1382
+ data.address = opts.address;
1383
+ }
1384
+
1385
+ if (isString(opts.description)) {
1386
+ data.description = opts.description;
1387
+ }
1388
+
1359
1389
  const headers = generateHeaders(
1360
1390
  this.headers,
1361
1391
  this.apiSecret,
@@ -1367,6 +1397,11 @@ class HollaExKit {
1367
1397
  return createRequest(verb, `${this.apiUrl}${path}`, headers, { data });
1368
1398
  }
1369
1399
 
1400
+ // to support backward compatibility
1401
+ createExchangeWithdrawal(...args) {
1402
+ return this.burn(...args);
1403
+ }
1404
+
1370
1405
  /**
1371
1406
  * Update Exchange Withdrawal
1372
1407
  * @param {string} transactionId - Withdrawals with specific transaction ID.
@@ -1380,7 +1415,7 @@ class HollaExKit {
1380
1415
  * @param {boolean} opts.email - Email
1381
1416
  * @return {object} A JSON object with withdrawal info
1382
1417
  */
1383
- updateExchangeWithdrawal(
1418
+ updateBurn(
1384
1419
  transactionId,
1385
1420
  opts = {
1386
1421
  updatedTransactionId: null,
@@ -1447,6 +1482,11 @@ class HollaExKit {
1447
1482
  return createRequest(verb, `${this.apiUrl}${path}`, headers, { data });
1448
1483
  }
1449
1484
 
1485
+ // to support backward compatibility
1486
+ updateExchangeWithdrawal(...args) {
1487
+ return this.updateBurn(...args);
1488
+ }
1489
+
1450
1490
  /**
1451
1491
  * Check exchange deposit status
1452
1492
  * @param {number} userId - The identifier of the user
@@ -1593,6 +1633,7 @@ class HollaExKit {
1593
1633
  }
1594
1634
 
1595
1635
  if (isString(opts.format) && ['csv', 'all'].includes(opts.format)) {
1636
+ path += '/csv';
1596
1637
  params += `&format=${opts.format}`;
1597
1638
  }
1598
1639
 
@@ -1828,6 +1869,7 @@ class HollaExKit {
1828
1869
  }
1829
1870
 
1830
1871
  if (isString(opts.format) && ['csv', 'all'].includes(opts.format)) {
1872
+ path += '/csv';
1831
1873
  params += `&format=${opts.format}`;
1832
1874
  }
1833
1875
  if (params.length > 1) path += params;
@@ -1862,7 +1904,7 @@ class HollaExKit {
1862
1904
 
1863
1905
  if (isString(opts.referral)) {
1864
1906
  data.referral = opts.referral;
1865
- };
1907
+ }
1866
1908
 
1867
1909
  const headers = generateHeaders(
1868
1910
  this.headers,
@@ -2156,6 +2198,7 @@ class HollaExKit {
2156
2198
  }
2157
2199
 
2158
2200
  if (isString(opts.format) && ['csv', 'all'].includes(opts.format)) {
2201
+ path += '/csv';
2159
2202
  params += `&format=${opts.format}`;
2160
2203
  }
2161
2204
 
@@ -2276,6 +2319,7 @@ class HollaExKit {
2276
2319
  }
2277
2320
 
2278
2321
  if (isString(opts.format) && ['csv', 'all'].includes(opts.format)) {
2322
+ path += '/csv';
2279
2323
  params += `&format=${opts.format}`;
2280
2324
  }
2281
2325
 
@@ -2515,6 +2559,7 @@ class HollaExKit {
2515
2559
  }
2516
2560
 
2517
2561
  if (isString(opts.format) && ['csv', 'all'].includes(opts.format)) {
2562
+ path += '/csv';
2518
2563
  path += `&format=${opts.format}`;
2519
2564
  }
2520
2565
 
@@ -2708,6 +2753,7 @@ class HollaExKit {
2708
2753
  }
2709
2754
 
2710
2755
  if (isString(opts.format)) {
2756
+ path += '/csv';
2711
2757
  params += `&format=${opts.format}`;
2712
2758
  }
2713
2759
 
@@ -2822,6 +2868,7 @@ class HollaExKit {
2822
2868
  * @param {number} id - ID of the stake pool to update
2823
2869
  * @param {object} opts - Optional parameters
2824
2870
  * @param {string} opts.name - Name of the stake pool
2871
+ * @param {string} opts.category - Category of the stake pool
2825
2872
  * @param {number} opts.user_id - User ID associated with the stake pool
2826
2873
  * @param {string} opts.currency - Currency of the stake pool
2827
2874
  * @param {string} opts.reward_currency - Currency for rewards
@@ -2843,6 +2890,7 @@ class HollaExKit {
2843
2890
  id,
2844
2891
  opts = {
2845
2892
  name: null,
2893
+ category: null,
2846
2894
  user_id: null,
2847
2895
  currency: null,
2848
2896
  reward_currency: null,
@@ -2869,6 +2917,10 @@ class HollaExKit {
2869
2917
  data.name = opts.name;
2870
2918
  }
2871
2919
 
2920
+ if (isString(opts.category)) {
2921
+ data.category = opts.category;
2922
+ }
2923
+
2872
2924
  if (isNumber(opts.user_id)) {
2873
2925
  data.user_id = opts.user_id;
2874
2926
  }
@@ -3049,6 +3101,7 @@ class HollaExKit {
3049
3101
  }
3050
3102
 
3051
3103
  if (isString(opts.format)) {
3104
+ path += '/csv';
3052
3105
  params += `&format=${opts.format}`;
3053
3106
  }
3054
3107
 
@@ -3063,6 +3116,51 @@ class HollaExKit {
3063
3116
  return createRequest(verb, `${this.apiUrl}${path}`, headers);
3064
3117
  }
3065
3118
 
3119
+ /**
3120
+ * Update exchange staker values for admin
3121
+ * @param {number} id - ID of the staker entry to update
3122
+ * @param {object} opts - Optional parameters
3123
+ * @param {number} opts.nav - Net asset value
3124
+ * @param {number} opts.reward - Reward amount
3125
+ * @param {string} opts.status - Staker status (staking/unstaking/closed)
3126
+ * @return {object} A JSON object with the updated staker
3127
+ */
3128
+ updateExchangeStakerByAdmin(
3129
+ id,
3130
+ opts = {
3131
+ nav: null,
3132
+ reward: null,
3133
+ status: null
3134
+ }
3135
+ ) {
3136
+ const verb = 'PUT';
3137
+ const path = `${this.baseUrl}/admin/staker`;
3138
+ const data = { id };
3139
+
3140
+ // Optional parameters
3141
+ if (isNumber(opts.nav)) {
3142
+ data.nav = opts.nav;
3143
+ }
3144
+
3145
+ if (isNumber(opts.reward)) {
3146
+ data.reward = opts.reward;
3147
+ }
3148
+
3149
+ if (isString(opts.status)) {
3150
+ data.status = opts.status;
3151
+ }
3152
+
3153
+ const headers = generateHeaders(
3154
+ this.headers,
3155
+ this.apiSecret,
3156
+ verb,
3157
+ path,
3158
+ this.apiExpiresAfter,
3159
+ data
3160
+ );
3161
+ return createRequest(verb, `${this.apiUrl}${path}`, headers, { data });
3162
+ }
3163
+
3066
3164
  /**
3067
3165
  * Get staking and unstaking amounts
3068
3166
  * @return {object} A JSON object with stake analytics data
@@ -3080,6 +3178,37 @@ class HollaExKit {
3080
3178
  );
3081
3179
  return createRequest(verb, `${this.apiUrl}${path}`, headers);
3082
3180
  }
3181
+
3182
+ /**
3183
+ * Block a user’s withdrawal ability
3184
+ * @param {number} user_id – The ID of the user to disable withdrawals for
3185
+ * @param {string|null} expiry_date – ISO date‑time string when the block expires
3186
+ * @return {object} A JSON object { message: "Success" }
3187
+ */
3188
+ disableUserWithdrawalByAdmin(user_id, opts = { expiry_date : null }
3189
+ ) {
3190
+ const verb = 'POST';
3191
+ const path = `${this.baseUrl}/admin/user/disable-withdrawal`;
3192
+ const data = {
3193
+ user_id
3194
+ };
3195
+
3196
+ if (opts.expiry_date !== null && isDatetime(opts.expiry_date)) {
3197
+ data.expiry_date = sanitizeDate(opts.expiry_date);
3198
+ }
3199
+
3200
+ const headers = generateHeaders(
3201
+ this.headers,
3202
+ this.apiSecret,
3203
+ verb,
3204
+ path,
3205
+ this.apiExpiresAfter,
3206
+ data
3207
+ );
3208
+
3209
+ return createRequest(verb, `${this.apiUrl}${path}`, headers, { data });
3210
+ }
3211
+
3083
3212
  /**
3084
3213
  * Connect to hollaEx websocket and listen to an event
3085
3214
  * @param {array} events - The events to listen to
@@ -3098,7 +3227,7 @@ class HollaExKit {
3098
3227
  apiExpires
3099
3228
  );
3100
3229
  url = `${url}?api-key=${this.apiKey
3101
- }&api-signature=${signature}&api-expires=${apiExpires}`;
3230
+ }&api-signature=${signature}&api-expires=${apiExpires}`;
3102
3231
  }
3103
3232
 
3104
3233
  this.ws = new WebSocket(url);
@@ -3190,41 +3319,21 @@ class HollaExKit {
3190
3319
  if (!this.wsEvents.includes(event) || this.initialConnection) {
3191
3320
  const [topic, symbol] = event.split(':');
3192
3321
  switch (topic) {
3193
- case 'orderbook':
3194
- case 'trade':
3195
- if (symbol) {
3196
- if (!this.wsEvents.includes(topic)) {
3197
- this.ws.send(
3198
- JSON.stringify({
3199
- op: 'subscribe',
3200
- args: [`${topic}:${symbol}`]
3201
- })
3202
- );
3203
- if (!this.initialConnection) {
3204
- this.wsEvents = union(this.wsEvents, [event]);
3205
- }
3206
- }
3207
- } else {
3322
+ case 'orderbook':
3323
+ case 'trade':
3324
+ if (symbol) {
3325
+ if (!this.wsEvents.includes(topic)) {
3208
3326
  this.ws.send(
3209
3327
  JSON.stringify({
3210
3328
  op: 'subscribe',
3211
- args: [topic]
3329
+ args: [`${topic}:${symbol}`]
3212
3330
  })
3213
3331
  );
3214
3332
  if (!this.initialConnection) {
3215
- this.wsEvents = this.wsEvents.filter(
3216
- (e) => !e.includes(`${topic}:`)
3217
- );
3218
3333
  this.wsEvents = union(this.wsEvents, [event]);
3219
3334
  }
3220
3335
  }
3221
- break;
3222
- case 'order':
3223
- case 'usertrade':
3224
- case 'wallet':
3225
- case 'deposit':
3226
- case 'withdrawal':
3227
- case 'admin':
3336
+ } else {
3228
3337
  this.ws.send(
3229
3338
  JSON.stringify({
3230
3339
  op: 'subscribe',
@@ -3232,11 +3341,32 @@ class HollaExKit {
3232
3341
  })
3233
3342
  );
3234
3343
  if (!this.initialConnection) {
3344
+ this.wsEvents = this.wsEvents.filter(
3345
+ (e) => !e.includes(`${topic}:`)
3346
+ );
3235
3347
  this.wsEvents = union(this.wsEvents, [event]);
3236
3348
  }
3237
- break;
3238
- default:
3239
- break;
3349
+ }
3350
+ break;
3351
+ case 'price':
3352
+ case 'order':
3353
+ case 'usertrade':
3354
+ case 'wallet':
3355
+ case 'deposit':
3356
+ case 'withdrawal':
3357
+ case 'admin':
3358
+ this.ws.send(
3359
+ JSON.stringify({
3360
+ op: 'subscribe',
3361
+ args: [topic]
3362
+ })
3363
+ );
3364
+ if (!this.initialConnection) {
3365
+ this.wsEvents = union(this.wsEvents, [event]);
3366
+ }
3367
+ break;
3368
+ default:
3369
+ break;
3240
3370
  }
3241
3371
  }
3242
3372
  });
@@ -3255,40 +3385,41 @@ class HollaExKit {
3255
3385
  if (this.wsEvents.includes(event)) {
3256
3386
  const [topic, symbol] = event.split(':');
3257
3387
  switch (topic) {
3258
- case 'orderbook':
3259
- case 'trade':
3260
- if (symbol) {
3261
- this.ws.send(
3262
- JSON.stringify({
3263
- op: 'unsubscribe',
3264
- args: [`${topic}:${symbol}`]
3265
- })
3266
- );
3267
- } else {
3268
- this.ws.send(
3269
- JSON.stringify({
3270
- op: 'unsubscribe',
3271
- args: [topic]
3272
- })
3273
- );
3274
- }
3275
- this.wsEvents = this.wsEvents.filter((e) => e !== event);
3276
- break;
3277
- case 'order':
3278
- case 'wallet':
3279
- case 'deposit':
3280
- case 'withdrawal':
3281
- case 'admin':
3388
+ case 'orderbook':
3389
+ case 'trade':
3390
+ if (symbol) {
3391
+ this.ws.send(
3392
+ JSON.stringify({
3393
+ op: 'unsubscribe',
3394
+ args: [`${topic}:${symbol}`]
3395
+ })
3396
+ );
3397
+ } else {
3282
3398
  this.ws.send(
3283
3399
  JSON.stringify({
3284
3400
  op: 'unsubscribe',
3285
3401
  args: [topic]
3286
3402
  })
3287
3403
  );
3288
- this.wsEvents = this.wsEvents.filter((e) => e !== event);
3289
- break;
3290
- default:
3291
- break;
3404
+ }
3405
+ this.wsEvents = this.wsEvents.filter((e) => e !== event);
3406
+ break;
3407
+ case 'price':
3408
+ case 'order':
3409
+ case 'wallet':
3410
+ case 'deposit':
3411
+ case 'withdrawal':
3412
+ case 'admin':
3413
+ this.ws.send(
3414
+ JSON.stringify({
3415
+ op: 'unsubscribe',
3416
+ args: [topic]
3417
+ })
3418
+ );
3419
+ this.wsEvents = this.wsEvents.filter((e) => e !== event);
3420
+ break;
3421
+ default:
3422
+ break;
3292
3423
  }
3293
3424
  }
3294
3425
  });
@@ -3298,4 +3429,4 @@ class HollaExKit {
3298
3429
  }
3299
3430
  }
3300
3431
 
3301
- module.exports = HollaExKit;
3432
+ module.exports = HollaExKit;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hollaex-node-lib",
3
- "version": "2.19.3",
3
+ "version": "2.19.5",
4
4
  "description": "hollaex api and websocket library for nodejs",
5
5
  "main": "index.js",
6
6
  "dependencies": {