2019-07-21 17:59:47 +03:00
|
|
|
import { Injectable } from '@angular/core';
|
2020-02-16 22:15:07 +07:00
|
|
|
import { HttpClient } from '@angular/common/http';
|
|
|
|
import { MempoolStats, BlockTransaction } from '../interfaces/node-api.interface';
|
2019-07-21 17:59:47 +03:00
|
|
|
import { Observable } from 'rxjs';
|
|
|
|
|
2019-07-21 18:35:58 +03:00
|
|
|
const API_BASE_URL = '/api/v1';
|
2019-07-21 17:59:47 +03:00
|
|
|
|
|
|
|
@Injectable({
|
|
|
|
providedIn: 'root'
|
|
|
|
})
|
|
|
|
export class ApiService {
|
|
|
|
constructor(
|
|
|
|
private httpClient: HttpClient,
|
2020-02-16 22:15:07 +07:00
|
|
|
) { }
|
2019-11-06 15:35:02 +08:00
|
|
|
|
2020-02-16 22:15:07 +07:00
|
|
|
list2HStatistics$(): Observable<MempoolStats[]> {
|
|
|
|
return this.httpClient.get<MempoolStats[]>(API_BASE_URL + '/statistics/2h');
|
2019-11-12 16:39:59 +08:00
|
|
|
}
|
|
|
|
|
2020-02-16 22:15:07 +07:00
|
|
|
list24HStatistics$(): Observable<MempoolStats[]> {
|
|
|
|
return this.httpClient.get<MempoolStats[]>(API_BASE_URL + '/statistics/24h');
|
2019-11-12 16:39:59 +08:00
|
|
|
}
|
|
|
|
|
2020-02-16 22:15:07 +07:00
|
|
|
list1WStatistics$(): Observable<MempoolStats[]> {
|
|
|
|
return this.httpClient.get<MempoolStats[]>(API_BASE_URL + '/statistics/1w');
|
2019-11-10 16:44:00 +08:00
|
|
|
}
|
2019-11-13 14:51:44 +08:00
|
|
|
|
2020-02-16 22:15:07 +07:00
|
|
|
list1MStatistics$(): Observable<MempoolStats[]> {
|
|
|
|
return this.httpClient.get<MempoolStats[]>(API_BASE_URL + '/statistics/1m');
|
2019-11-13 14:51:44 +08:00
|
|
|
}
|
|
|
|
|
2020-02-16 22:15:07 +07:00
|
|
|
list3MStatistics$(): Observable<MempoolStats[]> {
|
|
|
|
return this.httpClient.get<MempoolStats[]>(API_BASE_URL + '/statistics/3m');
|
2019-11-13 14:51:44 +08:00
|
|
|
}
|
|
|
|
|
2020-02-16 22:15:07 +07:00
|
|
|
list6MStatistics$(): Observable<MempoolStats[]> {
|
|
|
|
return this.httpClient.get<MempoolStats[]>(API_BASE_URL + '/statistics/6m');
|
2019-11-13 14:51:44 +08:00
|
|
|
}
|
2019-07-21 17:59:47 +03:00
|
|
|
}
|