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';
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
},

View File

@ -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,

View File

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

View File

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

View File

@ -305,7 +305,7 @@
</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="blocks">
<h2 class="chart_heading d-inline-block">{{'home.BLOCKS_MINED' | translate}}</h2>

View File

@ -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;
@ -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}<br> Difficulty : %{text:,}',
hovertemplate: '%{text}<br> 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}<br> Difficulty : %{text:,}',
hovertemplate: '%{text}<br> Difficulty : %{y:,}',
},
],
layout: {

View File

@ -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;