Add previous adjustment retarget. (#655)

* Add previous adjustment retarget.

* Fix green color.
Add + symbol to difficulty change.

* Add previousRetarget to websocket.

* Add previous retarget.
This commit is contained in:
Miguel Medeiros
2021-07-24 19:26:48 -03:00
committed by GitHub
parent f6a889298c
commit cd8e308870
6 changed files with 29 additions and 15 deletions

View File

@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { HttpClient, HttpParams } from '@angular/common/http';
import { CpfpInfo, OptimizedMempoolStats } from '../interfaces/node-api.interface';
import { CpfpInfo, OptimizedMempoolStats, DifficultyAdjustment } from '../interfaces/node-api.interface';
import { Observable } from 'rxjs';
import { StateService } from './state.service';
import { WebsocketResponse } from '../interfaces/websocket.interface';
@@ -92,4 +92,8 @@ export class ApiService {
getCpfpinfo$(txid: string): Observable<CpfpInfo> {
return this.httpClient.get<CpfpInfo>(this.apiBaseUrl + this.apiBasePath + '/api/v1/cpfp/' + txid);
}
getDifficultyAdjustment$(): Observable<DifficultyAdjustment> {
return this.httpClient.get<DifficultyAdjustment>(this.apiBaseUrl + this.apiBasePath + '/api/v1/difficulty-adjustment');
}
}

View File

@@ -71,6 +71,7 @@ export class StateService {
isLoadingWebSocket$ = new ReplaySubject<boolean>(1);
vbytesPerSecond$ = new ReplaySubject<number>(1);
lastDifficultyAdjustment$ = new ReplaySubject<number>(1);
previousRetarget$ = new ReplaySubject<number>(1);
backendInfo$ = new ReplaySubject<IBackendInfo>(1);
loadingIndicators$ = new ReplaySubject<ILoadingIndicators>(1);

View File

@@ -47,7 +47,7 @@ export class WebsocketService {
this.network = this.stateService.network === 'bisq' && !this.stateService.env.BISQ_SEPARATE_BACKEND ? '' : this.stateService.network;
this.websocketSubject = webSocket<WebsocketResponse>(this.webSocketUrl.replace('{network}', this.network ? '/' + this.network : ''));
const theInitData = this.transferState.get(initData, null);
const theInitData = this.transferState.get<any>(initData, null);
if (theInitData) {
this.handleResponse(theInitData.body);
this.startSubscription(false, true);
@@ -290,6 +290,10 @@ export class WebsocketService {
this.stateService.lastDifficultyAdjustment$.next(response.lastDifficultyAdjustment);
}
if (response.previousRetarget !== undefined) {
this.stateService.previousRetarget$.next(response.previousRetarget);
}
if (response['git-commit']) {
this.stateService.backendInfo$.next(response['git-commit']);
}