epicmine functionality and integration
This commit is contained in:
parent
6547d1a12b
commit
3573b8a8d8
@ -265,6 +265,12 @@ export class BlockchainBlockController {
|
||||
this.get51poolapi,
|
||||
);
|
||||
|
||||
this.router.get(
|
||||
`${this.path}/getepicmineapi`,
|
||||
redisMiddleware(process.env.REDIS_EXPIRY),
|
||||
this.getepicmineapi,
|
||||
);
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /epic_explorer/v1/blockchain_block/blockcount:
|
||||
@ -729,6 +735,30 @@ export class BlockchainBlockController {
|
||||
}
|
||||
};
|
||||
|
||||
// get epicmine
|
||||
private getepicmineapi = ( request: Request,res: Response) => {
|
||||
var axios = require('axios');
|
||||
try {
|
||||
var config = {
|
||||
method: 'get',
|
||||
url: 'https://api.epicmine.io/pool/getstats',
|
||||
headers: { }
|
||||
};
|
||||
axios(config).then(function (response) {
|
||||
res.status(200).json({
|
||||
status: 200,
|
||||
response: response.data
|
||||
});
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('axios-error');
|
||||
console.log(error);
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
|
||||
private BlockchainBlockCreate = async (
|
||||
request: Request,
|
||||
response: Response,
|
||||
|
@ -7,10 +7,11 @@
|
||||
<div class="row" *ngIf="pool51_currentHeight">
|
||||
<div class="col-12 drawline">
|
||||
<p class="block_heading mb-1">Mining Pool
|
||||
<select class="langbut py-2 pr-4 pl-2 miningpoolborder">
|
||||
<option value="Testnet" selected> 51pool </option>
|
||||
<select class="langbut py-2 pr-4 pl-2 miningpoolborder" (change)="onMineChange($event)">
|
||||
<option value="51pool" selected> 51pool </option>
|
||||
<option value="epicmine"> epicmine </option>
|
||||
</select>
|
||||
<a href="https://51pool.online/" class="text-white pl-3" target="_blank">
|
||||
<a [href]="poolUrl" class="text-white pl-3" target="_blank">
|
||||
<i class="fa fa-link goldcolortxt"></i>
|
||||
</a>
|
||||
</p>
|
||||
|
@ -22,6 +22,10 @@ export class LatestblocksComponent implements OnInit {
|
||||
public CurrentpageNumber: Number;
|
||||
public FirstPageListData: any = [];
|
||||
public DifferentList: any = [];
|
||||
public pool_epicmine: any = {};
|
||||
public pool_51pool: any = {};
|
||||
public poolUrl: string = 'https://51pool.online';
|
||||
public selectedpool = "51pool";
|
||||
public blockAppend: any;
|
||||
public blockdetails: any;
|
||||
public zibra_color = "zibra_white";
|
||||
@ -58,12 +62,17 @@ export class LatestblocksComponent implements OnInit {
|
||||
this.gettinghashList(1, 10, this.first);
|
||||
// this.getLastCeatedBlock();
|
||||
this.get51poolAPI();
|
||||
this.getepicmineAPI();
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.apiBlockInterval = setInterval(() => {
|
||||
console.log('getLastCeatedBlock called');
|
||||
this.get51poolAPI();
|
||||
// console.log('getLastCeatedBlock called');
|
||||
if(this.selectedpool == 'epicmine'){
|
||||
this.getepicmineAPI();
|
||||
}else{
|
||||
this.get51poolAPI();
|
||||
}
|
||||
// let current_page = localStorage.getItem('CurrentPage');
|
||||
// let page_size = localStorage.getItem('PageSize');
|
||||
let current_page = this.CurrentPage;
|
||||
@ -80,16 +89,43 @@ export class LatestblocksComponent implements OnInit {
|
||||
clearInterval(this.apiBlockInterval);
|
||||
}
|
||||
|
||||
onMineChange(event: Event): void {
|
||||
const selectedValue = (event.target as HTMLSelectElement).value;
|
||||
// console.log('Selected Value:', selectedValue);
|
||||
if(selectedValue == 'epicmine'){
|
||||
this.pool51_hashrateCuckoo = this.pool_epicmine.poolStats.hashrateCuckoo;
|
||||
this.pool51_hashrateProgPow = this.pool_epicmine.poolStats.hashrateProgPow;
|
||||
this.pool51_hashrateRandomX = this.pool_epicmine.poolStats.hashrateRandomX;
|
||||
this.pool51_onlineCuckoo = this.pool_epicmine.poolStats.onlineCuckoo;
|
||||
this.pool51_onlineProgPow = this.pool_epicmine.poolStats.onlineProgPow;
|
||||
this.pool51_onlineRandomX = this.pool_epicmine.poolStats.onlineRandomX;
|
||||
this.pool51_currentHeight = this.pool_epicmine.poolStats.currentHeight;
|
||||
this.poolUrl = 'https://epicmine.io/';
|
||||
this.selectedpool = 'epicmine';
|
||||
}else if(selectedValue == '51pool'){
|
||||
this.pool51_hashrateCuckoo = this.pool_51pool.hashrateCuckoo;
|
||||
this.pool51_hashrateProgPow = this.pool_51pool.hashrateProgPow;
|
||||
this.pool51_hashrateRandomX = this.pool_51pool.hashrateRandomX;
|
||||
this.pool51_onlineCuckoo = this.pool_51pool.onlineCuckoo;
|
||||
this.pool51_onlineProgPow = this.pool_51pool.onlineProgPow;
|
||||
this.pool51_onlineRandomX = this.pool_51pool.onlineRandomX;
|
||||
this.pool51_currentHeight = this.pool_51pool.currentHeight;
|
||||
this.poolUrl = 'https://51pool.online';
|
||||
this.selectedpool = '51pool';
|
||||
}
|
||||
}
|
||||
|
||||
public get51poolAPI() {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
this.chartService.apiGetRequest('','/blockchain_block/get51poolapi').subscribe(
|
||||
res => {
|
||||
// console.log('get51poolAPI');
|
||||
console.log(res);
|
||||
// console.log(res);
|
||||
if (res['status'] == 200) {
|
||||
let json = res.response;
|
||||
// console.log(json.data);
|
||||
let poolStats = json.data.poolStats;
|
||||
this.pool_51pool = poolStats;
|
||||
this.pool51_hashrateCuckoo = poolStats.hashrateCuckoo;
|
||||
this.pool51_hashrateProgPow = poolStats.hashrateProgPow;
|
||||
this.pool51_hashrateRandomX = poolStats.hashrateRandomX;
|
||||
@ -104,6 +140,29 @@ export class LatestblocksComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
public getepicmineAPI() {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
this.chartService.apiGetRequest('','/blockchain_block/getepicmineapi').subscribe(
|
||||
res => {
|
||||
if (res['status'] == 200) {
|
||||
let json = res.response;
|
||||
this.pool_epicmine = json;
|
||||
if(this.selectedpool == 'epicmine'){
|
||||
this.pool51_hashrateCuckoo = this.pool_epicmine.poolStats.hashrateCuckoo;
|
||||
this.pool51_hashrateProgPow = this.pool_epicmine.poolStats.hashrateProgPow;
|
||||
this.pool51_hashrateRandomX = this.pool_epicmine.poolStats.hashrateRandomX;
|
||||
this.pool51_onlineCuckoo = this.pool_epicmine.poolStats.onlineCuckoo;
|
||||
this.pool51_onlineProgPow = this.pool_epicmine.poolStats.onlineProgPow;
|
||||
this.pool51_onlineRandomX = this.pool_epicmine.poolStats.onlineRandomX;
|
||||
this.pool51_currentHeight = this.pool_epicmine.poolStats.currentHeight;
|
||||
}
|
||||
}
|
||||
},
|
||||
error => {},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
public gettinghashListFunc(currentPage,pagesize){
|
||||
this.hashvalues = "";
|
||||
this.gettinghashList(
|
||||
@ -113,7 +172,7 @@ export class LatestblocksComponent implements OnInit {
|
||||
}
|
||||
|
||||
public gettinghashList(CurrentPage, PageSize, first = false) {
|
||||
console.log(CurrentPage, PageSize,this.first);
|
||||
// console.log(CurrentPage, PageSize,this.first);
|
||||
this.CurrentPage = CurrentPage;
|
||||
this.PageSize = PageSize;
|
||||
// localStorage.setItem('CurrentPage',CurrentPage);
|
||||
@ -127,7 +186,7 @@ export class LatestblocksComponent implements OnInit {
|
||||
if (res['status'] == 200) {
|
||||
this.pagedata = res.response;
|
||||
if(this.first){
|
||||
console.log('init gettinghashList');
|
||||
// console.log('init gettinghashList');
|
||||
res.response.BlockchainBlockResult.shift();
|
||||
this.currentBlockHeight = res.response.BlockchainBlockResult[0].blockchain_block_height;
|
||||
this.first = false;
|
||||
|
Loading…
Reference in New Issue
Block a user