capitalisk-dex 17.1.0 → 17.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +26 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -459,6 +459,7 @@ module.exports = class CapitaliskDEXModule {
|
|
|
459
459
|
get actions() {
|
|
460
460
|
return {
|
|
461
461
|
getStatus: {
|
|
462
|
+
isPublic: true,
|
|
462
463
|
handler: () => {
|
|
463
464
|
return {
|
|
464
465
|
version: CapitaliskDEXModule.info.version,
|
|
@@ -475,6 +476,7 @@ module.exports = class CapitaliskDEXModule {
|
|
|
475
476
|
}
|
|
476
477
|
},
|
|
477
478
|
getMarket: {
|
|
479
|
+
isPublic: true,
|
|
478
480
|
handler: () => {
|
|
479
481
|
return {
|
|
480
482
|
baseSymbol: this.baseChainSymbol,
|
|
@@ -483,6 +485,7 @@ module.exports = class CapitaliskDEXModule {
|
|
|
483
485
|
}
|
|
484
486
|
},
|
|
485
487
|
getBids: {
|
|
488
|
+
isPublic: true,
|
|
486
489
|
handler: (action) => {
|
|
487
490
|
let query = {...action.params};
|
|
488
491
|
// Optimization.
|
|
@@ -508,6 +511,7 @@ module.exports = class CapitaliskDEXModule {
|
|
|
508
511
|
}
|
|
509
512
|
},
|
|
510
513
|
getAsks: {
|
|
514
|
+
isPublic: true,
|
|
511
515
|
handler: (action) => {
|
|
512
516
|
let query = {...action.params};
|
|
513
517
|
// Optimization.
|
|
@@ -533,6 +537,7 @@ module.exports = class CapitaliskDEXModule {
|
|
|
533
537
|
}
|
|
534
538
|
},
|
|
535
539
|
getOrders: {
|
|
540
|
+
isPublic: true,
|
|
536
541
|
handler: (action) => {
|
|
537
542
|
let query = {...action.params};
|
|
538
543
|
let orderIterator;
|
|
@@ -556,6 +561,7 @@ module.exports = class CapitaliskDEXModule {
|
|
|
556
561
|
}
|
|
557
562
|
},
|
|
558
563
|
getOrderBook: {
|
|
564
|
+
isPublic: true,
|
|
559
565
|
handler: (action) => {
|
|
560
566
|
let query = {...action.params};
|
|
561
567
|
let { depth } = query;
|
|
@@ -571,7 +577,18 @@ module.exports = class CapitaliskDEXModule {
|
|
|
571
577
|
error.name = 'InvalidQueryError';
|
|
572
578
|
throw error;
|
|
573
579
|
}
|
|
580
|
+
let halfAPIMaxPageLimit = Math.floor(this.options.apiMaxPageLimit / 2);
|
|
581
|
+
if (depth > halfAPIMaxPageLimit) {
|
|
582
|
+
let error = new Error(
|
|
583
|
+
`The depth parameter of the query cannot be greater than ${
|
|
584
|
+
halfAPIMaxPageLimit
|
|
585
|
+
}`
|
|
586
|
+
);
|
|
587
|
+
error.name = 'InvalidQueryError';
|
|
588
|
+
throw error;
|
|
589
|
+
}
|
|
574
590
|
let doubleDepth = depth * 2;
|
|
591
|
+
|
|
575
592
|
let askLevelIterator = this.tradeEngine.getAskLevelIteratorFromMin();
|
|
576
593
|
let bidLevelIterator = this.tradeEngine.getBidLevelIteratorFromMax();
|
|
577
594
|
|
|
@@ -616,6 +633,7 @@ module.exports = class CapitaliskDEXModule {
|
|
|
616
633
|
}
|
|
617
634
|
},
|
|
618
635
|
getRecentPrices: {
|
|
636
|
+
isPublic: true,
|
|
619
637
|
handler: (action) => {
|
|
620
638
|
let priceEntryIterator = this.recentPricesSkipList.findEntriesFromMax();
|
|
621
639
|
let priceGenerator = this._getValuesGenerator(priceEntryIterator);
|
|
@@ -626,6 +644,7 @@ module.exports = class CapitaliskDEXModule {
|
|
|
626
644
|
}
|
|
627
645
|
},
|
|
628
646
|
getPendingTransfers: {
|
|
647
|
+
isPublic: true,
|
|
629
648
|
handler: (action) => {
|
|
630
649
|
let transferList = this._execQueryAgainstIterator(
|
|
631
650
|
action.params,
|
|
@@ -655,6 +674,7 @@ module.exports = class CapitaliskDEXModule {
|
|
|
655
674
|
}
|
|
656
675
|
},
|
|
657
676
|
getRecentTransfers: {
|
|
677
|
+
isPublic: true,
|
|
658
678
|
handler: (action) => {
|
|
659
679
|
let recentTransfersIterator = this.recentTransfersSkipList.findEntriesFromMax();
|
|
660
680
|
let transferGenerator = this._getNestedObjectValuesGenerator(recentTransfersIterator);
|
|
@@ -1440,6 +1460,9 @@ module.exports = class CapitaliskDEXModule {
|
|
|
1440
1460
|
let [inboundTxns, outboundTxns] = blockTransactions;
|
|
1441
1461
|
|
|
1442
1462
|
outboundTxns.forEach((txn) => {
|
|
1463
|
+
this.logger.debug(
|
|
1464
|
+
`Chain ${chainSymbol}: Observed outbound transfer ${txn.id} at height ${chainHeight}`
|
|
1465
|
+
);
|
|
1443
1466
|
let pendingTransfer = this.pendingTransfers.get(txn.id);
|
|
1444
1467
|
if (pendingTransfer) {
|
|
1445
1468
|
let recentTransfer = {...pendingTransfer, transaction: txn};
|
|
@@ -1450,6 +1473,9 @@ module.exports = class CapitaliskDEXModule {
|
|
|
1450
1473
|
this.recentTransfersSkipList.upsert(recentTransfer.timestamp, {[txn.id]: recentTransfer});
|
|
1451
1474
|
}
|
|
1452
1475
|
this.pendingTransfers.delete(txn.id);
|
|
1476
|
+
this.logger.debug(
|
|
1477
|
+
`Chain ${chainSymbol}: Removed pending transfer ${txn.id} from queue`
|
|
1478
|
+
);
|
|
1453
1479
|
}
|
|
1454
1480
|
});
|
|
1455
1481
|
|