From aa1519c18eb06c0917fefb84940583126a3cf37c Mon Sep 17 00:00:00 2001 From: nymkappa Date: Thu, 8 Sep 2022 18:56:25 +0200 Subject: [PATCH 01/28] Show zero base fee tag on channels --- .../channel-box/channel-box.component.html | 103 +++++++++++------- .../app/shared/pipes/amount-shortener.pipe.ts | 3 +- 2 files changed, 68 insertions(+), 38 deletions(-) diff --git a/frontend/src/app/lightning/channel/channel-box/channel-box.component.html b/frontend/src/app/lightning/channel/channel-box/channel-box.component.html index 8b486eff5..4a421480d 100644 --- a/frontend/src/app/lightning/channel/channel-box/channel-box.component.html +++ b/frontend/src/app/lightning/channel/channel-box/channel-box.component.html @@ -11,44 +11,73 @@
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
Fee rate - {{ channel.fee_rate ?? '-' }} ppm ({{ channel.fee_rate / 10000 | number }}%) -
Base fee - -
Min HTLC - -
Max HTLC - -
Timelock delta - -
-
+
+ + + + + + + + + + + + + + + + + + + + + + + +
Fee rate + + {{ channel.fee_rate !== null ? (channel.fee_rate | amountShortener : 2 : undefined : true) : '-' }} ppm ({{ channel.fee_rate !== null ? '(' + (channel.fee_rate / 10000 | amountShortener : 2 : undefined : true) + '%)' : '' }} + + + {{ channel.fee_rate !== null ? (channel.fee_rate | number) : '-' }} ppm {{ channel.fee_rate !== null ? '(' + (channel.fee_rate / 10000 | number) + '%)' : '' }} + +
Base fee +
+ + + {{ channel.base_fee_mtokens !== null ? (channel.base_fee_mtokens / 1000 | amountShortener : 2 : undefined : true) : '-' }} + sats + + + Zero base fee + + +
+
+ + + + Zero base fee + + +
+
Min HTLC + +
Max HTLC + +
Timelock delta + +
{{ i }} blocks diff --git a/frontend/src/app/shared/pipes/amount-shortener.pipe.ts b/frontend/src/app/shared/pipes/amount-shortener.pipe.ts index db3d94284..71ff76f77 100644 --- a/frontend/src/app/shared/pipes/amount-shortener.pipe.ts +++ b/frontend/src/app/shared/pipes/amount-shortener.pipe.ts @@ -7,6 +7,7 @@ export class AmountShortenerPipe implements PipeTransform { transform(num: number, ...args: any[]): unknown { const digits = args[0] ?? 1; const unit = args[1] || undefined; + const isMoney = args[2] || false; if (num < 1000) { return num.toFixed(digits); @@ -16,7 +17,7 @@ export class AmountShortenerPipe implements PipeTransform { { value: 1, symbol: '' }, { value: 1e3, symbol: 'k' }, { value: 1e6, symbol: 'M' }, - { value: 1e9, symbol: 'G' }, + { value: 1e9, symbol: isMoney ? 'B' : 'G' }, { value: 1e12, symbol: 'T' }, { value: 1e15, symbol: 'P' }, { value: 1e18, symbol: 'E' } From b6296fcbeb7780be963ad4acd7b10cb5080bbdbd Mon Sep 17 00:00:00 2001 From: softsimon Date: Mon, 12 Sep 2022 19:20:22 +0200 Subject: [PATCH 02/28] Suggest block height in search result --- .../search-form/search-form.component.html | 2 +- .../search-form/search-form.component.ts | 18 ++++++++++++----- .../search-results.component.html | 20 ++++++++++++------- .../search-results.component.ts | 9 +++++---- 4 files changed, 32 insertions(+), 17 deletions(-) diff --git a/frontend/src/app/components/search-form/search-form.component.html b/frontend/src/app/components/search-form/search-form.component.html index 8badcc3cf..f8cb05d1c 100644 --- a/frontend/src/app/components/search-form/search-form.component.html +++ b/frontend/src/app/components/search-form/search-form.component.html @@ -3,7 +3,7 @@
- +
diff --git a/frontend/src/app/components/search-form/search-form.component.ts b/frontend/src/app/components/search-form/search-form.component.ts index 712f7438c..abddc3b6e 100644 --- a/frontend/src/app/components/search-form/search-form.component.ts +++ b/frontend/src/app/components/search-form/search-form.component.ts @@ -74,6 +74,7 @@ export class SearchFormComponent implements OnInit { switchMap((text) => { if (!text.length) { return of([ + '', [], { nodes: [], @@ -84,11 +85,14 @@ export class SearchFormComponent implements OnInit { this.isTypeaheading$.next(true); if (!this.stateService.env.LIGHTNING) { return zip( + of(text), this.electrsApiService.getAddressesByPrefix$(text).pipe(catchError(() => of([]))), - [{ nodes: [], channels: [] }] + [{ nodes: [], channels: [] }], + of(this.regexBlockheight.test(text)), ); } return zip( + of(text), this.electrsApiService.getAddressesByPrefix$(text).pipe(catchError(() => of([]))), this.apiService.lightningSearch$(text).pipe(catchError(() => of({ nodes: [], @@ -102,10 +106,12 @@ export class SearchFormComponent implements OnInit { return result[0].map((address: string) => 'B' + address); } return { - addresses: result[0], - nodes: result[1].nodes, - channels: result[1].channels, - totalResults: result[0].length + result[1].nodes.length + result[1].channels.length, + searchText: result[0], + blockHeight: this.regexBlockheight.test(result[0]) ? [parseInt(result[0], 10)] : [], + addresses: result[1], + nodes: result[2].nodes, + channels: result[2].channels, + totalResults: result[1].length + result[2].nodes.length + result[2].channels.length, }; }) ); @@ -121,6 +127,8 @@ export class SearchFormComponent implements OnInit { selectedResult(result: any) { if (typeof result === 'string') { this.search(result); + } else if (typeof result === 'number') { + this.navigate('/block/', result.toString()); } else if (result.alias) { this.navigate('/lightning/node/', result.public_key); } else if (result.short_id) { diff --git a/frontend/src/app/components/search-form/search-results/search-results.component.html b/frontend/src/app/components/search-form/search-results/search-results.component.html index cc289ddac..9ed829aff 100644 --- a/frontend/src/app/components/search-form/search-results/search-results.component.html +++ b/frontend/src/app/components/search-form/search-results/search-results.component.html @@ -1,25 +1,31 @@ -