diff --git a/server/controllers/BlockchainBlock.ts b/server/controllers/BlockchainBlock.ts index 072276c..46ff1d7 100644 --- a/server/controllers/BlockchainBlock.ts +++ b/server/controllers/BlockchainBlock.ts @@ -23,7 +23,23 @@ import { import { Paginate } from '../utils'; var moment = require('moment'); - +moment.updateLocale('en', { + relativeTime: { + future: "in %s", + past: "%s ago", + s: "seconds", + m: "1 minute", + mm: "%d minutes", + h: "1 hour", + hh: "%d hours", + d: "1 day", + dd: "%d days", + M: "1 month", + MM: "%d months", + y: "1 year", + yy: "%d years" + } +}); export class BlockchainBlockController { public path = '/blockchain_block'; public router = express.Router(); @@ -1222,6 +1238,11 @@ export class BlockchainBlockController { var Maxrange = Math.max.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.tarket_difficulty; })); var Minrange = Math.min.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.tarket_difficulty; })); + if(Minrange != 0){ + Minrange = (Minrange - (Minrange * 0.2)); + } + Maxrange = (Maxrange + (Maxrange * 0.2)); + // Minrange = parseInt(Minrange); // var Minrange2 = parseInt(Minrange * 0.3); response.status(200).json({ @@ -1234,7 +1255,7 @@ export class BlockchainBlockController { // DifficultyCuckatoo: DifficultyCuckatoo, // DifficultyProgpow: DifficultyProgpow, Maxrange: Maxrange, - Minrange: (Minrange * 0.2), + Minrange: Minrange, TargetDifficulty: TargetDifficulty, tickFormat: tickFormat }, diff --git a/server/socket/block.ts b/server/socket/block.ts index 332b291..bd654bc 100644 --- a/server/socket/block.ts +++ b/server/socket/block.ts @@ -1,5 +1,22 @@ import { getConnection } from "typeorm"; -const moment = require("moment"); +var moment = require("moment"); +moment.updateLocale('en', { + relativeTime: { + future: "in %s", + past: "%s ago", + s: "seconds", + m: "1 minute", + mm: "%d minutes", + h: "1 hour", + hh: "%d hours", + d: "1 day", + dd: "%d days", + M: "1 month", + MM: "%d months", + y: "1 year", + yy: "%d years" + } +}); export async function universalGetLatestBlockDetails(socket) { @@ -200,6 +217,7 @@ export async function universalGetLatestBlockDetails(socket) { input_count: BlockchainLatestBlockQuery[0].input_count, kernel_count: BlockchainLatestBlockQuery[0].kernel_count, output_count: BlockchainLatestBlockQuery[0].output_count, + hash: BlockchainLatestBlockQuery[0].hash, proof: BlockchainLatestBlockQuery[0].proof, hasharray: hasharray, Difficulty: Difficulty, diff --git a/src/app/view/home/block-append/block-append.component.ts b/src/app/view/home/block-append/block-append.component.ts index d6bd93d..4abb9a2 100644 --- a/src/app/view/home/block-append/block-append.component.ts +++ b/src/app/view/home/block-append/block-append.component.ts @@ -12,7 +12,7 @@ export class BlockAppendComponent implements OnInit { constructor() {} ngOnInit() { - console.log(this.blockdetails); + //console.log(this.blockdetails); } public onClickPlus(height) { diff --git a/src/app/view/home/block-detail-list/block-detail-list.component.ts b/src/app/view/home/block-detail-list/block-detail-list.component.ts index 74cffe6..5cd7d21 100644 --- a/src/app/view/home/block-detail-list/block-detail-list.component.ts +++ b/src/app/view/home/block-detail-list/block-detail-list.component.ts @@ -31,7 +31,7 @@ export class BlockDetailListComponent implements OnInit { ngOnInit() { this.gettinglatesthashList(); this.getBlockDetails(); - console.log("Enter Nginit"); + //console.log("Enter Nginit"); } diff --git a/src/app/view/home/graph-list/graph-list.component.html b/src/app/view/home/graph-list/graph-list.component.html index 00dfa2c..f6d2e39 100644 --- a/src/app/view/home/graph-list/graph-list.component.html +++ b/src/app/view/home/graph-list/graph-list.component.html @@ -305,7 +305,7 @@ -
+

{{'home.BLOCKS_MINED' | translate}}

diff --git a/src/app/view/home/graph-list/graph-list.component.ts b/src/app/view/home/graph-list/graph-list.component.ts index ee71ecd..8e69e27 100644 --- a/src/app/view/home/graph-list/graph-list.component.ts +++ b/src/app/view/home/graph-list/graph-list.component.ts @@ -173,7 +173,7 @@ export class GraphListComponent implements OnInit { ); }); } - + Transactiondoublelinechartreq(fromDate = '', ToDate = '', interval = '') { return new Promise((resolve, reject) => { let params = new HttpParams(); @@ -285,7 +285,7 @@ export class GraphListComponent implements OnInit { let ProgPow = res.response.ProgPow; let Cuckoo = res.response.Cuckoo; let RandomX = res.response.RandomX; - + let ProgPowper = res.response.ProgPowper; let Cuckooper = res.response.Cuckooper; let RandomXper = res.response.RandomXper; @@ -341,7 +341,6 @@ export class GraphListComponent implements OnInit { .apiGetRequest(params, '/blockchain_block/supplygrowth') .subscribe( res => { - res = {"status":200,"timestamp":1564734317476,"message":"period of blocks generation per second fetched Successfully","response":{"date":["2019-08-01"],"total_reward_per_day":[4600],"addedreward":[4600]}} if (res['status'] == 200) { let gDate = res.response.date; let gReward = res.response.total_reward_per_day; @@ -406,7 +405,7 @@ export class GraphListComponent implements OnInit { let tickformat = res.response.tickFormat; this.lg_last = TargetDifficulty[TargetDifficulty.length - 1]; - + switch(difftype){ case 'total': this.totaldifficultyChartFunc( @@ -451,7 +450,7 @@ export class GraphListComponent implements OnInit { res => { if (res['status'] == 200) { let DifficultychartDate = res.response.Date; - let BlocksChartDate = res.response.blockDate; + let BlocksChartDate = res.response.blockDate; let Blockval = res.response.Blocks; this.brg_last = Blockval[Blockval.length - 1]; this.totalBlocksFunc(BlocksChartDate, Blockval); @@ -464,18 +463,18 @@ export class GraphListComponent implements OnInit { } difficultyChartFunc(DifficultychartDate, TargetDifficulty, Type, range, tickformat) { - console.log('range rangerangerange@@@@@@@22444',range); + // console.log('range rangerangerange',range); this.linearGraphData = { data: [ { x: DifficultychartDate, y: TargetDifficulty, - text: TargetDifficulty, + text: DifficultychartDate, mode: 'lines+markers', type: 'scatter', name: '', line: { color: '#ac3333' }, - hovertemplate: '%{x}
Difficulty : %{text:,}', + hovertemplate: '%{text}
Difficulty : %{y:,}', }, // { // x: DifficultychartDate, @@ -741,7 +740,6 @@ export class GraphListComponent implements OnInit { } growthFunc(gDate, gReward, gaddedreward) { - console.log('gDate gReward gaddedreward',gDate, gReward, gaddedreward) this.growthGraphData = { data: [ { @@ -777,7 +775,8 @@ export class GraphListComponent implements OnInit { rangemode: 'nonnegative', fixedrange: true, showgrid: true, - tickformat :".0f" + tickformat :".0f", + tickprefix: ' ' }, margin: { l: 50, @@ -1097,12 +1096,12 @@ export class GraphListComponent implements OnInit { { x: DifficultychartDate, y: TargetDifficulty, - text: TargetDifficulty, + text: DifficultychartDate, mode: 'lines+markers', type: 'scatter', name: '', line: { color: '#ac3333' }, - hovertemplate: '%{DifficultychartDate}
Difficulty : %{text:,}', + hovertemplate: '%{text}
Difficulty : %{y:,}', }, ], layout: { diff --git a/src/app/view/home/latestblocks/latestblocks.component.ts b/src/app/view/home/latestblocks/latestblocks.component.ts index e9c981e..4724e40 100644 --- a/src/app/view/home/latestblocks/latestblocks.component.ts +++ b/src/app/view/home/latestblocks/latestblocks.component.ts @@ -48,6 +48,11 @@ export class LatestblocksComponent implements OnInit { if (res['status'] == 200) { this.pagedata = res.response; this.hashvalues = res.response.BlockchainBlockResult; + if(CurrentPage == 1){ + this.lastblock = res.response.BlockchainBlockResult[0].blockchain_block_height; + //console.log(this.lastblock); + + } } }, error => {}, @@ -57,9 +62,9 @@ export class LatestblocksComponent implements OnInit { getLastCeatedBlock() { this.chartService.getLatestblockdetails().subscribe(response => { this.blockdetails = response; - console.log(this.blockdetails); + //console.log(this.blockdetails); if (this.lastblock != this.blockdetails.block_height) { - console.log('Create'); + //console.log('Create'); this.createBlock(); } this.lastblock = this.blockdetails.block_height;