diff --git a/frontend/src/app/lightning/lightning.module.ts b/frontend/src/app/lightning/lightning.module.ts
index 0b824ad78..f0154a15f 100644
--- a/frontend/src/app/lightning/lightning.module.ts
+++ b/frontend/src/app/lightning/lightning.module.ts
@@ -34,6 +34,7 @@ import { OldestNodes } from '../lightning/nodes-ranking/oldest-nodes/oldest-node
import { NodesRankingsDashboard } from '../lightning/nodes-rankings-dashboard/nodes-rankings-dashboard.component';
import { NodeChannels } from '../lightning/nodes-channels/node-channels.component';
import { GroupComponent } from './group/group.component';
+import { NodeOwnerComponent } from './node-owner/node-owner.component';
@NgModule({
declarations: [
@@ -66,6 +67,7 @@ import { GroupComponent } from './group/group.component';
NodesRankingsDashboard,
NodeChannels,
GroupComponent,
+ NodeOwnerComponent,
],
imports: [
CommonModule,
@@ -103,6 +105,7 @@ import { GroupComponent } from './group/group.component';
OldestNodes,
NodesRankingsDashboard,
NodeChannels,
+ NodeOwnerComponent,
],
providers: [
LightningApiService,
diff --git a/frontend/src/app/lightning/node-owner/node-owner.component.html b/frontend/src/app/lightning/node-owner/node-owner.component.html
new file mode 100644
index 000000000..e37b1e027
--- /dev/null
+++ b/frontend/src/app/lightning/node-owner/node-owner.component.html
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/frontend/src/app/lightning/node-owner/node-owner.component.scss b/frontend/src/app/lightning/node-owner/node-owner.component.scss
new file mode 100644
index 000000000..6734168cf
--- /dev/null
+++ b/frontend/src/app/lightning/node-owner/node-owner.component.scss
@@ -0,0 +1,4 @@
+.profile-photo {
+ width: 31px;
+ height: 31px;
+}
\ No newline at end of file
diff --git a/frontend/src/app/lightning/node-owner/node-owner.component.ts b/frontend/src/app/lightning/node-owner/node-owner.component.ts
new file mode 100644
index 000000000..a03c04901
--- /dev/null
+++ b/frontend/src/app/lightning/node-owner/node-owner.component.ts
@@ -0,0 +1,20 @@
+import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
+import { Observable } from 'rxjs';
+import { StateService } from '../../services/state.service';
+
+@Component({
+ selector: 'app-node-owner',
+ templateUrl: './node-owner.component.html',
+ styleUrls: ['./node-owner.component.scss'],
+ changeDetection: ChangeDetectionStrategy.OnPush,
+})
+export class NodeOwnerComponent{
+ @Input() publicKey: string = '';
+ @Input() alias: string = '';
+ @Input() nodeOwner$: Observable
;
+
+ constructor(
+ public stateService: StateService
+ ) {
+ }
+}
diff --git a/frontend/src/app/lightning/node/node.component.html b/frontend/src/app/lightning/node/node.component.html
index c6c693a3a..11ddbc0eb 100644
--- a/frontend/src/app/lightning/node/node.component.html
+++ b/frontend/src/app/lightning/node/node.component.html
@@ -3,13 +3,17 @@
Lightning node
-
{{ node.alias }}
-
+
+
{{ node.alias }}
+
+
+
+
diff --git a/frontend/src/app/lightning/node/node.component.scss b/frontend/src/app/lightning/node/node.component.scss
index 272de4b09..117fc8a2c 100644
--- a/frontend/src/app/lightning/node/node.component.scss
+++ b/frontend/src/app/lightning/node/node.component.scss
@@ -111,3 +111,17 @@ app-fiat {
margin: 0 0.25em;
color: slategrey;
}
+
+.claim-btn {
+ max-height: 32px;
+ @media (min-width: 850px) {
+ display: none;
+ }
+}
+
+.claim-btn-mobile {
+ max-height: 32px;
+ @media (max-width: 850px) {
+ display: none;
+ }
+}
\ No newline at end of file
diff --git a/frontend/src/app/lightning/node/node.component.ts b/frontend/src/app/lightning/node/node.component.ts
index 719136d79..6447eb6bd 100644
--- a/frontend/src/app/lightning/node/node.component.ts
+++ b/frontend/src/app/lightning/node/node.component.ts
@@ -1,7 +1,7 @@
-import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
+import { ChangeDetectionStrategy, Component, OnInit, ChangeDetectorRef } from '@angular/core';
import { ActivatedRoute, ParamMap } from '@angular/router';
-import { Observable } from 'rxjs';
-import { catchError, map, switchMap, tap } from 'rxjs/operators';
+import { Observable, of, EMPTY } from 'rxjs';
+import { catchError, map, switchMap, tap, share } from 'rxjs/operators';
import { SeoService } from '../../services/seo.service';
import { ApiService } from '../../services/api.service';
import { LightningApiService } from '../lightning-api.service';
@@ -38,6 +38,7 @@ export class NodeComponent implements OnInit {
tlvRecords: CustomRecord[];
avgChannelDistance$: Observable;
showFeatures = false;
+ nodeOwner$: Observable;
kmToMiles = kmToMiles;
constructor(
@@ -45,6 +46,7 @@ export class NodeComponent implements OnInit {
private lightningApiService: LightningApiService,
private activatedRoute: ActivatedRoute,
private seoService: SeoService,
+ private cd: ChangeDetectorRef,
) { }
ngOnInit(): void {
@@ -147,6 +149,24 @@ export class NodeComponent implements OnInit {
return null;
})
) as Observable;
+
+ this.nodeOwner$ = this.activatedRoute.paramMap
+ .pipe(
+ switchMap((params: ParamMap) => {
+ return this.apiService.getNodeOwner$(params.get('public_key')).pipe(
+ switchMap((response) => {
+ if (response.status === 204) {
+ return of(false);
+ }
+ return of(response.body);
+ }),
+ catchError(() => {
+ return of(false);
+ })
+ )
+ }),
+ share(),
+ );
}
toggleShowDetails(): void {
diff --git a/frontend/src/app/services/api.service.ts b/frontend/src/app/services/api.service.ts
index 24dbe734a..1ed9d2f5c 100644
--- a/frontend/src/app/services/api.service.ts
+++ b/frontend/src/app/services/api.service.ts
@@ -8,6 +8,8 @@ import { WebsocketResponse } from '../interfaces/websocket.interface';
import { Outspend, Transaction } from '../interfaces/electrs.interface';
import { Conversion } from './price.service';
+const SERVICES_API_PREFIX = `/api/v1/services`;
+
@Injectable({
providedIn: 'root'
})
@@ -315,4 +317,13 @@ export class ApiService {
(timestamp ? `?timestamp=${timestamp}` : '')
);
}
+
+ /**
+ * Services
+ */
+ getNodeOwner$(publicKey: string) {
+ let params = new HttpParams()
+ .set('node_public_key', publicKey);
+ return this.httpClient.get(`${SERVICES_API_PREFIX}/lightning/claim/current`, { params, observe: 'response' });
+ }
}