Node and channel API
This commit is contained in:
@@ -12,6 +12,14 @@ export class LightningApiService {
|
||||
private httpClient: HttpClient,
|
||||
) { }
|
||||
|
||||
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');
|
||||
}
|
||||
|
||||
@@ -6,16 +6,20 @@ import { LightningApiService } from './lightning-api.service';
|
||||
import { NodesListComponent } from './nodes-list/nodes-list.component';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { NodeStatisticsComponent } from './node-statistics/node-statistics.component';
|
||||
import { NodeComponent } from './node/node.component';
|
||||
import { LightningRoutingModule } from './lightning.routing.module';
|
||||
@NgModule({
|
||||
declarations: [
|
||||
LightningDashboardComponent,
|
||||
NodesListComponent,
|
||||
NodeStatisticsComponent,
|
||||
NodeComponent,
|
||||
],
|
||||
imports: [
|
||||
CommonModule,
|
||||
SharedModule,
|
||||
RouterModule,
|
||||
LightningRoutingModule,
|
||||
],
|
||||
providers: [
|
||||
LightningApiService,
|
||||
|
||||
25
frontend/src/app/lightning/lightning.routing.module.ts
Normal file
25
frontend/src/app/lightning/lightning.routing.module.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
import { LightningDashboardComponent } from './lightning-dashboard/lightning-dashboard.component';
|
||||
import { NodeComponent } from './node/node.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: LightningDashboardComponent,
|
||||
},
|
||||
{
|
||||
path: 'node/:public_key',
|
||||
component: NodeComponent,
|
||||
},
|
||||
{
|
||||
path: '**',
|
||||
redirectTo: ''
|
||||
}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class LightningRoutingModule { }
|
||||
@@ -1,5 +1,15 @@
|
||||
<div class="fee-estimation-wrapper" *ngIf="statistics$ | async as statistics; else loadingReward">
|
||||
<div class="fee-estimation-container">
|
||||
<div class="item">
|
||||
<h5 class="card-title" i18n="mining.average-fee">Capacity</h5>
|
||||
<div class="card-text" i18n-ngbTooltip="mining.average-fee"
|
||||
ngbTooltip="Fee paid on average for each transaction in the past 144 blocks" placement="bottom">
|
||||
<app-amount [satoshis]="statistics.latest.total_capacity" digitsInfo="1.2-3"></app-amount>
|
||||
<span class="fiat">
|
||||
<app-change [current]="statistics.latest.total_capacity" [previous]="statistics.previous.total_capacity"></app-change>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<h5 class="card-title" i18n="mining.rewards">Nodes</h5>
|
||||
<div class="card-text" i18n-ngbTooltip="mining.rewards-desc"
|
||||
@@ -24,6 +34,7 @@
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<!--
|
||||
<div class="item">
|
||||
<h5 class="card-title" i18n="mining.average-fee">Average Channel</h5>
|
||||
<div class="card-text" i18n-ngbTooltip="mining.average-fee"
|
||||
@@ -34,6 +45,7 @@
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
1
frontend/src/app/lightning/node/node.component.html
Normal file
1
frontend/src/app/lightning/node/node.component.html
Normal file
@@ -0,0 +1 @@
|
||||
<p>node works!</p>
|
||||
0
frontend/src/app/lightning/node/node.component.scss
Normal file
0
frontend/src/app/lightning/node/node.component.scss
Normal file
29
frontend/src/app/lightning/node/node.component.ts
Normal file
29
frontend/src/app/lightning/node/node.component.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute, ParamMap } from '@angular/router';
|
||||
import { Observable } from 'rxjs';
|
||||
import { switchMap } from 'rxjs/operators';
|
||||
import { LightningApiService } from '../lightning-api.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-node',
|
||||
templateUrl: './node.component.html',
|
||||
styleUrls: ['./node.component.scss']
|
||||
})
|
||||
export class NodeComponent implements OnInit {
|
||||
node$: Observable<any>;
|
||||
|
||||
constructor(
|
||||
private lightningApiService: LightningApiService,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.node$ = this.activatedRoute.paramMap
|
||||
.pipe(
|
||||
switchMap((params: ParamMap) => {
|
||||
return this.lightningApiService.getNode$(params.get('id'));
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,7 +9,7 @@
|
||||
<tbody *ngIf="nodes$ | async as nodes; else skeleton">
|
||||
<tr *ngFor="let node of nodes; let i = index;">
|
||||
<td class="alias text-left">
|
||||
<a [routerLink]="['/lightning/nodes/:public_key' | relativeUrl, node.public]">{{ node.alias }}</a>
|
||||
<a [routerLink]="['/lightning/node' | relativeUrl, node.public_key]">{{ node.alias }}</a>
|
||||
</td>
|
||||
<td class="capacity text-right">
|
||||
<app-amount [satoshis]="node.capacity_left + node.capacity_right" digitsInfo="1.2-2"></app-amount>
|
||||
|
||||
Reference in New Issue
Block a user