2020-07-14 14:38:52 +07:00
import { Component , OnInit } from '@angular/core' ;
import { BisqApiService } from '../bisq-api.service' ;
import { BisqStats } from '../bisq.interfaces' ;
2022-09-21 17:23:45 +02:00
import { SeoService } from '../../services/seo.service' ;
import { StateService } from '../../services/state.service' ;
import { WebsocketService } from '../../services/websocket.service' ;
2020-07-14 14:38:52 +07:00
@Component ( {
selector : 'app-bisq-stats' ,
templateUrl : './bisq-stats.component.html' ,
styleUrls : [ './bisq-stats.component.scss' ]
} )
export class BisqStatsComponent implements OnInit {
isLoading = true ;
stats : BisqStats ;
2020-07-14 21:26:02 +07:00
price : number ;
2020-07-14 14:38:52 +07:00
constructor (
2021-03-05 15:38:46 +07:00
private websocketService : WebsocketService ,
2020-07-14 14:38:52 +07:00
private bisqApiService : BisqApiService ,
private seoService : SeoService ,
2020-07-14 21:26:02 +07:00
private stateService : StateService ,
2020-07-14 14:38:52 +07:00
) { }
2020-07-14 21:26:02 +07:00
ngOnInit() {
2021-03-05 15:38:46 +07:00
this . websocketService . want ( [ 'blocks' ] ) ;
2020-12-03 18:34:19 +07:00
this . seoService . setTitle ( $localize ` :@@2a30a4cdb123a03facc5ab8c5b3e6d8b8dbbc3d4:BSQ statistics ` ) ;
2023-08-28 13:10:08 +09:00
this . seoService . setDescription ( $localize ` :@@meta.description.bisq.stats:See high-level stats on the BSQ economy: supply metrics, number of addresses, BSQ price, market cap, and more. ` ) ;
2020-07-14 21:26:02 +07:00
this . stateService . bsqPrice $
. subscribe ( ( bsqPrice ) = > {
this . price = bsqPrice ;
} ) ;
2020-07-14 14:38:52 +07:00
this . bisqApiService . getStats $ ( )
. subscribe ( ( stats ) = > {
this . isLoading = false ;
this . stats = stats ;
} ) ;
}
}