From 71f73835da09b96dd5b170b0e2eb07e5ef711dfa Mon Sep 17 00:00:00 2001 From: natsee Date: Sun, 28 Jan 2024 21:46:31 +0100 Subject: [PATCH] Liquid Federation: filter out change UTXOs from table --- .../federation-utxos-list.component.html | 16 +++++++++++--- .../federation-utxos-list.component.ts | 22 +++++++++++++++++-- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/frontend/src/app/components/liquid-reserves-audit/federation-utxos-list/federation-utxos-list.component.html b/frontend/src/app/components/liquid-reserves-audit/federation-utxos-list/federation-utxos-list.component.html index cfeb8e245..a7f548ffd 100644 --- a/frontend/src/app/components/liquid-reserves-audit/federation-utxos-list/federation-utxos-list.component.html +++ b/frontend/src/app/components/liquid-reserves-audit/federation-utxos-list/federation-utxos-list.component.html @@ -1,8 +1,18 @@
+ +
+
+ + +
+
+
- +
@@ -12,7 +22,7 @@ - +
Liquid Peg-in Date
@@ -96,7 +106,7 @@
- diff --git a/frontend/src/app/components/liquid-reserves-audit/federation-utxos-list/federation-utxos-list.component.ts b/frontend/src/app/components/liquid-reserves-audit/federation-utxos-list/federation-utxos-list.component.ts index 470862c67..92b09175c 100644 --- a/frontend/src/app/components/liquid-reserves-audit/federation-utxos-list/federation-utxos-list.component.ts +++ b/frontend/src/app/components/liquid-reserves-audit/federation-utxos-list/federation-utxos-list.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit, ChangeDetectionStrategy, Input } from '@angular/core'; -import { Observable, Subject, combineLatest, of, timer } from 'rxjs'; +import { BehaviorSubject, Observable, Subject, combineLatest, of, timer } from 'rxjs'; import { delayWhen, filter, map, share, shareReplay, switchMap, takeUntil, tap, throttleTime } from 'rxjs/operators'; import { ApiService } from '../../../services/api.service'; import { Env, StateService } from '../../../services/state.service'; @@ -22,8 +22,12 @@ export class FederationUtxosListComponent implements OnInit { pageSize = 15; maxSize = window.innerWidth <= 767.98 ? 3 : 5; skeletonLines: number[] = []; + changeAddress: string = "bc1qxvay4an52gcghxq5lavact7r6qe9l4laedsazz8fj2ee2cy47tlqff4aj4"; auditStatus$: Observable; auditUpdated$: Observable; + showChangeUtxosToggleSubject: BehaviorSubject = new BehaviorSubject(false); + showChangeUtxosToggle$: Observable = this.showChangeUtxosToggleSubject.asObservable(); + filteredFederationUtxos$: Observable; lastReservesBlockUpdate: number = 0; currentPeg$: Observable; lastPegBlockUpdate: number = 0; @@ -31,7 +35,7 @@ export class FederationUtxosListComponent implements OnInit { isLoad: boolean = true; private destroy$ = new Subject(); - + constructor( private apiService: ApiService, public stateService: StateService, @@ -43,6 +47,7 @@ export class FederationUtxosListComponent implements OnInit { this.isLoading = !this.widget; this.env = this.stateService.env; this.skeletonLines = this.widget === true ? [...Array(5).keys()] : [...Array(15).keys()]; + if (!this.widget) { this.websocketService.want(['blocks']); this.auditStatus$ = this.stateService.blocks$.pipe( @@ -94,6 +99,16 @@ export class FederationUtxosListComponent implements OnInit { share() ); } + + if (this.federationUtxos$) { + this.filteredFederationUtxos$ = combineLatest([ + this.federationUtxos$, + this.showChangeUtxosToggle$ + ]).pipe( + switchMap(([federationUtxos, showChangeUtxosToggle]) => showChangeUtxosToggle ? of(federationUtxos) : of(federationUtxos.filter(utxo => utxo.bitcoinaddress !== this.changeAddress))), + share() + ); + } } @@ -106,4 +121,7 @@ export class FederationUtxosListComponent implements OnInit { this.page = page; } + onShowChangeUtxosToggleChange(e): void { + this.showChangeUtxosToggleSubject.next(e.target.checked); + } }