capitalisk-dex 17.1.1 → 17.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,6 +16,7 @@ module.exports = {
16
16
  orderBookSnapshotBackupDirPath: 'dex-snapshot-backups',
17
17
  orderBookSnapshotBackupMaxCount: 50,
18
18
  baseChain: 'lsk',
19
+ apiIsPublic: true,
19
20
  apiDefaultPageLimit: 100,
20
21
  apiMaxPageLimit: 200,
21
22
  apiMaxFilterFields: 10,
package/index.js CHANGED
@@ -459,6 +459,7 @@ module.exports = class CapitaliskDEXModule {
459
459
  get actions() {
460
460
  return {
461
461
  getStatus: {
462
+ isPublic: this.options.apiIsPublic,
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: this.options.apiIsPublic,
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: this.options.apiIsPublic,
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: this.options.apiIsPublic,
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: this.options.apiIsPublic,
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: this.options.apiIsPublic,
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: this.options.apiIsPublic,
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: this.options.apiIsPublic,
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: this.options.apiIsPublic,
658
678
  handler: (action) => {
659
679
  let recentTransfersIterator = this.recentTransfersSkipList.findEntriesFromMax();
660
680
  let transferGenerator = this._getNestedObjectValuesGenerator(recentTransfersIterator);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capitalisk-dex",
3
- "version": "17.1.1",
3
+ "version": "17.2.1",
4
4
  "description": "Decentralized exchange module.",
5
5
  "main": "index.js",
6
6
  "scripts": {