Merge pull request #2510 from mempool/nymkappa/feature/zero-base-fee-tag

Show zero base fee tag on channels
This commit is contained in:
softsimon 2022-09-22 18:10:41 +02:00 committed by GitHub
commit ab2adc48a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 65 additions and 38 deletions

View File

@ -11,44 +11,64 @@
<div class="second-line"><app-amount [satoshis]="channel.capacity" digitsInfo="1.2-2"></app-amount></div>
</div>
</div>
<div class="box">
<div class="col-md">
<table class="table table-borderless table-striped">
<tbody>
<tr>
<td i18n="address.total-sent">Fee rate</td>
<td>
{{ channel.fee_rate ?? '-' }} <span class="symbol">ppm ({{ channel.fee_rate / 10000 | number }}%)</span>
</td>
</tr>
<tr>
<td i18n="address.total-sent">Base fee</td>
<td>
<app-sats [valueOverride]="!channel.base_fee_mtokens ? '- ' : undefined" [satoshis]="channel.base_fee_mtokens / 1000" digitsInfo="1.0-2"></app-sats>
</td>
</tr>
<tr>
<td i18n="address.total-sent">Min HTLC</td>
<td>
<app-sats [valueOverride]="!channel.min_htlc_mtokens ? '- ' : undefined" [satoshis]="channel.min_htlc_mtokens / 1000"></app-sats>
</td>
</tr>
<tr>
<td i18n="address.total-sent">Max HTLC</td>
<td>
<app-sats [valueOverride]="!channel.max_htlc_mtokens ? '- ' : undefined" [satoshis]="channel.max_htlc_mtokens / 1000"></app-sats>
</td>
</tr>
<tr>
<td i18n="address.total-sent">Timelock delta</td>
<td>
<ng-container *ngTemplateOutlet="blocksPlural; context: {$implicit: channel.cltv_delta ?? '-' }"></ng-container>
</td>
</tr>
</tbody>
</table>
</div>
<div class="box">
<table class="table table-borderless table-striped">
<tbody>
<tr>
<td i18n="lightning.fee-rate">Fee rate</td>
<td>
<span class="d-inline-block d-md-none">
{{ channel.fee_rate !== null ? (channel.fee_rate | amountShortener : 2 : undefined : true) : '-' }} <span class="symbol">ppm {{ channel.fee_rate !== null ? '(' + (channel.fee_rate / 10000 | amountShortener : 2 : undefined : true) + '%)' : '' }}</span>
</span>
<span class="d-none d-md-inline-block">
{{ channel.fee_rate !== null ? (channel.fee_rate | number) : '-' }} <span class="symbol">ppm {{ channel.fee_rate !== null ? '(' + (channel.fee_rate / 10000 | number) + '%)' : '' }}</span>
</span>
</td>
</tr>
<tr>
<td i18n="lightning.base-fee">Base fee</td>
<td class="base-fee">
<span class="d-flex justify-content-between align-items-center">
<span>
<span *ngIf="channel.base_fee_mtokens !== null">
{{ channel.base_fee_mtokens | amountShortener : 0 }}
<span class="symbol">msats</span>
</span>
<span *ngIf="channel.base_fee_mtokens === null">
-
</span>
</span>
<span *ngIf="channel.base_fee_mtokens !== null" class="badge" [class]="channel.base_fee_mtokens === 0 ? 'badge-success' : 'badge-danger'"
i18n-ngbTooltip="lightning.zero-base-fee"
[ngbTooltip]="channel.base_fee_mtokens === 0 ? 'This channel supports zero base fee routing' :
'This channel does not support zero base fee routing'"
placement="bottom" i18n="lightning.zerobasefee">
{{ channel.base_fee_mtokens === 0 ? 'Zero base fee' : 'Non-zero base fee' }}
</span>
</span>
</td>
</tr>
<tr>
<td i18n="lightning.min-htlc">Min HTLC</td>
<td>
<app-sats [valueOverride]="channel.min_htlc_mtokens === null ? '- ' : undefined" [satoshis]="channel.min_htlc_mtokens / 1000"></app-sats>
</td>
</tr>
<tr>
<td i18n="lightning.max-htlc">Max HTLC</td>
<td>
<app-sats [valueOverride]="channel.max_htlc_mtokens === null ? '- ' : undefined" [satoshis]="channel.max_htlc_mtokens / 1000"></app-sats>
</td>
</tr>
<tr>
<td i18n="lightning.timelock-detla">Timelock delta</td>
<td>
<ng-container *ngTemplateOutlet="blocksPlural; context: {$implicit: channel.cltv_delta ?? '-' }"></ng-container>
</td>
</tr>
</tbody>
</table>
</div>
<ng-template #blocksPlural let-i i18n="shared.blocks">{{ i }} <span class="shared-block">blocks</span></ng-template>

View File

@ -21,4 +21,10 @@
.box {
margin-bottom: 20px;
}
}
.base-fee {
@media (max-width: 768px) {
padding-right: 0px;
}
}

View File

@ -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' }