This commit is contained in:
Prema 2019-08-08 18:31:09 +05:30
commit 637e17b13a
7 changed files with 63 additions and 20 deletions

View File

@ -23,7 +23,23 @@ import {
import { Paginate } from '../utils'; import { Paginate } from '../utils';
var 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 class BlockchainBlockController { export class BlockchainBlockController {
public path = '/blockchain_block'; public path = '/blockchain_block';
public router = express.Router(); 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 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; })); 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); // Minrange = parseInt(Minrange);
// var Minrange2 = parseInt(Minrange * 0.3); // var Minrange2 = parseInt(Minrange * 0.3);
response.status(200).json({ response.status(200).json({
@ -1234,7 +1255,7 @@ export class BlockchainBlockController {
// DifficultyCuckatoo: DifficultyCuckatoo, // DifficultyCuckatoo: DifficultyCuckatoo,
// DifficultyProgpow: DifficultyProgpow, // DifficultyProgpow: DifficultyProgpow,
Maxrange: Maxrange, Maxrange: Maxrange,
Minrange: (Minrange * 0.2), Minrange: Minrange,
TargetDifficulty: TargetDifficulty, TargetDifficulty: TargetDifficulty,
tickFormat: tickFormat tickFormat: tickFormat
}, },

View File

@ -1,5 +1,22 @@
import { getConnection } from "typeorm"; 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) { export async function universalGetLatestBlockDetails(socket) {
@ -200,6 +217,7 @@ export async function universalGetLatestBlockDetails(socket) {
input_count: BlockchainLatestBlockQuery[0].input_count, input_count: BlockchainLatestBlockQuery[0].input_count,
kernel_count: BlockchainLatestBlockQuery[0].kernel_count, kernel_count: BlockchainLatestBlockQuery[0].kernel_count,
output_count: BlockchainLatestBlockQuery[0].output_count, output_count: BlockchainLatestBlockQuery[0].output_count,
hash: BlockchainLatestBlockQuery[0].hash,
proof: BlockchainLatestBlockQuery[0].proof, proof: BlockchainLatestBlockQuery[0].proof,
hasharray: hasharray, hasharray: hasharray,
Difficulty: Difficulty, Difficulty: Difficulty,

View File

@ -12,7 +12,7 @@ export class BlockAppendComponent implements OnInit {
constructor() {} constructor() {}
ngOnInit() { ngOnInit() {
console.log(this.blockdetails); //console.log(this.blockdetails);
} }
public onClickPlus(height) { public onClickPlus(height) {

View File

@ -31,7 +31,7 @@ export class BlockDetailListComponent implements OnInit {
ngOnInit() { ngOnInit() {
this.gettinglatesthashList(); this.gettinglatesthashList();
this.getBlockDetails(); this.getBlockDetails();
console.log("Enter Nginit"); //console.log("Enter Nginit");
} }

View File

@ -305,7 +305,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="col-md-6 col-lg-4 mb-4"> <div *ngIf="viewchartvar" class="col-md-6 col-lg-4 mb-4">
<div class="box_shadow"> <div class="box_shadow">
<div class="blocks"> <div class="blocks">
<h2 class="chart_heading d-inline-block">{{'home.BLOCKS_MINED' | translate}}</h2> <h2 class="chart_heading d-inline-block">{{'home.BLOCKS_MINED' | translate}}</h2>

View File

@ -173,7 +173,7 @@ export class GraphListComponent implements OnInit {
); );
}); });
} }
Transactiondoublelinechartreq(fromDate = '', ToDate = '', interval = '') { Transactiondoublelinechartreq(fromDate = '', ToDate = '', interval = '') {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let params = new HttpParams(); let params = new HttpParams();
@ -285,7 +285,7 @@ export class GraphListComponent implements OnInit {
let ProgPow = res.response.ProgPow; let ProgPow = res.response.ProgPow;
let Cuckoo = res.response.Cuckoo; let Cuckoo = res.response.Cuckoo;
let RandomX = res.response.RandomX; let RandomX = res.response.RandomX;
let ProgPowper = res.response.ProgPowper; let ProgPowper = res.response.ProgPowper;
let Cuckooper = res.response.Cuckooper; let Cuckooper = res.response.Cuckooper;
let RandomXper = res.response.RandomXper; let RandomXper = res.response.RandomXper;
@ -341,7 +341,6 @@ export class GraphListComponent implements OnInit {
.apiGetRequest(params, '/blockchain_block/supplygrowth') .apiGetRequest(params, '/blockchain_block/supplygrowth')
.subscribe( .subscribe(
res => { 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) { if (res['status'] == 200) {
let gDate = res.response.date; let gDate = res.response.date;
let gReward = res.response.total_reward_per_day; let gReward = res.response.total_reward_per_day;
@ -406,7 +405,7 @@ export class GraphListComponent implements OnInit {
let tickformat = res.response.tickFormat; let tickformat = res.response.tickFormat;
this.lg_last = this.lg_last =
TargetDifficulty[TargetDifficulty.length - 1]; TargetDifficulty[TargetDifficulty.length - 1];
switch(difftype){ switch(difftype){
case 'total': case 'total':
this.totaldifficultyChartFunc( this.totaldifficultyChartFunc(
@ -451,7 +450,7 @@ export class GraphListComponent implements OnInit {
res => { res => {
if (res['status'] == 200) { if (res['status'] == 200) {
let DifficultychartDate = res.response.Date; let DifficultychartDate = res.response.Date;
let BlocksChartDate = res.response.blockDate; let BlocksChartDate = res.response.blockDate;
let Blockval = res.response.Blocks; let Blockval = res.response.Blocks;
this.brg_last = Blockval[Blockval.length - 1]; this.brg_last = Blockval[Blockval.length - 1];
this.totalBlocksFunc(BlocksChartDate, Blockval); this.totalBlocksFunc(BlocksChartDate, Blockval);
@ -464,18 +463,18 @@ export class GraphListComponent implements OnInit {
} }
difficultyChartFunc(DifficultychartDate, TargetDifficulty, Type, range, tickformat) { difficultyChartFunc(DifficultychartDate, TargetDifficulty, Type, range, tickformat) {
console.log('range rangerangerange@@@@@@@22444',range); // console.log('range rangerangerange',range);
this.linearGraphData = { this.linearGraphData = {
data: [ data: [
{ {
x: DifficultychartDate, x: DifficultychartDate,
y: TargetDifficulty, y: TargetDifficulty,
text: TargetDifficulty, text: DifficultychartDate,
mode: 'lines+markers', mode: 'lines+markers',
type: 'scatter', type: 'scatter',
name: '', name: '',
line: { color: '#ac3333' }, line: { color: '#ac3333' },
hovertemplate: '%{x}<br> Difficulty : %{text:,}', hovertemplate: '%{text}<br> Difficulty : %{y:,}',
}, },
// { // {
// x: DifficultychartDate, // x: DifficultychartDate,
@ -741,7 +740,6 @@ export class GraphListComponent implements OnInit {
} }
growthFunc(gDate, gReward, gaddedreward) { growthFunc(gDate, gReward, gaddedreward) {
console.log('gDate gReward gaddedreward',gDate, gReward, gaddedreward)
this.growthGraphData = { this.growthGraphData = {
data: [ data: [
{ {
@ -777,7 +775,8 @@ export class GraphListComponent implements OnInit {
rangemode: 'nonnegative', rangemode: 'nonnegative',
fixedrange: true, fixedrange: true,
showgrid: true, showgrid: true,
tickformat :".0f" tickformat :".0f",
tickprefix: ' '
}, },
margin: { margin: {
l: 50, l: 50,
@ -1097,12 +1096,12 @@ export class GraphListComponent implements OnInit {
{ {
x: DifficultychartDate, x: DifficultychartDate,
y: TargetDifficulty, y: TargetDifficulty,
text: TargetDifficulty, text: DifficultychartDate,
mode: 'lines+markers', mode: 'lines+markers',
type: 'scatter', type: 'scatter',
name: '', name: '',
line: { color: '#ac3333' }, line: { color: '#ac3333' },
hovertemplate: '%{DifficultychartDate}<br> Difficulty : %{text:,}', hovertemplate: '%{text}<br> Difficulty : %{y:,}',
}, },
], ],
layout: { layout: {

View File

@ -48,6 +48,11 @@ export class LatestblocksComponent implements OnInit {
if (res['status'] == 200) { if (res['status'] == 200) {
this.pagedata = res.response; this.pagedata = res.response;
this.hashvalues = res.response.BlockchainBlockResult; this.hashvalues = res.response.BlockchainBlockResult;
if(CurrentPage == 1){
this.lastblock = res.response.BlockchainBlockResult[0].blockchain_block_height;
//console.log(this.lastblock);
}
} }
}, },
error => {}, error => {},
@ -57,9 +62,9 @@ export class LatestblocksComponent implements OnInit {
getLastCeatedBlock() { getLastCeatedBlock() {
this.chartService.getLatestblockdetails().subscribe(response => { this.chartService.getLatestblockdetails().subscribe(response => {
this.blockdetails = response; this.blockdetails = response;
console.log(this.blockdetails); //console.log(this.blockdetails);
if (this.lastblock != this.blockdetails.block_height) { if (this.lastblock != this.blockdetails.block_height) {
console.log('Create'); //console.log('Create');
this.createBlock(); this.createBlock();
} }
this.lastblock = this.blockdetails.block_height; this.lastblock = this.blockdetails.block_height;