Add fee rate display component

This commit is contained in:
Mononaut
2023-06-15 15:16:49 -04:00
parent a45f1fde1c
commit c29558db20
6 changed files with 39 additions and 2 deletions

View File

@@ -0,0 +1,4 @@
<ng-container *ngIf="rateUnits$ | async as units">
<ng-container *ngIf="units !== 'wu'">{{ fee / (weight / 4) | feeRounding:rounding }} <span *ngIf="showUnit" [class]="unitClass">sat/vB</span></ng-container>
<ng-container *ngIf="units === 'wu'">{{ fee / weight | feeRounding:rounding }} <span *ngIf="showUnit" [class]="unitClass">sat/WU</span></ng-container>
</ng-container>

View File

@@ -0,0 +1,26 @@
import { Component, Input, OnInit } from '@angular/core';
import { Observable } from 'rxjs';
import { StateService } from '../../../services/state.service';
@Component({
selector: 'app-fee-rate',
templateUrl: './fee-rate.component.html',
styleUrls: ['./fee-rate.component.scss']
})
export class FeeRateComponent implements OnInit {
@Input() fee: number;
@Input() weight: number = 4;
@Input() rounding: string = null;
@Input() showUnit: boolean = true;
@Input() unitClass: string = 'symbol';
rateUnits$: Observable<string>;
constructor(
private stateService: StateService,
) { }
ngOnInit() {
this.rateUnits$ = this.stateService.rateUnits$;
}
}