hollaex-node-lib 2.19.0 → 2.19.2
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 +7 -2
- package/kit.js +678 -236
- package/package.json +1 -1
package/kit.js
CHANGED
|
@@ -693,7 +693,7 @@ class HollaExKit {
|
|
|
693
693
|
* @return {object} A JSON object with conversion info
|
|
694
694
|
*/
|
|
695
695
|
getOraclePrice(
|
|
696
|
-
assets,
|
|
696
|
+
assets,
|
|
697
697
|
opts = {
|
|
698
698
|
quote: null,
|
|
699
699
|
amount: null
|
|
@@ -710,7 +710,7 @@ class HollaExKit {
|
|
|
710
710
|
if (isString(opts.quote)) {
|
|
711
711
|
params += `"e=${opts.quote}`;
|
|
712
712
|
}
|
|
713
|
-
|
|
713
|
+
|
|
714
714
|
if (isNumber(opts.amount)) {
|
|
715
715
|
params += `&amount=${opts.amount}`;
|
|
716
716
|
}
|
|
@@ -726,7 +726,7 @@ class HollaExKit {
|
|
|
726
726
|
return createRequest(verb, `${this.apiUrl}${path}`, headers);
|
|
727
727
|
}
|
|
728
728
|
|
|
729
|
-
|
|
729
|
+
|
|
730
730
|
/**
|
|
731
731
|
* Get trade history HOLCV for all pairs
|
|
732
732
|
* @param {array} assets - The list of assets to get the mini charts for
|
|
@@ -750,21 +750,21 @@ class HollaExKit {
|
|
|
750
750
|
if (isArray(assets)) {
|
|
751
751
|
params += `&assets=${opts.assets}`;
|
|
752
752
|
}
|
|
753
|
-
|
|
753
|
+
|
|
754
754
|
if (isString(opts.from)) {
|
|
755
755
|
params += `&from=${opts.from}`;
|
|
756
756
|
}
|
|
757
|
-
|
|
757
|
+
|
|
758
758
|
if (isString(opts.to)) {
|
|
759
759
|
params += `&to=${opts.to}`;
|
|
760
760
|
}
|
|
761
|
-
|
|
761
|
+
|
|
762
762
|
if (isString(opts.quote)) {
|
|
763
763
|
params += `"e=${opts.quote}`;
|
|
764
764
|
}
|
|
765
|
-
|
|
765
|
+
|
|
766
766
|
if (params.length > 1) path += params;
|
|
767
|
-
|
|
767
|
+
|
|
768
768
|
const headers = generateHeaders(
|
|
769
769
|
this.headers,
|
|
770
770
|
this.apiSecret,
|
|
@@ -774,7 +774,7 @@ class HollaExKit {
|
|
|
774
774
|
);
|
|
775
775
|
return createRequest(verb, `${this.apiUrl}${path}`, headers);
|
|
776
776
|
}
|
|
777
|
-
|
|
777
|
+
|
|
778
778
|
/**
|
|
779
779
|
* Get Quick Trade Quote
|
|
780
780
|
* @param {string} spending_currency - Currency symbol of the spending currency
|
|
@@ -793,11 +793,11 @@ class HollaExKit {
|
|
|
793
793
|
const verb = 'GET';
|
|
794
794
|
let path = `${this.baseUrl}/quick-trade`;
|
|
795
795
|
let params = '?';
|
|
796
|
-
|
|
796
|
+
|
|
797
797
|
if (isString(spending_currency)) {
|
|
798
798
|
params += `&spending_currency=${spending_currency}`;
|
|
799
799
|
}
|
|
800
|
-
|
|
800
|
+
|
|
801
801
|
if (isString(receiving_currency)) {
|
|
802
802
|
params += `&receiving_currency=${receiving_currency}`;
|
|
803
803
|
}
|
|
@@ -805,13 +805,13 @@ class HollaExKit {
|
|
|
805
805
|
if (isString(opts.spending_amount)) {
|
|
806
806
|
params += `&spending_amount=${opts.spending_amount}`;
|
|
807
807
|
}
|
|
808
|
-
|
|
808
|
+
|
|
809
809
|
if (isString(opts.receiving_amount)) {
|
|
810
810
|
params += `&receiving_amount=${opts.receiving_amount}`;
|
|
811
811
|
}
|
|
812
|
-
|
|
812
|
+
|
|
813
813
|
if (params.length > 1) path += params;
|
|
814
|
-
|
|
814
|
+
|
|
815
815
|
const headers = generateHeaders(
|
|
816
816
|
this.headers,
|
|
817
817
|
this.apiSecret,
|
|
@@ -834,7 +834,7 @@ class HollaExKit {
|
|
|
834
834
|
const data = {
|
|
835
835
|
token
|
|
836
836
|
};
|
|
837
|
-
|
|
837
|
+
|
|
838
838
|
const headers = generateHeaders(
|
|
839
839
|
this.headers,
|
|
840
840
|
this.apiSecret,
|
|
@@ -907,7 +907,7 @@ class HollaExKit {
|
|
|
907
907
|
const verb = 'GET';
|
|
908
908
|
let path = `${this.baseUrl}/admin/deposits`;
|
|
909
909
|
let params = '?';
|
|
910
|
-
|
|
910
|
+
|
|
911
911
|
if (isNumber(opts.userId)) {
|
|
912
912
|
params += `&user_id=${opts.userId}`;
|
|
913
913
|
}
|
|
@@ -983,7 +983,7 @@ class HollaExKit {
|
|
|
983
983
|
);
|
|
984
984
|
return createRequest(verb, `${this.apiUrl}${path}`, headers);
|
|
985
985
|
}
|
|
986
|
-
|
|
986
|
+
|
|
987
987
|
/**
|
|
988
988
|
* Retrieve list of the user's withdrawals by admin
|
|
989
989
|
* @param {object} opts - Optional parameters
|
|
@@ -1150,7 +1150,7 @@ class HollaExKit {
|
|
|
1150
1150
|
amount
|
|
1151
1151
|
};
|
|
1152
1152
|
|
|
1153
|
-
|
|
1153
|
+
|
|
1154
1154
|
if (isString(opts.description)) {
|
|
1155
1155
|
data.description = opts.description;
|
|
1156
1156
|
}
|
|
@@ -1200,7 +1200,7 @@ class HollaExKit {
|
|
|
1200
1200
|
amount
|
|
1201
1201
|
};
|
|
1202
1202
|
|
|
1203
|
-
|
|
1203
|
+
|
|
1204
1204
|
if (isString(opts.transactionId)) {
|
|
1205
1205
|
data.transaction_id = opts.transactionId;
|
|
1206
1206
|
}
|
|
@@ -1264,7 +1264,7 @@ class HollaExKit {
|
|
|
1264
1264
|
if (isString(opts.updatedTransactionId)) {
|
|
1265
1265
|
data.updated_transaction_id = opts.updatedTransactionId;
|
|
1266
1266
|
}
|
|
1267
|
-
|
|
1267
|
+
|
|
1268
1268
|
if (isString(opts.updatedAddress)) {
|
|
1269
1269
|
data.updated_address = opts.updatedAddress;
|
|
1270
1270
|
}
|
|
@@ -1338,24 +1338,24 @@ class HollaExKit {
|
|
|
1338
1338
|
currency,
|
|
1339
1339
|
amount
|
|
1340
1340
|
};
|
|
1341
|
-
|
|
1342
|
-
|
|
1341
|
+
|
|
1342
|
+
|
|
1343
1343
|
if (isString(opts.transactionId)) {
|
|
1344
1344
|
data.transaction_id = opts.transactionId;
|
|
1345
1345
|
}
|
|
1346
|
-
|
|
1346
|
+
|
|
1347
1347
|
if (isBoolean(opts.status)) {
|
|
1348
1348
|
data.status = opts.status;
|
|
1349
1349
|
}
|
|
1350
|
-
|
|
1350
|
+
|
|
1351
1351
|
if (isBoolean(opts.email)) {
|
|
1352
1352
|
data.email = opts.email;
|
|
1353
1353
|
}
|
|
1354
|
-
|
|
1354
|
+
|
|
1355
1355
|
if (isNumber(opts.fee)) {
|
|
1356
1356
|
data.fee = opts.fee;
|
|
1357
1357
|
}
|
|
1358
|
-
|
|
1358
|
+
|
|
1359
1359
|
const headers = generateHeaders(
|
|
1360
1360
|
this.headers,
|
|
1361
1361
|
this.apiSecret,
|
|
@@ -1366,7 +1366,7 @@ class HollaExKit {
|
|
|
1366
1366
|
);
|
|
1367
1367
|
return createRequest(verb, `${this.apiUrl}${path}`, headers, { data });
|
|
1368
1368
|
}
|
|
1369
|
-
|
|
1369
|
+
|
|
1370
1370
|
/**
|
|
1371
1371
|
* Update Exchange Withdrawal
|
|
1372
1372
|
* @param {string} transactionId - Withdrawals with specific transaction ID.
|
|
@@ -1399,43 +1399,43 @@ class HollaExKit {
|
|
|
1399
1399
|
const data = {
|
|
1400
1400
|
transaction_id: transactionId
|
|
1401
1401
|
};
|
|
1402
|
-
|
|
1402
|
+
|
|
1403
1403
|
if (isString(opts.updatedTransactionId)) {
|
|
1404
1404
|
data.updated_transaction_id = opts.updatedTransactionId;
|
|
1405
1405
|
}
|
|
1406
|
-
|
|
1406
|
+
|
|
1407
1407
|
if (isString(opts.updatedAddress)) {
|
|
1408
1408
|
data.updated_address = opts.updatedAddress;
|
|
1409
1409
|
}
|
|
1410
|
-
|
|
1410
|
+
|
|
1411
1411
|
if (isBoolean(opts.status)) {
|
|
1412
1412
|
data.status = opts.status;
|
|
1413
1413
|
}
|
|
1414
|
-
|
|
1414
|
+
|
|
1415
1415
|
if (isBoolean(opts.rejected)) {
|
|
1416
1416
|
data.rejected = opts.rejected;
|
|
1417
1417
|
}
|
|
1418
|
-
|
|
1418
|
+
|
|
1419
1419
|
if (isBoolean(opts.dismissed)) {
|
|
1420
1420
|
data.dismissed = opts.dismissed;
|
|
1421
1421
|
}
|
|
1422
|
-
|
|
1422
|
+
|
|
1423
1423
|
if (isBoolean(opts.processing)) {
|
|
1424
1424
|
data.processing = opts.processing;
|
|
1425
1425
|
}
|
|
1426
|
-
|
|
1426
|
+
|
|
1427
1427
|
if (isBoolean(opts.waiting)) {
|
|
1428
1428
|
data.waiting = opts.waiting;
|
|
1429
1429
|
}
|
|
1430
|
-
|
|
1430
|
+
|
|
1431
1431
|
if (isBoolean(opts.email)) {
|
|
1432
1432
|
data.email = opts.email;
|
|
1433
1433
|
}
|
|
1434
|
-
|
|
1434
|
+
|
|
1435
1435
|
if (isString(opts.description)) {
|
|
1436
1436
|
data.description = opts.description;
|
|
1437
1437
|
}
|
|
1438
|
-
|
|
1438
|
+
|
|
1439
1439
|
const headers = generateHeaders(
|
|
1440
1440
|
this.headers,
|
|
1441
1441
|
this.apiSecret,
|
|
@@ -1446,7 +1446,7 @@ class HollaExKit {
|
|
|
1446
1446
|
);
|
|
1447
1447
|
return createRequest(verb, `${this.apiUrl}${path}`, headers, { data });
|
|
1448
1448
|
}
|
|
1449
|
-
|
|
1449
|
+
|
|
1450
1450
|
/**
|
|
1451
1451
|
* Check exchange deposit status
|
|
1452
1452
|
* @param {number} userId - The identifier of the user
|
|
@@ -1473,19 +1473,19 @@ class HollaExKit {
|
|
|
1473
1473
|
if (isString(currency)) {
|
|
1474
1474
|
params += `¤cy=${currency}`;
|
|
1475
1475
|
}
|
|
1476
|
-
|
|
1476
|
+
|
|
1477
1477
|
if (isString(transactionId)) {
|
|
1478
1478
|
params += `&transaction_id=${transactionId}`;
|
|
1479
1479
|
}
|
|
1480
|
-
|
|
1480
|
+
|
|
1481
1481
|
if (isString(address)) {
|
|
1482
1482
|
params += `&address=${address}`;
|
|
1483
1483
|
}
|
|
1484
|
-
|
|
1484
|
+
|
|
1485
1485
|
if (isString(network)) {
|
|
1486
1486
|
params += `&network=${network}`;
|
|
1487
1487
|
}
|
|
1488
|
-
|
|
1488
|
+
|
|
1489
1489
|
if (isBoolean(opts.isTestnet)) {
|
|
1490
1490
|
params += `&is_testnet=${opts.isTestnet}`;
|
|
1491
1491
|
}
|
|
@@ -1501,7 +1501,7 @@ class HollaExKit {
|
|
|
1501
1501
|
);
|
|
1502
1502
|
return createRequest(verb, `${this.apiUrl}${path}`, headers);
|
|
1503
1503
|
}
|
|
1504
|
-
|
|
1504
|
+
|
|
1505
1505
|
/**
|
|
1506
1506
|
* Set exchange fees by admin
|
|
1507
1507
|
* @param {number} opts.userId - The identifier of the user
|
|
@@ -1514,11 +1514,11 @@ class HollaExKit {
|
|
|
1514
1514
|
) {
|
|
1515
1515
|
const verb = 'GET';
|
|
1516
1516
|
let path = `${this.baseUrl}/admin/fees/settle`;
|
|
1517
|
-
|
|
1517
|
+
|
|
1518
1518
|
if (isNumber(opts.userId)) {
|
|
1519
1519
|
path += `?user_id=${opts.userId}`;
|
|
1520
1520
|
}
|
|
1521
|
-
|
|
1521
|
+
|
|
1522
1522
|
const headers = generateHeaders(
|
|
1523
1523
|
this.headers,
|
|
1524
1524
|
this.apiSecret,
|
|
@@ -1528,7 +1528,7 @@ class HollaExKit {
|
|
|
1528
1528
|
);
|
|
1529
1529
|
return createRequest(verb, `${this.apiUrl}${path}`, headers);
|
|
1530
1530
|
}
|
|
1531
|
-
|
|
1531
|
+
|
|
1532
1532
|
/**
|
|
1533
1533
|
* Retrieve user's trades by admin
|
|
1534
1534
|
* @param {number} opts.userId - The identifier of the user
|
|
@@ -1559,45 +1559,45 @@ class HollaExKit {
|
|
|
1559
1559
|
const verb = 'GET';
|
|
1560
1560
|
let path = `${this.baseUrl}/admin/trades`;
|
|
1561
1561
|
let params = '?';
|
|
1562
|
-
|
|
1562
|
+
|
|
1563
1563
|
if (isNumber(opts.userId)) {
|
|
1564
1564
|
params += `&user_id=${opts.userId}`;
|
|
1565
1565
|
}
|
|
1566
|
-
|
|
1566
|
+
|
|
1567
1567
|
if (isNumber(opts.limit)) {
|
|
1568
1568
|
params += `&limit=${opts.limit}`;
|
|
1569
1569
|
}
|
|
1570
|
-
|
|
1570
|
+
|
|
1571
1571
|
if (isNumber(opts.page)) {
|
|
1572
1572
|
params += `&page=${opts.page}`;
|
|
1573
1573
|
}
|
|
1574
|
-
|
|
1574
|
+
|
|
1575
1575
|
if (isString(opts.symbol)) {
|
|
1576
1576
|
params += `&symbol=${opts.symbol}`;
|
|
1577
1577
|
}
|
|
1578
|
-
|
|
1578
|
+
|
|
1579
1579
|
if (isString(opts.orderBy)) {
|
|
1580
1580
|
params += `&order_by=${opts.orderBy}`;
|
|
1581
1581
|
}
|
|
1582
|
-
|
|
1582
|
+
|
|
1583
1583
|
if (isString(opts.order) && (opts.order === 'asc' || opts.order === 'desc')) {
|
|
1584
1584
|
params += `&order=${opts.order}`;
|
|
1585
1585
|
}
|
|
1586
|
-
|
|
1586
|
+
|
|
1587
1587
|
if (isDatetime(opts.startDate)) {
|
|
1588
1588
|
params += `&start_date=${sanitizeDate(opts.startDate)}`;
|
|
1589
1589
|
}
|
|
1590
|
-
|
|
1590
|
+
|
|
1591
1591
|
if (isDatetime(opts.endDate)) {
|
|
1592
1592
|
params += `&end_date=${sanitizeDate(opts.endDate)}`;
|
|
1593
1593
|
}
|
|
1594
|
-
|
|
1594
|
+
|
|
1595
1595
|
if (isString(opts.format) && ['csv', 'all'].includes(opts.format)) {
|
|
1596
1596
|
params += `&format=${opts.format}`;
|
|
1597
1597
|
}
|
|
1598
1598
|
|
|
1599
1599
|
if (params.length > 1) path += params;
|
|
1600
|
-
|
|
1600
|
+
|
|
1601
1601
|
const headers = generateHeaders(
|
|
1602
1602
|
this.headers,
|
|
1603
1603
|
this.apiSecret,
|
|
@@ -1642,47 +1642,47 @@ class HollaExKit {
|
|
|
1642
1642
|
const verb = 'GET';
|
|
1643
1643
|
let path = `${this.baseUrl}/admin/orders`;
|
|
1644
1644
|
let params = '?';
|
|
1645
|
-
|
|
1645
|
+
|
|
1646
1646
|
if (isNumber(opts.userId)) {
|
|
1647
1647
|
params += `&user_id=${opts.userId}`;
|
|
1648
1648
|
}
|
|
1649
|
-
|
|
1649
|
+
|
|
1650
1650
|
if (isString(opts.side) && (opts.side === 'buy' || opts.side === 'sell')) {
|
|
1651
1651
|
params += `&side=${opts.side}`;
|
|
1652
1652
|
}
|
|
1653
|
-
|
|
1653
|
+
|
|
1654
1654
|
if (isString(opts.status)) {
|
|
1655
1655
|
params += `&status=${opts.status}`;
|
|
1656
1656
|
}
|
|
1657
|
-
|
|
1657
|
+
|
|
1658
1658
|
if (isBoolean(opts.open)) {
|
|
1659
1659
|
params += `&open=${opts.open}`;
|
|
1660
1660
|
}
|
|
1661
|
-
|
|
1661
|
+
|
|
1662
1662
|
if (isNumber(opts.limit)) {
|
|
1663
1663
|
params += `&limit=${opts.limit}`;
|
|
1664
1664
|
}
|
|
1665
|
-
|
|
1665
|
+
|
|
1666
1666
|
if (isNumber(opts.page)) {
|
|
1667
1667
|
params += `&page=${opts.page}`;
|
|
1668
1668
|
}
|
|
1669
|
-
|
|
1669
|
+
|
|
1670
1670
|
if (isString(opts.symbol)) {
|
|
1671
1671
|
params += `&symbol=${opts.symbol}`;
|
|
1672
1672
|
}
|
|
1673
|
-
|
|
1673
|
+
|
|
1674
1674
|
if (isString(opts.orderBy)) {
|
|
1675
1675
|
params += `&order_by=${opts.orderBy}`;
|
|
1676
1676
|
}
|
|
1677
|
-
|
|
1677
|
+
|
|
1678
1678
|
if (isString(opts.order) && (opts.order === 'asc' || opts.order === 'desc')) {
|
|
1679
1679
|
params += `&order=${opts.order}`;
|
|
1680
1680
|
}
|
|
1681
|
-
|
|
1681
|
+
|
|
1682
1682
|
if (isDatetime(opts.startDate)) {
|
|
1683
1683
|
params += `&start_date=${sanitizeDate(opts.startDate)}`;
|
|
1684
1684
|
}
|
|
1685
|
-
|
|
1685
|
+
|
|
1686
1686
|
if (isDatetime(opts.endDate)) {
|
|
1687
1687
|
params += `&end_date=${sanitizeDate(opts.endDate)}`;
|
|
1688
1688
|
}
|
|
@@ -1698,7 +1698,7 @@ class HollaExKit {
|
|
|
1698
1698
|
);
|
|
1699
1699
|
return createRequest(verb, `${this.apiUrl}${path}`, headers);
|
|
1700
1700
|
}
|
|
1701
|
-
|
|
1701
|
+
|
|
1702
1702
|
/**
|
|
1703
1703
|
* Cancel user's order by order id
|
|
1704
1704
|
* @param {number} userId - The identifier of the user
|
|
@@ -1709,11 +1709,11 @@ class HollaExKit {
|
|
|
1709
1709
|
const verb = 'DELETE';
|
|
1710
1710
|
let path = `${this.baseUrl}/admin/order`;
|
|
1711
1711
|
let params = '?';
|
|
1712
|
-
|
|
1712
|
+
|
|
1713
1713
|
if (isString(orderId)) {
|
|
1714
1714
|
params += `&order_id=${orderId}`;
|
|
1715
1715
|
}
|
|
1716
|
-
|
|
1716
|
+
|
|
1717
1717
|
if (isNumber(userId)) {
|
|
1718
1718
|
params += `&user_id=${userId}`;
|
|
1719
1719
|
}
|
|
@@ -1732,10 +1732,14 @@ class HollaExKit {
|
|
|
1732
1732
|
/**
|
|
1733
1733
|
* Retrieve list of the user info by admin
|
|
1734
1734
|
* @param {object} opts - Optional parameters
|
|
1735
|
+
* @param {number} opts.id - The identifier of the user to filter by
|
|
1735
1736
|
* @param {number} opts.userId - The identifier of the user to filter by
|
|
1736
1737
|
* @param {string} opts.search - The search text to filter by, pass undefined to receive data on all fields
|
|
1737
1738
|
* @param {boolean} opts.pending - The pending field to filter by, pass undefined to receive all data
|
|
1738
1739
|
* @param {string} opts.pendingType - Th pending type info to filter by, pass undefined to receive data
|
|
1740
|
+
* @param {string} opts.bank_key - bank query key to fetch specific bank
|
|
1741
|
+
* @param {string} opts.bank_value - bank query value to fetch specific bank
|
|
1742
|
+
* @param {boolean} opts.activated - bank activated query
|
|
1739
1743
|
* @param {number} opts.limit - Amount of users per page. Maximum: 50. Default: 50
|
|
1740
1744
|
* @param {number} opts.page - Page of user data. Default: 1
|
|
1741
1745
|
* @param {string} opts.orderBy - The field to order data by e.g. amount, id.
|
|
@@ -1747,6 +1751,7 @@ class HollaExKit {
|
|
|
1747
1751
|
*/
|
|
1748
1752
|
getExchangeUsers(
|
|
1749
1753
|
opts = {
|
|
1754
|
+
id: null,
|
|
1750
1755
|
userId: null,
|
|
1751
1756
|
search: null,
|
|
1752
1757
|
type: null,
|
|
@@ -1756,6 +1761,9 @@ class HollaExKit {
|
|
|
1756
1761
|
page: null,
|
|
1757
1762
|
orderBy: null,
|
|
1758
1763
|
order: null,
|
|
1764
|
+
bank_key: null,
|
|
1765
|
+
bank_value: null,
|
|
1766
|
+
activated: null,
|
|
1759
1767
|
startDate: null,
|
|
1760
1768
|
endDate: null,
|
|
1761
1769
|
format: null
|
|
@@ -1764,56 +1772,66 @@ class HollaExKit {
|
|
|
1764
1772
|
const verb = 'GET';
|
|
1765
1773
|
let path = `${this.baseUrl}/admin/users`;
|
|
1766
1774
|
let params = '?';
|
|
1767
|
-
|
|
1775
|
+
|
|
1776
|
+
if (isNumber(opts.id)) {
|
|
1777
|
+
params += `&id=${opts.id}`;
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1768
1780
|
if (isNumber(opts.userId)) {
|
|
1769
1781
|
params += `&id=${opts.userId}`;
|
|
1770
1782
|
}
|
|
1771
|
-
|
|
1783
|
+
|
|
1772
1784
|
if (isString(opts.search)) {
|
|
1773
1785
|
params += `&search=${opts.search}`;
|
|
1774
1786
|
}
|
|
1775
|
-
|
|
1787
|
+
|
|
1776
1788
|
if (isString(opts.type)) {
|
|
1777
1789
|
params += `&type=${opts.type}`;
|
|
1778
1790
|
}
|
|
1779
|
-
|
|
1791
|
+
|
|
1780
1792
|
if (isBoolean(opts.pending)) {
|
|
1781
1793
|
params += `&pending=${opts.pending}`;
|
|
1782
1794
|
}
|
|
1783
|
-
|
|
1784
|
-
if (isString(opts.pendingType) && (opts.pendingType === 'id' ||opts.pendingType === 'bank')) {
|
|
1795
|
+
|
|
1796
|
+
if (isString(opts.pendingType) && (opts.pendingType === 'id' || opts.pendingType === 'bank')) {
|
|
1785
1797
|
params += `&pending_type=${opts.pendingType}`;
|
|
1786
1798
|
}
|
|
1787
|
-
|
|
1799
|
+
|
|
1800
|
+
if (isString(opts.bank_key) && isString(opts.bank_value)) {
|
|
1801
|
+
params += `&${opts.bank_key}=${opts.bank_value}`;
|
|
1802
|
+
}
|
|
1803
|
+
if (isBoolean(opts.activated)) {
|
|
1804
|
+
params += `&activated=${opts.activated}`;
|
|
1805
|
+
}
|
|
1788
1806
|
if (isNumber(opts.limit)) {
|
|
1789
1807
|
params += `&limit=${opts.limit}`;
|
|
1790
1808
|
}
|
|
1791
|
-
|
|
1809
|
+
|
|
1792
1810
|
if (isNumber(opts.page)) {
|
|
1793
1811
|
params += `&page=${opts.page}`;
|
|
1794
1812
|
}
|
|
1795
|
-
|
|
1813
|
+
|
|
1796
1814
|
if (isString(opts.orderBy)) {
|
|
1797
1815
|
params += `&order_by=${opts.orderBy}`;
|
|
1798
1816
|
}
|
|
1799
|
-
|
|
1817
|
+
|
|
1800
1818
|
if (isString(opts.order) && (opts.order === 'asc' || opts.order === 'desc')) {
|
|
1801
1819
|
params += `&order=${opts.order}`;
|
|
1802
1820
|
}
|
|
1803
|
-
|
|
1821
|
+
|
|
1804
1822
|
if (isDatetime(opts.startDate)) {
|
|
1805
1823
|
params += `&start_date=${sanitizeDate(opts.startDate)}`;
|
|
1806
1824
|
}
|
|
1807
|
-
|
|
1825
|
+
|
|
1808
1826
|
if (isDatetime(opts.endDate)) {
|
|
1809
1827
|
params += `&end_date=${sanitizeDate(opts.endDate)}`;
|
|
1810
1828
|
}
|
|
1811
|
-
|
|
1829
|
+
|
|
1812
1830
|
if (isString(opts.format) && ['csv', 'all'].includes(opts.format)) {
|
|
1813
1831
|
params += `&format=${opts.format}`;
|
|
1814
1832
|
}
|
|
1815
1833
|
if (params.length > 1) path += params;
|
|
1816
|
-
|
|
1834
|
+
|
|
1817
1835
|
const headers = generateHeaders(
|
|
1818
1836
|
this.headers,
|
|
1819
1837
|
this.apiSecret,
|
|
@@ -1823,7 +1841,7 @@ class HollaExKit {
|
|
|
1823
1841
|
);
|
|
1824
1842
|
return createRequest(verb, `${this.apiUrl}${path}`, headers);
|
|
1825
1843
|
}
|
|
1826
|
-
|
|
1844
|
+
|
|
1827
1845
|
/**
|
|
1828
1846
|
* Create exchange user
|
|
1829
1847
|
* @param {string} email - The mail address for the user
|
|
@@ -1840,12 +1858,12 @@ class HollaExKit {
|
|
|
1840
1858
|
email,
|
|
1841
1859
|
password
|
|
1842
1860
|
};
|
|
1843
|
-
|
|
1844
|
-
|
|
1861
|
+
|
|
1862
|
+
|
|
1845
1863
|
if (isString(opts.referral)) {
|
|
1846
1864
|
data.referral = opts.referral;
|
|
1847
1865
|
};
|
|
1848
|
-
|
|
1866
|
+
|
|
1849
1867
|
const headers = generateHeaders(
|
|
1850
1868
|
this.headers,
|
|
1851
1869
|
this.apiSecret,
|
|
@@ -1856,7 +1874,7 @@ class HollaExKit {
|
|
|
1856
1874
|
);
|
|
1857
1875
|
return createRequest(verb, `${this.apiUrl}${path}`, headers, { data });
|
|
1858
1876
|
}
|
|
1859
|
-
|
|
1877
|
+
|
|
1860
1878
|
/**
|
|
1861
1879
|
* Update exchange user
|
|
1862
1880
|
* @param {number} userId - The identifier of the user to filter by
|
|
@@ -1877,11 +1895,11 @@ class HollaExKit {
|
|
|
1877
1895
|
note: null,
|
|
1878
1896
|
verification_level: null
|
|
1879
1897
|
},
|
|
1880
|
-
|
|
1898
|
+
|
|
1881
1899
|
) {
|
|
1882
|
-
if (isString(opts.role)
|
|
1900
|
+
if (isString(opts.role)
|
|
1883
1901
|
&& ['admin', 'supervisor', 'support', 'kyc', 'communicator', 'user'].includes(opts.role)) {
|
|
1884
|
-
|
|
1902
|
+
|
|
1885
1903
|
const verb = 'PUT';
|
|
1886
1904
|
let path = `${this.baseUrl}/admin/user/role`;
|
|
1887
1905
|
|
|
@@ -1891,7 +1909,7 @@ class HollaExKit {
|
|
|
1891
1909
|
const data = {
|
|
1892
1910
|
role: opts.role
|
|
1893
1911
|
};
|
|
1894
|
-
|
|
1912
|
+
|
|
1895
1913
|
const headers = generateHeaders(
|
|
1896
1914
|
this.headers,
|
|
1897
1915
|
this.apiSecret,
|
|
@@ -1902,20 +1920,20 @@ class HollaExKit {
|
|
|
1902
1920
|
);
|
|
1903
1921
|
return createRequest(verb, `${this.apiUrl}${path}`, headers, { data });
|
|
1904
1922
|
}
|
|
1905
|
-
|
|
1906
|
-
if(isObject(opts.meta)){
|
|
1923
|
+
|
|
1924
|
+
if (isObject(opts.meta)) {
|
|
1907
1925
|
const verb = 'PUT';
|
|
1908
1926
|
let path = `${this.baseUrl}/admin/user/meta`;
|
|
1909
|
-
|
|
1927
|
+
|
|
1910
1928
|
if (isNumber(userId)) {
|
|
1911
1929
|
path += `?user_id=${userId}`;
|
|
1912
1930
|
}
|
|
1913
|
-
|
|
1931
|
+
|
|
1914
1932
|
const data = {
|
|
1915
1933
|
meta: opts.meta,
|
|
1916
1934
|
...(isBoolean(opts.overwrite) && { overwrite: opts.overwrite }),
|
|
1917
1935
|
};
|
|
1918
|
-
|
|
1936
|
+
|
|
1919
1937
|
const headers = generateHeaders(
|
|
1920
1938
|
this.headers,
|
|
1921
1939
|
this.apiSecret,
|
|
@@ -1926,19 +1944,19 @@ class HollaExKit {
|
|
|
1926
1944
|
);
|
|
1927
1945
|
return createRequest(verb, `${this.apiUrl}${path}`, headers, { data });
|
|
1928
1946
|
}
|
|
1929
|
-
|
|
1930
|
-
if(isNumber(opts.discount) && opts.discount <= 100 && opts.discount >= 0){
|
|
1947
|
+
|
|
1948
|
+
if (isNumber(opts.discount) && opts.discount <= 100 && opts.discount >= 0) {
|
|
1931
1949
|
const verb = 'PUT';
|
|
1932
1950
|
let path = `${this.baseUrl}/admin/user/discount`;
|
|
1933
|
-
|
|
1951
|
+
|
|
1934
1952
|
if (isNumber(userId)) {
|
|
1935
1953
|
path += `?user_id=${userId}`;
|
|
1936
1954
|
}
|
|
1937
|
-
|
|
1955
|
+
|
|
1938
1956
|
const data = {
|
|
1939
1957
|
discount: opts.discount
|
|
1940
1958
|
};
|
|
1941
|
-
|
|
1959
|
+
|
|
1942
1960
|
const headers = generateHeaders(
|
|
1943
1961
|
this.headers,
|
|
1944
1962
|
this.apiSecret,
|
|
@@ -1949,19 +1967,19 @@ class HollaExKit {
|
|
|
1949
1967
|
);
|
|
1950
1968
|
return createRequest(verb, `${this.apiUrl}${path}`, headers, { data });
|
|
1951
1969
|
}
|
|
1952
|
-
|
|
1953
|
-
if(isString(opts.note)){
|
|
1970
|
+
|
|
1971
|
+
if (isString(opts.note)) {
|
|
1954
1972
|
const verb = 'PUT';
|
|
1955
1973
|
let path = `${this.baseUrl}/admin/user/note`;
|
|
1956
|
-
|
|
1974
|
+
|
|
1957
1975
|
if (isNumber(userId)) {
|
|
1958
1976
|
path += `?user_id=${userId}`;
|
|
1959
1977
|
}
|
|
1960
|
-
|
|
1978
|
+
|
|
1961
1979
|
const data = {
|
|
1962
1980
|
note: opts.note
|
|
1963
1981
|
};
|
|
1964
|
-
|
|
1982
|
+
|
|
1965
1983
|
const headers = generateHeaders(
|
|
1966
1984
|
this.headers,
|
|
1967
1985
|
this.apiSecret,
|
|
@@ -1972,16 +1990,16 @@ class HollaExKit {
|
|
|
1972
1990
|
);
|
|
1973
1991
|
return createRequest(verb, `${this.apiUrl}${path}`, headers, { data });
|
|
1974
1992
|
}
|
|
1975
|
-
|
|
1976
|
-
if(isNumber(opts.verification_level)){
|
|
1993
|
+
|
|
1994
|
+
if (isNumber(opts.verification_level)) {
|
|
1977
1995
|
const verb = 'POST';
|
|
1978
1996
|
let path = `${this.baseUrl}/admin/upgrade-user`;
|
|
1979
|
-
|
|
1997
|
+
|
|
1980
1998
|
const data = {
|
|
1981
1999
|
user_id: userId,
|
|
1982
2000
|
verification_level: opts.verification_level
|
|
1983
2001
|
};
|
|
1984
|
-
|
|
2002
|
+
|
|
1985
2003
|
const headers = generateHeaders(
|
|
1986
2004
|
this.headers,
|
|
1987
2005
|
this.apiSecret,
|
|
@@ -1992,7 +2010,7 @@ class HollaExKit {
|
|
|
1992
2010
|
);
|
|
1993
2011
|
return createRequest(verb, `${this.apiUrl}${path}`, headers, { data });
|
|
1994
2012
|
}
|
|
1995
|
-
|
|
2013
|
+
|
|
1996
2014
|
}
|
|
1997
2015
|
|
|
1998
2016
|
/**
|
|
@@ -2006,7 +2024,7 @@ class HollaExKit {
|
|
|
2006
2024
|
const data = {
|
|
2007
2025
|
user_id
|
|
2008
2026
|
};
|
|
2009
|
-
|
|
2027
|
+
|
|
2010
2028
|
const headers = generateHeaders(
|
|
2011
2029
|
this.headers,
|
|
2012
2030
|
this.apiSecret,
|
|
@@ -2017,8 +2035,8 @@ class HollaExKit {
|
|
|
2017
2035
|
);
|
|
2018
2036
|
return createRequest(verb, `${this.apiUrl}${path}`, headers, { data });
|
|
2019
2037
|
}
|
|
2020
|
-
|
|
2021
|
-
|
|
2038
|
+
|
|
2039
|
+
|
|
2022
2040
|
/**
|
|
2023
2041
|
* Create wallet for exchange user
|
|
2024
2042
|
* @param {number} userId - The identifier of the user
|
|
@@ -2029,7 +2047,7 @@ class HollaExKit {
|
|
|
2029
2047
|
createExchangeUserWallet(
|
|
2030
2048
|
userId,
|
|
2031
2049
|
crypto,
|
|
2032
|
-
opts= {
|
|
2050
|
+
opts = {
|
|
2033
2051
|
network: null
|
|
2034
2052
|
}
|
|
2035
2053
|
) {
|
|
@@ -2039,11 +2057,11 @@ class HollaExKit {
|
|
|
2039
2057
|
user_id: userId,
|
|
2040
2058
|
crypto
|
|
2041
2059
|
};
|
|
2042
|
-
|
|
2060
|
+
|
|
2043
2061
|
if (isString(opts.network)) {
|
|
2044
2062
|
data.network = opts.network;
|
|
2045
2063
|
}
|
|
2046
|
-
|
|
2064
|
+
|
|
2047
2065
|
const headers = generateHeaders(
|
|
2048
2066
|
this.headers,
|
|
2049
2067
|
this.apiSecret,
|
|
@@ -2096,11 +2114,11 @@ class HollaExKit {
|
|
|
2096
2114
|
if (isNumber(opts.userId)) {
|
|
2097
2115
|
params += `&user_id=${opts.userId}`;
|
|
2098
2116
|
}
|
|
2099
|
-
|
|
2117
|
+
|
|
2100
2118
|
if (isString(opts.currency)) {
|
|
2101
2119
|
params += `¤cy=${opts.currency}`;
|
|
2102
2120
|
}
|
|
2103
|
-
|
|
2121
|
+
|
|
2104
2122
|
if (isString(opts.address)) {
|
|
2105
2123
|
params += `&address=${opts.address}`;
|
|
2106
2124
|
}
|
|
@@ -2112,23 +2130,23 @@ class HollaExKit {
|
|
|
2112
2130
|
if (isBoolean(opts.isValid)) {
|
|
2113
2131
|
params += `&is_valid=${opts.isValid}`;
|
|
2114
2132
|
}
|
|
2115
|
-
|
|
2133
|
+
|
|
2116
2134
|
if (isNumber(opts.limit)) {
|
|
2117
2135
|
params += `&limit=${opts.limit}`;
|
|
2118
2136
|
}
|
|
2119
|
-
|
|
2137
|
+
|
|
2120
2138
|
if (isNumber(opts.page)) {
|
|
2121
2139
|
params += `&page=${opts.page}`;
|
|
2122
2140
|
}
|
|
2123
|
-
|
|
2141
|
+
|
|
2124
2142
|
if (isString(opts.orderBy)) {
|
|
2125
2143
|
params += `&order_by=${opts.orderBy}`;
|
|
2126
2144
|
}
|
|
2127
|
-
|
|
2145
|
+
|
|
2128
2146
|
if (isString(opts.order) && (opts.order === 'asc' || opts.order === 'desc')) {
|
|
2129
2147
|
params += `&order=${opts.order}`;
|
|
2130
2148
|
}
|
|
2131
|
-
|
|
2149
|
+
|
|
2132
2150
|
if (isDatetime(opts.startDate)) {
|
|
2133
2151
|
params += `&start_date=${sanitizeDate(opts.startDate)}`;
|
|
2134
2152
|
}
|
|
@@ -2136,13 +2154,13 @@ class HollaExKit {
|
|
|
2136
2154
|
if (isDatetime(opts.endDate)) {
|
|
2137
2155
|
params += `&end_date=${sanitizeDate(opts.endDate)}`;
|
|
2138
2156
|
}
|
|
2139
|
-
|
|
2157
|
+
|
|
2140
2158
|
if (isString(opts.format) && ['csv', 'all'].includes(opts.format)) {
|
|
2141
2159
|
params += `&format=${opts.format}`;
|
|
2142
2160
|
}
|
|
2143
2161
|
|
|
2144
2162
|
if (params.length > 1) path += params;
|
|
2145
|
-
|
|
2163
|
+
|
|
2146
2164
|
const headers = generateHeaders(
|
|
2147
2165
|
this.headers,
|
|
2148
2166
|
this.apiSecret,
|
|
@@ -2152,7 +2170,7 @@ class HollaExKit {
|
|
|
2152
2170
|
);
|
|
2153
2171
|
return createRequest(verb, `${this.apiUrl}${path}`, headers);
|
|
2154
2172
|
}
|
|
2155
|
-
|
|
2173
|
+
|
|
2156
2174
|
/**
|
|
2157
2175
|
* Retrieve user's login info by admin
|
|
2158
2176
|
* @param {number} userId - The identifier of the user
|
|
@@ -2161,7 +2179,7 @@ class HollaExKit {
|
|
|
2161
2179
|
getExchangeUserBalance(userId) {
|
|
2162
2180
|
const verb = 'GET';
|
|
2163
2181
|
let path = `${this.baseUrl}/admin/user/balance?user_id=${userId}`;
|
|
2164
|
-
|
|
2182
|
+
|
|
2165
2183
|
const headers = generateHeaders(
|
|
2166
2184
|
this.headers,
|
|
2167
2185
|
this.apiSecret,
|
|
@@ -2171,7 +2189,7 @@ class HollaExKit {
|
|
|
2171
2189
|
);
|
|
2172
2190
|
return createRequest(verb, `${this.apiUrl}${path}`, headers);
|
|
2173
2191
|
}
|
|
2174
|
-
|
|
2192
|
+
|
|
2175
2193
|
/**
|
|
2176
2194
|
* Create bank account for user by admin
|
|
2177
2195
|
* @param {number} userId - The identifier of the user
|
|
@@ -2181,15 +2199,15 @@ class HollaExKit {
|
|
|
2181
2199
|
createExchangeUserBank(userId, bankAccount) {
|
|
2182
2200
|
const verb = 'POST';
|
|
2183
2201
|
let path = `${this.baseUrl}/admin/user/bank`;
|
|
2184
|
-
|
|
2202
|
+
|
|
2185
2203
|
if (isNumber(userId)) {
|
|
2186
2204
|
path += `?id=${userId}`;
|
|
2187
2205
|
}
|
|
2188
|
-
|
|
2206
|
+
|
|
2189
2207
|
const data = {
|
|
2190
2208
|
bank_account: bankAccount
|
|
2191
2209
|
};
|
|
2192
|
-
|
|
2210
|
+
|
|
2193
2211
|
const headers = generateHeaders(
|
|
2194
2212
|
this.headers,
|
|
2195
2213
|
this.apiSecret,
|
|
@@ -2199,9 +2217,9 @@ class HollaExKit {
|
|
|
2199
2217
|
data
|
|
2200
2218
|
);
|
|
2201
2219
|
return createRequest(verb, `${this.apiUrl}${path}`, headers, { data });
|
|
2202
|
-
|
|
2220
|
+
|
|
2203
2221
|
}
|
|
2204
|
-
|
|
2222
|
+
|
|
2205
2223
|
/**
|
|
2206
2224
|
* Retrieve user's login info by admin
|
|
2207
2225
|
* @param {number} opts.userId - The identifier of the user
|
|
@@ -2228,39 +2246,39 @@ class HollaExKit {
|
|
|
2228
2246
|
const verb = 'GET';
|
|
2229
2247
|
let path = `${this.baseUrl}/admin/logins`;
|
|
2230
2248
|
let params = '?';
|
|
2231
|
-
|
|
2249
|
+
|
|
2232
2250
|
if (isNumber(opts.userId)) {
|
|
2233
2251
|
params += `&user_id=${opts.userId}`;
|
|
2234
2252
|
}
|
|
2235
|
-
|
|
2253
|
+
|
|
2236
2254
|
if (isNumber(opts.limit)) {
|
|
2237
2255
|
params += `&limit=${opts.limit}`;
|
|
2238
2256
|
}
|
|
2239
|
-
|
|
2257
|
+
|
|
2240
2258
|
if (isNumber(opts.page)) {
|
|
2241
2259
|
params += `&page=${opts.page}`;
|
|
2242
2260
|
}
|
|
2243
|
-
|
|
2261
|
+
|
|
2244
2262
|
if (isString(opts.orderBy)) {
|
|
2245
2263
|
params += `&order_by=${opts.orderBy}`;
|
|
2246
2264
|
}
|
|
2247
|
-
|
|
2265
|
+
|
|
2248
2266
|
if (isString(opts.order) && (opts.order === 'asc' || opts.order === 'desc')) {
|
|
2249
2267
|
params += `&order=${opts.order}`;
|
|
2250
2268
|
}
|
|
2251
|
-
|
|
2269
|
+
|
|
2252
2270
|
if (isDatetime(opts.startDate)) {
|
|
2253
2271
|
params += `&start_date=${sanitizeDate(opts.startDate)}`;
|
|
2254
2272
|
}
|
|
2255
|
-
|
|
2273
|
+
|
|
2256
2274
|
if (isDatetime(opts.endDate)) {
|
|
2257
2275
|
params += `&end_date=${sanitizeDate(opts.endDate)}`;
|
|
2258
2276
|
}
|
|
2259
|
-
|
|
2277
|
+
|
|
2260
2278
|
if (isString(opts.format) && ['csv', 'all'].includes(opts.format)) {
|
|
2261
2279
|
params += `&format=${opts.format}`;
|
|
2262
2280
|
}
|
|
2263
|
-
|
|
2281
|
+
|
|
2264
2282
|
if (params.length > 1) path += params;
|
|
2265
2283
|
|
|
2266
2284
|
const headers = generateHeaders(
|
|
@@ -2272,7 +2290,7 @@ class HollaExKit {
|
|
|
2272
2290
|
);
|
|
2273
2291
|
return createRequest(verb, `${this.apiUrl}${path}`, headers);
|
|
2274
2292
|
}
|
|
2275
|
-
|
|
2293
|
+
|
|
2276
2294
|
/**
|
|
2277
2295
|
* Deactivate exchange user account by admin
|
|
2278
2296
|
* @param {number} userId - The identifier of the user to deactivate their exchange account
|
|
@@ -2285,7 +2303,7 @@ class HollaExKit {
|
|
|
2285
2303
|
user_id: userId,
|
|
2286
2304
|
activated: false
|
|
2287
2305
|
};
|
|
2288
|
-
|
|
2306
|
+
|
|
2289
2307
|
const headers = generateHeaders(
|
|
2290
2308
|
this.headers,
|
|
2291
2309
|
this.apiSecret,
|
|
@@ -2296,7 +2314,7 @@ class HollaExKit {
|
|
|
2296
2314
|
);
|
|
2297
2315
|
return createRequest(verb, `${this.apiUrl}${path}`, headers, { data });
|
|
2298
2316
|
}
|
|
2299
|
-
|
|
2317
|
+
|
|
2300
2318
|
/**
|
|
2301
2319
|
* Deactivate user otp by admin
|
|
2302
2320
|
* @param {number} userId - The identifier of the user to deactivate their otp
|
|
@@ -2308,7 +2326,7 @@ class HollaExKit {
|
|
|
2308
2326
|
const data = {
|
|
2309
2327
|
user_id: userId
|
|
2310
2328
|
};
|
|
2311
|
-
|
|
2329
|
+
|
|
2312
2330
|
const headers = generateHeaders(
|
|
2313
2331
|
this.headers,
|
|
2314
2332
|
this.apiSecret,
|
|
@@ -2319,7 +2337,7 @@ class HollaExKit {
|
|
|
2319
2337
|
);
|
|
2320
2338
|
return createRequest(verb, `${this.apiUrl}${path}`, headers, { data });
|
|
2321
2339
|
}
|
|
2322
|
-
|
|
2340
|
+
|
|
2323
2341
|
/**
|
|
2324
2342
|
* Retrieve user's referrals info by admin
|
|
2325
2343
|
* @param {number} userId - The identifier of the user to filter by
|
|
@@ -2345,38 +2363,38 @@ class HollaExKit {
|
|
|
2345
2363
|
const verb = 'GET';
|
|
2346
2364
|
let path = `${this.baseUrl}/admin/user/affiliation`;
|
|
2347
2365
|
let params = '?';
|
|
2348
|
-
|
|
2366
|
+
|
|
2349
2367
|
if (isNumber(userId)) {
|
|
2350
2368
|
params += `&user_id=${userId}`;
|
|
2351
2369
|
}
|
|
2352
|
-
|
|
2370
|
+
|
|
2353
2371
|
if (isNumber(opts.limit)) {
|
|
2354
2372
|
params += `&limit=${opts.limit}`;
|
|
2355
2373
|
}
|
|
2356
|
-
|
|
2374
|
+
|
|
2357
2375
|
if (isNumber(opts.page)) {
|
|
2358
2376
|
params += `&page=${opts.page}`;
|
|
2359
2377
|
}
|
|
2360
|
-
|
|
2378
|
+
|
|
2361
2379
|
if (isString(opts.orderBy)) {
|
|
2362
2380
|
params += `&order_by=${opts.orderBy}`;
|
|
2363
2381
|
}
|
|
2364
|
-
|
|
2382
|
+
|
|
2365
2383
|
if (isString(opts.order) && (opts.order === 'asc' || opts.order === 'desc')) {
|
|
2366
2384
|
params += `&order=${opts.order}`;
|
|
2367
2385
|
}
|
|
2368
|
-
|
|
2386
|
+
|
|
2369
2387
|
if (isDatetime(opts.startDate)) {
|
|
2370
2388
|
params += `&start_date=${sanitizeDate(opts.startDate)}`;
|
|
2371
2389
|
}
|
|
2372
|
-
|
|
2390
|
+
|
|
2373
2391
|
if (isDatetime(opts.endDate)) {
|
|
2374
2392
|
params += `&end_date=${sanitizeDate(opts.endDate)}`;
|
|
2375
2393
|
}
|
|
2376
2394
|
|
|
2377
2395
|
if (params.length > 1) path += params;
|
|
2378
|
-
|
|
2379
|
-
|
|
2396
|
+
|
|
2397
|
+
|
|
2380
2398
|
const headers = generateHeaders(
|
|
2381
2399
|
this.headers,
|
|
2382
2400
|
this.apiSecret,
|
|
@@ -2420,7 +2438,7 @@ class HollaExKit {
|
|
|
2420
2438
|
mail_type: mailType,
|
|
2421
2439
|
data: content
|
|
2422
2440
|
};
|
|
2423
|
-
|
|
2441
|
+
|
|
2424
2442
|
const headers = generateHeaders(
|
|
2425
2443
|
this.headers,
|
|
2426
2444
|
this.apiSecret,
|
|
@@ -2451,14 +2469,14 @@ class HollaExKit {
|
|
|
2451
2469
|
html,
|
|
2452
2470
|
};
|
|
2453
2471
|
|
|
2454
|
-
if(isString(opts.title)) {
|
|
2472
|
+
if (isString(opts.title)) {
|
|
2455
2473
|
data.title = opts.title;
|
|
2456
2474
|
}
|
|
2457
|
-
|
|
2458
|
-
if(isString(opts.text)) {
|
|
2475
|
+
|
|
2476
|
+
if (isString(opts.text)) {
|
|
2459
2477
|
data.text = opts.text;
|
|
2460
2478
|
}
|
|
2461
|
-
|
|
2479
|
+
|
|
2462
2480
|
const headers = generateHeaders(
|
|
2463
2481
|
this.headers,
|
|
2464
2482
|
this.apiSecret,
|
|
@@ -2469,7 +2487,7 @@ class HollaExKit {
|
|
|
2469
2487
|
);
|
|
2470
2488
|
return createRequest(verb, `${this.apiUrl}${path}`, headers, { data });
|
|
2471
2489
|
}
|
|
2472
|
-
|
|
2490
|
+
|
|
2473
2491
|
/**
|
|
2474
2492
|
* Retrieve user's balances by admin
|
|
2475
2493
|
* @param {number} opts.userId - The identifier of the user to filter by
|
|
@@ -2486,20 +2504,20 @@ class HollaExKit {
|
|
|
2486
2504
|
) {
|
|
2487
2505
|
const verb = 'GET';
|
|
2488
2506
|
let path = `${this.baseUrl}/admin/balances?`;
|
|
2489
|
-
|
|
2490
|
-
|
|
2507
|
+
|
|
2508
|
+
|
|
2491
2509
|
if (isNumber(opts.userId)) {
|
|
2492
2510
|
path += `&user_id=${opts.userId}`;
|
|
2493
2511
|
}
|
|
2494
|
-
|
|
2512
|
+
|
|
2495
2513
|
if (isString(opts.currency)) {
|
|
2496
2514
|
path += `¤cy=${opts.currency}`;
|
|
2497
2515
|
}
|
|
2498
|
-
|
|
2516
|
+
|
|
2499
2517
|
if (isString(opts.format) && ['csv', 'all'].includes(opts.format)) {
|
|
2500
2518
|
path += `&format=${opts.format}`;
|
|
2501
2519
|
}
|
|
2502
|
-
|
|
2520
|
+
|
|
2503
2521
|
const headers = generateHeaders(
|
|
2504
2522
|
this.headers,
|
|
2505
2523
|
this.apiSecret,
|
|
@@ -2538,7 +2556,7 @@ class HollaExKit {
|
|
|
2538
2556
|
price,
|
|
2539
2557
|
symbol
|
|
2540
2558
|
};
|
|
2541
|
-
|
|
2559
|
+
|
|
2542
2560
|
const headers = generateHeaders(
|
|
2543
2561
|
this.headers,
|
|
2544
2562
|
this.apiSecret,
|
|
@@ -2549,7 +2567,7 @@ class HollaExKit {
|
|
|
2549
2567
|
);
|
|
2550
2568
|
return createRequest(verb, `${this.apiUrl}${path}`, headers, { data });
|
|
2551
2569
|
}
|
|
2552
|
-
|
|
2570
|
+
|
|
2553
2571
|
/**
|
|
2554
2572
|
* Create trade on behalf of users
|
|
2555
2573
|
* @param {number} maker_id - User id for the maker
|
|
@@ -2584,7 +2602,7 @@ class HollaExKit {
|
|
|
2584
2602
|
price,
|
|
2585
2603
|
side,
|
|
2586
2604
|
};
|
|
2587
|
-
|
|
2605
|
+
|
|
2588
2606
|
const headers = generateHeaders(
|
|
2589
2607
|
this.headers,
|
|
2590
2608
|
this.apiSecret,
|
|
@@ -2621,8 +2639,8 @@ class HollaExKit {
|
|
|
2621
2639
|
amount,
|
|
2622
2640
|
currency
|
|
2623
2641
|
};
|
|
2624
|
-
|
|
2625
|
-
if(isString(opts.network)) {
|
|
2642
|
+
|
|
2643
|
+
if (isString(opts.network)) {
|
|
2626
2644
|
data.network = opts.network;
|
|
2627
2645
|
}
|
|
2628
2646
|
|
|
@@ -2637,6 +2655,431 @@ class HollaExKit {
|
|
|
2637
2655
|
return createRequest(verb, `${this.apiUrl}${path}`, headers, { data });
|
|
2638
2656
|
}
|
|
2639
2657
|
|
|
2658
|
+
|
|
2659
|
+
/**
|
|
2660
|
+
* Get exchange stakes for admin
|
|
2661
|
+
* @param {object} opts - Optional parameters
|
|
2662
|
+
* @param {number} opts.limit - Number of elements to return. Default: 50. Maximum: 100
|
|
2663
|
+
* @param {number} opts.page - Page of data to retrieve
|
|
2664
|
+
* @param {string} opts.order_by - Field to order data
|
|
2665
|
+
* @param {string} opts.order - Direction to order (asc/desc)
|
|
2666
|
+
* @param {string} opts.start_date - Starting date of queried data in ISO8601 format
|
|
2667
|
+
* @param {string} opts.end_date - Ending date of queried data in ISO8601 format
|
|
2668
|
+
* @param {string} opts.format - Specify data format (csv/all)
|
|
2669
|
+
* @return {object} A JSON object with stakes data
|
|
2670
|
+
*/
|
|
2671
|
+
getExchangeStakesByAdmin(
|
|
2672
|
+
opts = {
|
|
2673
|
+
limit: null,
|
|
2674
|
+
page: null,
|
|
2675
|
+
order_by: null,
|
|
2676
|
+
order: null,
|
|
2677
|
+
start_date: null,
|
|
2678
|
+
end_date: null,
|
|
2679
|
+
format: null
|
|
2680
|
+
}
|
|
2681
|
+
) {
|
|
2682
|
+
const verb = 'GET';
|
|
2683
|
+
let path = `${this.baseUrl}/admin/stakes`;
|
|
2684
|
+
let params = '?';
|
|
2685
|
+
|
|
2686
|
+
if (isNumber(opts.limit)) {
|
|
2687
|
+
params += `&limit=${opts.limit}`;
|
|
2688
|
+
}
|
|
2689
|
+
|
|
2690
|
+
if (isNumber(opts.page)) {
|
|
2691
|
+
params += `&page=${opts.page}`;
|
|
2692
|
+
}
|
|
2693
|
+
|
|
2694
|
+
if (isString(opts.order_by)) {
|
|
2695
|
+
params += `&order_by=${opts.order_by}`;
|
|
2696
|
+
}
|
|
2697
|
+
|
|
2698
|
+
if (isString(opts.order)) {
|
|
2699
|
+
params += `&order=${opts.order}`;
|
|
2700
|
+
}
|
|
2701
|
+
|
|
2702
|
+
if (isDatetime(opts.start_date)) {
|
|
2703
|
+
params += `&start_date=${sanitizeDate(opts.start_date)}`;
|
|
2704
|
+
}
|
|
2705
|
+
|
|
2706
|
+
if (isDatetime(opts.end_date)) {
|
|
2707
|
+
params += `&end_date=${sanitizeDate(opts.end_date)}`;
|
|
2708
|
+
}
|
|
2709
|
+
|
|
2710
|
+
if (isString(opts.format)) {
|
|
2711
|
+
params += `&format=${opts.format}`;
|
|
2712
|
+
}
|
|
2713
|
+
|
|
2714
|
+
if (params.length > 1) path += params;
|
|
2715
|
+
const headers = generateHeaders(
|
|
2716
|
+
this.headers,
|
|
2717
|
+
this.apiSecret,
|
|
2718
|
+
verb,
|
|
2719
|
+
path,
|
|
2720
|
+
this.apiExpiresAfter
|
|
2721
|
+
);
|
|
2722
|
+
return createRequest(verb, `${this.apiUrl}${path}`, headers);
|
|
2723
|
+
}
|
|
2724
|
+
|
|
2725
|
+
/**
|
|
2726
|
+
* Create exchange stakes for admin
|
|
2727
|
+
* @param {string} name - Name of the stake pool
|
|
2728
|
+
* @param {number} user_id - User ID associated with the stake pool
|
|
2729
|
+
* @param {string} currency - Currency of the stake pool
|
|
2730
|
+
* @param {number} account_id - Account ID
|
|
2731
|
+
* @param {number} apy - Annual Percentage Yield
|
|
2732
|
+
* @param {number} min_amount - Minimum stake amount
|
|
2733
|
+
* @param {number} max_amount - Maximum stake amount
|
|
2734
|
+
* @param {boolean} early_unstake - Whether early unstake is allowed
|
|
2735
|
+
* @param {string} status - Pool status (uninitialized/active/paused/terminated)
|
|
2736
|
+
* @param {object} opts - Optional parameters
|
|
2737
|
+
* @param {number} opts.id - ID for existing stake pool (update only)
|
|
2738
|
+
* @param {string} opts.reward_currency - Currency for rewards
|
|
2739
|
+
* @param {number} opts.duration - Duration in days
|
|
2740
|
+
* @param {boolean} opts.slashing - Whether slashing is enabled
|
|
2741
|
+
* @param {number} opts.slashing_earning_percentage - Slashing percentage for earnings
|
|
2742
|
+
* @param {number} opts.slashing_principle_percentage - Slashing percentage for principle
|
|
2743
|
+
* @param {boolean} opts.onboarding - Whether pool is for onboarding
|
|
2744
|
+
* @param {string} opts.disclaimer - Disclaimer text
|
|
2745
|
+
* @return {object} A JSON object with the created stake
|
|
2746
|
+
*/
|
|
2747
|
+
createExchangeStakesByAdmin(
|
|
2748
|
+
name,
|
|
2749
|
+
user_id,
|
|
2750
|
+
currency,
|
|
2751
|
+
account_id,
|
|
2752
|
+
apy,
|
|
2753
|
+
min_amount,
|
|
2754
|
+
max_amount,
|
|
2755
|
+
early_unstake,
|
|
2756
|
+
status,
|
|
2757
|
+
opts = {
|
|
2758
|
+
reward_currency: null,
|
|
2759
|
+
duration: null,
|
|
2760
|
+
slashing: null,
|
|
2761
|
+
slashing_earning_percentage: null,
|
|
2762
|
+
slashing_principle_percentage: null,
|
|
2763
|
+
onboarding: null,
|
|
2764
|
+
disclaimer: null
|
|
2765
|
+
}
|
|
2766
|
+
) {
|
|
2767
|
+
const verb = 'POST';
|
|
2768
|
+
const path = `${this.baseUrl}/admin/stake`;
|
|
2769
|
+
const data = {
|
|
2770
|
+
name,
|
|
2771
|
+
user_id,
|
|
2772
|
+
currency,
|
|
2773
|
+
account_id,
|
|
2774
|
+
apy,
|
|
2775
|
+
min_amount,
|
|
2776
|
+
max_amount,
|
|
2777
|
+
early_unstake,
|
|
2778
|
+
status
|
|
2779
|
+
};
|
|
2780
|
+
|
|
2781
|
+
if (isString(opts.reward_currency)) {
|
|
2782
|
+
data.reward_currency = opts.reward_currency;
|
|
2783
|
+
}
|
|
2784
|
+
|
|
2785
|
+
if (isNumber(opts.duration)) {
|
|
2786
|
+
data.duration = opts.duration;
|
|
2787
|
+
}
|
|
2788
|
+
|
|
2789
|
+
if (isBoolean(opts.slashing)) {
|
|
2790
|
+
data.slashing = opts.slashing;
|
|
2791
|
+
}
|
|
2792
|
+
|
|
2793
|
+
if (isNumber(opts.slashing_earning_percentage)) {
|
|
2794
|
+
data.slashing_earning_percentage = opts.slashing_earning_percentage;
|
|
2795
|
+
}
|
|
2796
|
+
|
|
2797
|
+
if (isNumber(opts.slashing_principle_percentage)) {
|
|
2798
|
+
data.slashing_principle_percentage = opts.slashing_principle_percentage;
|
|
2799
|
+
}
|
|
2800
|
+
|
|
2801
|
+
if (isBoolean(opts.onboarding)) {
|
|
2802
|
+
data.onboarding = opts.onboarding;
|
|
2803
|
+
}
|
|
2804
|
+
|
|
2805
|
+
if (isString(opts.disclaimer)) {
|
|
2806
|
+
data.disclaimer = opts.disclaimer;
|
|
2807
|
+
}
|
|
2808
|
+
|
|
2809
|
+
const headers = generateHeaders(
|
|
2810
|
+
this.headers,
|
|
2811
|
+
this.apiSecret,
|
|
2812
|
+
verb,
|
|
2813
|
+
path,
|
|
2814
|
+
this.apiExpiresAfter,
|
|
2815
|
+
data
|
|
2816
|
+
);
|
|
2817
|
+
return createRequest(verb, `${this.apiUrl}${path}`, headers, { data });
|
|
2818
|
+
}
|
|
2819
|
+
|
|
2820
|
+
/**
|
|
2821
|
+
* Update exchange stakes for admin
|
|
2822
|
+
* @param {number} id - ID of the stake pool to update
|
|
2823
|
+
* @param {object} opts - Optional parameters
|
|
2824
|
+
* @param {string} opts.name - Name of the stake pool
|
|
2825
|
+
* @param {number} opts.user_id - User ID associated with the stake pool
|
|
2826
|
+
* @param {string} opts.currency - Currency of the stake pool
|
|
2827
|
+
* @param {string} opts.reward_currency - Currency for rewards
|
|
2828
|
+
* @param {number} opts.account_id - Account ID
|
|
2829
|
+
* @param {number} opts.apy - Annual Percentage Yield
|
|
2830
|
+
* @param {number} opts.duration - Duration in days
|
|
2831
|
+
* @param {boolean} opts.slashing - Whether slashing is enabled
|
|
2832
|
+
* @param {number} opts.slashing_earning_percentage - Slashing percentage for earnings
|
|
2833
|
+
* @param {number} opts.slashing_principle_percentage - Slashing percentage for principle
|
|
2834
|
+
* @param {boolean} opts.early_unstake - Whether early unstake is allowed
|
|
2835
|
+
* @param {number} opts.min_amount - Minimum stake amount
|
|
2836
|
+
* @param {number} opts.max_amount - Maximum stake amount
|
|
2837
|
+
* @param {string} opts.status - Pool status (uninitialized/active/paused/terminated)
|
|
2838
|
+
* @param {boolean} opts.onboarding - Whether pool is for onboarding
|
|
2839
|
+
* @param {string} opts.disclaimer - Disclaimer text
|
|
2840
|
+
* @return {object} A JSON object with the updated stake
|
|
2841
|
+
*/
|
|
2842
|
+
updateExchangeStakesByAdmin(
|
|
2843
|
+
id,
|
|
2844
|
+
opts = {
|
|
2845
|
+
name: null,
|
|
2846
|
+
user_id: null,
|
|
2847
|
+
currency: null,
|
|
2848
|
+
reward_currency: null,
|
|
2849
|
+
account_id: null,
|
|
2850
|
+
apy: null,
|
|
2851
|
+
duration: null,
|
|
2852
|
+
slashing: null,
|
|
2853
|
+
slashing_earning_percentage: null,
|
|
2854
|
+
slashing_principle_percentage: null,
|
|
2855
|
+
early_unstake: null,
|
|
2856
|
+
min_amount: null,
|
|
2857
|
+
max_amount: null,
|
|
2858
|
+
status: null,
|
|
2859
|
+
onboarding: null,
|
|
2860
|
+
disclaimer: null
|
|
2861
|
+
}
|
|
2862
|
+
) {
|
|
2863
|
+
const verb = 'PUT';
|
|
2864
|
+
const path = `${this.baseUrl}/admin/stake`;
|
|
2865
|
+
const data = { id };
|
|
2866
|
+
|
|
2867
|
+
// Optional parameters
|
|
2868
|
+
if (isString(opts.name)) {
|
|
2869
|
+
data.name = opts.name;
|
|
2870
|
+
}
|
|
2871
|
+
|
|
2872
|
+
if (isNumber(opts.user_id)) {
|
|
2873
|
+
data.user_id = opts.user_id;
|
|
2874
|
+
}
|
|
2875
|
+
|
|
2876
|
+
if (isString(opts.currency)) {
|
|
2877
|
+
data.currency = opts.currency;
|
|
2878
|
+
}
|
|
2879
|
+
|
|
2880
|
+
if (isString(opts.reward_currency)) {
|
|
2881
|
+
data.reward_currency = opts.reward_currency;
|
|
2882
|
+
}
|
|
2883
|
+
|
|
2884
|
+
if (isNumber(opts.account_id)) {
|
|
2885
|
+
data.account_id = opts.account_id;
|
|
2886
|
+
}
|
|
2887
|
+
|
|
2888
|
+
if (isNumber(opts.apy)) {
|
|
2889
|
+
data.apy = opts.apy;
|
|
2890
|
+
}
|
|
2891
|
+
|
|
2892
|
+
if (isNumber(opts.duration)) {
|
|
2893
|
+
data.duration = opts.duration;
|
|
2894
|
+
}
|
|
2895
|
+
|
|
2896
|
+
if (isBoolean(opts.slashing)) {
|
|
2897
|
+
data.slashing = opts.slashing;
|
|
2898
|
+
}
|
|
2899
|
+
|
|
2900
|
+
if (isNumber(opts.slashing_earning_percentage)) {
|
|
2901
|
+
data.slashing_earning_percentage = opts.slashing_earning_percentage;
|
|
2902
|
+
}
|
|
2903
|
+
|
|
2904
|
+
if (isNumber(opts.slashing_principle_percentage)) {
|
|
2905
|
+
data.slashing_principle_percentage = opts.slashing_principle_percentage;
|
|
2906
|
+
}
|
|
2907
|
+
|
|
2908
|
+
if (isBoolean(opts.early_unstake)) {
|
|
2909
|
+
data.early_unstake = opts.early_unstake;
|
|
2910
|
+
}
|
|
2911
|
+
|
|
2912
|
+
if (isNumber(opts.min_amount)) {
|
|
2913
|
+
data.min_amount = opts.min_amount;
|
|
2914
|
+
}
|
|
2915
|
+
|
|
2916
|
+
if (isNumber(opts.max_amount)) {
|
|
2917
|
+
data.max_amount = opts.max_amount;
|
|
2918
|
+
}
|
|
2919
|
+
|
|
2920
|
+
if (isString(opts.status) && ['uninitialized', 'active', 'paused', 'terminated'].includes(opts.status)) {
|
|
2921
|
+
data.status = opts.status;
|
|
2922
|
+
}
|
|
2923
|
+
|
|
2924
|
+
if (isBoolean(opts.onboarding)) {
|
|
2925
|
+
data.onboarding = opts.onboarding;
|
|
2926
|
+
}
|
|
2927
|
+
|
|
2928
|
+
if (isString(opts.disclaimer)) {
|
|
2929
|
+
data.disclaimer = opts.disclaimer;
|
|
2930
|
+
}
|
|
2931
|
+
|
|
2932
|
+
const headers = generateHeaders(
|
|
2933
|
+
this.headers,
|
|
2934
|
+
this.apiSecret,
|
|
2935
|
+
verb,
|
|
2936
|
+
path,
|
|
2937
|
+
this.apiExpiresAfter,
|
|
2938
|
+
data
|
|
2939
|
+
);
|
|
2940
|
+
return createRequest(verb, `${this.apiUrl}${path}`, headers, { data });
|
|
2941
|
+
}
|
|
2942
|
+
|
|
2943
|
+
/**
|
|
2944
|
+
* Delete exchange stakes for admin
|
|
2945
|
+
* @param {object} data - ID object containing stake ID to delete
|
|
2946
|
+
* @return {object} A JSON object with deletion result
|
|
2947
|
+
*/
|
|
2948
|
+
deleteExchangeStakesByAdmin(id) {
|
|
2949
|
+
const verb = 'DELETE';
|
|
2950
|
+
const path = `${this.baseUrl}/admin/stake`;
|
|
2951
|
+
const data = { id };
|
|
2952
|
+
|
|
2953
|
+
const headers = generateHeaders(
|
|
2954
|
+
this.headers,
|
|
2955
|
+
this.apiSecret,
|
|
2956
|
+
verb,
|
|
2957
|
+
path,
|
|
2958
|
+
this.apiExpiresAfter,
|
|
2959
|
+
data
|
|
2960
|
+
);
|
|
2961
|
+
return createRequest(verb, `${this.apiUrl}${path}`, headers, { data });
|
|
2962
|
+
}
|
|
2963
|
+
|
|
2964
|
+
/**
|
|
2965
|
+
* Get exchange stakers of users for admin
|
|
2966
|
+
* @param {object} opts - Optional parameters
|
|
2967
|
+
* @param {number} opts.id - Unique identifier for the staker entry
|
|
2968
|
+
* @param {number} opts.user_id - The ID of the user who has locked funds and staked
|
|
2969
|
+
* @param {number} opts.stake_id - The ID of the stake pool
|
|
2970
|
+
* @param {string} opts.currency - The currency in which the user staked
|
|
2971
|
+
* @param {number} opts.reward - The amount the user has received as rewards
|
|
2972
|
+
* @param {number} opts.slashed - The amount slashed
|
|
2973
|
+
* @param {number} opts.limit - Number of elements to return. Default: 50. Maximum: 100
|
|
2974
|
+
* @param {number} opts.page - Page of data to retrieve
|
|
2975
|
+
* @param {string} opts.order_by - Field to order data
|
|
2976
|
+
* @param {string} opts.order - Direction to order (asc/desc)
|
|
2977
|
+
* @param {string} opts.start_date - Starting date of queried data in ISO8601 format
|
|
2978
|
+
* @param {string} opts.end_date - Ending date of queried data in ISO8601 format
|
|
2979
|
+
* @param {string} opts.format - Specify data format (csv/all)
|
|
2980
|
+
* @return {object} A JSON object with stakers data
|
|
2981
|
+
*/
|
|
2982
|
+
getExchangeStakersByAdmin(
|
|
2983
|
+
opts = {
|
|
2984
|
+
id: null,
|
|
2985
|
+
user_id: null,
|
|
2986
|
+
stake_id: null,
|
|
2987
|
+
currency: null,
|
|
2988
|
+
reward: null,
|
|
2989
|
+
slashed: null,
|
|
2990
|
+
limit: null,
|
|
2991
|
+
page: null,
|
|
2992
|
+
order_by: null,
|
|
2993
|
+
order: null,
|
|
2994
|
+
start_date: null,
|
|
2995
|
+
end_date: null,
|
|
2996
|
+
format: null
|
|
2997
|
+
}
|
|
2998
|
+
) {
|
|
2999
|
+
const verb = 'GET';
|
|
3000
|
+
let path = `${this.baseUrl}/admin/stakers`;
|
|
3001
|
+
let params = '?';
|
|
3002
|
+
|
|
3003
|
+
if (isNumber(opts.id)) {
|
|
3004
|
+
params += `&id=${opts.id}`;
|
|
3005
|
+
}
|
|
3006
|
+
|
|
3007
|
+
if (isNumber(opts.user_id)) {
|
|
3008
|
+
params += `&user_id=${opts.user_id}`;
|
|
3009
|
+
}
|
|
3010
|
+
|
|
3011
|
+
if (isNumber(opts.stake_id)) {
|
|
3012
|
+
params += `&stake_id=${opts.stake_id}`;
|
|
3013
|
+
}
|
|
3014
|
+
|
|
3015
|
+
if (isString(opts.currency)) {
|
|
3016
|
+
params += `¤cy=${opts.currency}`;
|
|
3017
|
+
}
|
|
3018
|
+
|
|
3019
|
+
if (isNumber(opts.reward)) {
|
|
3020
|
+
params += `&reward=${opts.reward}`;
|
|
3021
|
+
}
|
|
3022
|
+
|
|
3023
|
+
if (isNumber(opts.slashed)) {
|
|
3024
|
+
params += `&slashed=${opts.slashed}`;
|
|
3025
|
+
}
|
|
3026
|
+
|
|
3027
|
+
if (isNumber(opts.limit)) {
|
|
3028
|
+
params += `&limit=${opts.limit}`;
|
|
3029
|
+
}
|
|
3030
|
+
|
|
3031
|
+
if (isNumber(opts.page)) {
|
|
3032
|
+
params += `&page=${opts.page}`;
|
|
3033
|
+
}
|
|
3034
|
+
|
|
3035
|
+
if (isString(opts.order_by)) {
|
|
3036
|
+
params += `&order_by=${opts.order_by}`;
|
|
3037
|
+
}
|
|
3038
|
+
|
|
3039
|
+
if (isString(opts.order)) {
|
|
3040
|
+
params += `&order=${opts.order}`;
|
|
3041
|
+
}
|
|
3042
|
+
|
|
3043
|
+
if (isDatetime(opts.start_date)) {
|
|
3044
|
+
params += `&start_date=${sanitizeDate(opts.start_date)}`;
|
|
3045
|
+
}
|
|
3046
|
+
|
|
3047
|
+
if (isDatetime(opts.end_date)) {
|
|
3048
|
+
params += `&end_date=${sanitizeDate(opts.end_date)}`;
|
|
3049
|
+
}
|
|
3050
|
+
|
|
3051
|
+
if (isString(opts.format)) {
|
|
3052
|
+
params += `&format=${opts.format}`;
|
|
3053
|
+
}
|
|
3054
|
+
|
|
3055
|
+
if (params.length > 1) path += params;
|
|
3056
|
+
const headers = generateHeaders(
|
|
3057
|
+
this.headers,
|
|
3058
|
+
this.apiSecret,
|
|
3059
|
+
verb,
|
|
3060
|
+
path,
|
|
3061
|
+
this.apiExpiresAfter
|
|
3062
|
+
);
|
|
3063
|
+
return createRequest(verb, `${this.apiUrl}${path}`, headers);
|
|
3064
|
+
}
|
|
3065
|
+
|
|
3066
|
+
/**
|
|
3067
|
+
* Get staking and unstaking amounts
|
|
3068
|
+
* @return {object} A JSON object with stake analytics data
|
|
3069
|
+
*/
|
|
3070
|
+
getStakeAnalyticsByAdmin() {
|
|
3071
|
+
const verb = 'GET';
|
|
3072
|
+
const path = `${this.baseUrl}/admin/stake/analytics`;
|
|
3073
|
+
|
|
3074
|
+
const headers = generateHeaders(
|
|
3075
|
+
this.headers,
|
|
3076
|
+
this.apiSecret,
|
|
3077
|
+
verb,
|
|
3078
|
+
path,
|
|
3079
|
+
this.apiExpiresAfter
|
|
3080
|
+
);
|
|
3081
|
+
return createRequest(verb, `${this.apiUrl}${path}`, headers);
|
|
3082
|
+
}
|
|
2640
3083
|
/**
|
|
2641
3084
|
* Connect to hollaEx websocket and listen to an event
|
|
2642
3085
|
* @param {array} events - The events to listen to
|
|
@@ -2654,9 +3097,8 @@ class HollaExKit {
|
|
|
2654
3097
|
'/stream',
|
|
2655
3098
|
apiExpires
|
|
2656
3099
|
);
|
|
2657
|
-
url = `${url}?api-key=${
|
|
2658
|
-
|
|
2659
|
-
}&api-signature=${signature}&api-expires=${apiExpires}`;
|
|
3100
|
+
url = `${url}?api-key=${this.apiKey
|
|
3101
|
+
}&api-signature=${signature}&api-expires=${apiExpires}`;
|
|
2660
3102
|
}
|
|
2661
3103
|
|
|
2662
3104
|
this.ws = new WebSocket(url);
|
|
@@ -2748,21 +3190,41 @@ class HollaExKit {
|
|
|
2748
3190
|
if (!this.wsEvents.includes(event) || this.initialConnection) {
|
|
2749
3191
|
const [topic, symbol] = event.split(':');
|
|
2750
3192
|
switch (topic) {
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
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 {
|
|
2755
3208
|
this.ws.send(
|
|
2756
3209
|
JSON.stringify({
|
|
2757
3210
|
op: 'subscribe',
|
|
2758
|
-
args: [
|
|
3211
|
+
args: [topic]
|
|
2759
3212
|
})
|
|
2760
3213
|
);
|
|
2761
3214
|
if (!this.initialConnection) {
|
|
3215
|
+
this.wsEvents = this.wsEvents.filter(
|
|
3216
|
+
(e) => !e.includes(`${topic}:`)
|
|
3217
|
+
);
|
|
2762
3218
|
this.wsEvents = union(this.wsEvents, [event]);
|
|
2763
3219
|
}
|
|
2764
3220
|
}
|
|
2765
|
-
|
|
3221
|
+
break;
|
|
3222
|
+
case 'order':
|
|
3223
|
+
case 'usertrade':
|
|
3224
|
+
case 'wallet':
|
|
3225
|
+
case 'deposit':
|
|
3226
|
+
case 'withdrawal':
|
|
3227
|
+
case 'admin':
|
|
2766
3228
|
this.ws.send(
|
|
2767
3229
|
JSON.stringify({
|
|
2768
3230
|
op: 'subscribe',
|
|
@@ -2770,31 +3232,11 @@ class HollaExKit {
|
|
|
2770
3232
|
})
|
|
2771
3233
|
);
|
|
2772
3234
|
if (!this.initialConnection) {
|
|
2773
|
-
this.wsEvents = this.wsEvents.filter(
|
|
2774
|
-
(e) => !e.includes(`${topic}:`)
|
|
2775
|
-
);
|
|
2776
3235
|
this.wsEvents = union(this.wsEvents, [event]);
|
|
2777
3236
|
}
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
case 'usertrade':
|
|
2782
|
-
case 'wallet':
|
|
2783
|
-
case 'deposit':
|
|
2784
|
-
case 'withdrawal':
|
|
2785
|
-
case 'admin':
|
|
2786
|
-
this.ws.send(
|
|
2787
|
-
JSON.stringify({
|
|
2788
|
-
op: 'subscribe',
|
|
2789
|
-
args: [topic]
|
|
2790
|
-
})
|
|
2791
|
-
);
|
|
2792
|
-
if (!this.initialConnection) {
|
|
2793
|
-
this.wsEvents = union(this.wsEvents, [event]);
|
|
2794
|
-
}
|
|
2795
|
-
break;
|
|
2796
|
-
default:
|
|
2797
|
-
break;
|
|
3237
|
+
break;
|
|
3238
|
+
default:
|
|
3239
|
+
break;
|
|
2798
3240
|
}
|
|
2799
3241
|
}
|
|
2800
3242
|
});
|
|
@@ -2813,40 +3255,40 @@ class HollaExKit {
|
|
|
2813
3255
|
if (this.wsEvents.includes(event)) {
|
|
2814
3256
|
const [topic, symbol] = event.split(':');
|
|
2815
3257
|
switch (topic) {
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
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':
|
|
2826
3282
|
this.ws.send(
|
|
2827
3283
|
JSON.stringify({
|
|
2828
3284
|
op: 'unsubscribe',
|
|
2829
3285
|
args: [topic]
|
|
2830
3286
|
})
|
|
2831
3287
|
);
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
case 'wallet':
|
|
2837
|
-
case 'deposit':
|
|
2838
|
-
case 'withdrawal':
|
|
2839
|
-
case 'admin':
|
|
2840
|
-
this.ws.send(
|
|
2841
|
-
JSON.stringify({
|
|
2842
|
-
op: 'unsubscribe',
|
|
2843
|
-
args: [topic]
|
|
2844
|
-
})
|
|
2845
|
-
);
|
|
2846
|
-
this.wsEvents = this.wsEvents.filter((e) => e !== event);
|
|
2847
|
-
break;
|
|
2848
|
-
default:
|
|
2849
|
-
break;
|
|
3288
|
+
this.wsEvents = this.wsEvents.filter((e) => e !== event);
|
|
3289
|
+
break;
|
|
3290
|
+
default:
|
|
3291
|
+
break;
|
|
2850
3292
|
}
|
|
2851
3293
|
}
|
|
2852
3294
|
});
|
|
@@ -2856,4 +3298,4 @@ class HollaExKit {
|
|
|
2856
3298
|
}
|
|
2857
3299
|
}
|
|
2858
3300
|
|
|
2859
|
-
module.exports = HollaExKit;
|
|
3301
|
+
module.exports = HollaExKit;
|