mempool/frontend/src/app/lightning/lightning-api.service.ts

31 lines
812 B
TypeScript
Raw Normal View History

import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
const API_BASE_URL = '/lightning/api/v1';
@Injectable({
providedIn: 'root'
})
export class LightningApiService {
constructor(
private httpClient: HttpClient,
) { }
2022-04-29 03:57:27 +04:00
getNode$(publicKey: string): Observable<any> {
return this.httpClient.get<any>(API_BASE_URL + '/nodes/' + publicKey);
}
getChannelsByNodeId$(publicKey: string): Observable<any> {
return this.httpClient.get<any>(API_BASE_URL + '/channels/' + publicKey);
}
getLatestStatistics$(): Observable<any> {
return this.httpClient.get<any>(API_BASE_URL + '/statistics/latest');
}
listTopNodes$(): Observable<any> {
return this.httpClient.get<any>(API_BASE_URL + '/nodes/top');
}
}