Skip to content

Commit

Permalink
Build 1.1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
emiliorizzo committed Jan 7, 2021
1 parent 5380390 commit 383fcb3
Show file tree
Hide file tree
Showing 29 changed files with 1,737 additions and 1,717 deletions.
12 changes: 6 additions & 6 deletions dist/api/Api.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class Api extends _DataCollector.DataCollector {
}
}
getStats() {
return this.formatData(this.stats);
return this.stats;
}
getCirculatingSupply() {
return this.formatData(this.circulatingSupply);
Expand Down Expand Up @@ -151,11 +151,11 @@ class Api extends _DataCollector.DataCollector {
if (!stats) return;

/* const ExtendedStats = this.getModule('ExtendedStats')
if (ExtendedStats) {
const blockNumber = parseInt(stats.blockNumber)
const extendedStats = await ExtendedStats.getExtendedStats(blockNumber)
Object.assign(stats, extendedStats)
} */
if (ExtendedStats) {
const blockNumber = parseInt(stats.blockNumber)
const extendedStats = await ExtendedStats.getExtendedStats(blockNumber)
Object.assign(stats, extendedStats)
} */
let circulatingSupply = stats.circulatingSupply || (await this.getCirculatingSupplyFromDb());
this.circulatingSupply = circulatingSupply;
this.stats = Object.assign({}, stats);
Expand Down
11 changes: 6 additions & 5 deletions dist/api/lib/DataCollector/DataCollectorItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ class DataCollectorItem {
async getLatest(query, project) {
query = query || {};
const result = await (0, _pagination.find)(this.db, query, this.sort, 1, project);
return result.length ? result[0] : null;
const data = result.length ? result[0] : null;
return { data };
}

async setFieldsTypes() {
Expand Down Expand Up @@ -127,10 +128,10 @@ class DataCollectorItem {
}
}
/**
* Resolves item query parsing params
* @param {*} query
* @param {*} params
*/
* Resolves item query parsing params
* @param {*} query
* @param {*} params
*/
async getItem(query, { fields, getPrevNext }) {
try {
let data = await this.getOne(query, fields);
Expand Down
16 changes: 8 additions & 8 deletions dist/api/lib/difficultyCalculator.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

class DifficultyCalculator {
/**
* Given an array of blocks, a period of time and a bucket size. Returns an array with the average
* block difficulty for each bucket.
*
* @param {*} blocks An array of blocks with timestamp and difficulty
* @param {*} tstart Period start time
* @param {*} tend Period end time
* @param {*} bucketSize Bucket time size to divide the period in
*/
* Given an array of blocks, a period of time and a bucket size. Returns an array with the average
* block difficulty for each bucket.
*
* @param {*} blocks An array of blocks with timestamp and difficulty
* @param {*} tstart Period start time
* @param {*} tend Period end time
* @param {*} bucketSize Bucket time size to divide the period in
*/
difficulties(blocks, tstart, tend, bucketSize) {
if (!Array.isArray(blocks) || tend < tstart) {
return [];
Expand Down
Loading

0 comments on commit 383fcb3

Please sign in to comment.