From ca4b1943a83cda3511c392d3ba79d8e87614b754 Mon Sep 17 00:00:00 2001 From: softsimon Date: Thu, 25 Jul 2024 03:35:17 -0500 Subject: [PATCH] moving code block --- .../transaction/transaction.component.ts | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/frontend/src/app/components/transaction/transaction.component.ts b/frontend/src/app/components/transaction/transaction.component.ts index 24d90b269..0d3754e0b 100644 --- a/frontend/src/app/components/transaction/transaction.component.ts +++ b/frontend/src/app/components/transaction/transaction.component.ts @@ -229,6 +229,25 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy { this.latestBlock = blocks[0]; }); + this.transactionTimesSubscription = this.transactionTimes$.pipe( + tap(() => { + this.isLoadingFirstSeen = true; + }), + switchMap((txid) => this.apiService.getTransactionTimes$([txid]).pipe( + retry({ count: 2, delay: 2000 }), + // Try again until we either get a valid response, or the transaction is confirmed + repeat({ delay: 2000 }), + filter((transactionTimes) => transactionTimes?.length && transactionTimes[0] > 0 && !this.tx.status?.confirmed), + take(1), + )), + ) + .subscribe((transactionTimes) => { + this.isLoadingFirstSeen = false; + if (transactionTimes?.length && transactionTimes[0]) { + this.transactionTime = transactionTimes[0]; + } + }); + this.fetchCpfpSubscription = this.fetchCpfp$ .pipe( switchMap((txId) => @@ -733,26 +752,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy { this.accelerationPositions, ); }) - ) - - this.transactionTimesSubscription = this.transactionTimes$.pipe( - tap(() => { - this.isLoadingFirstSeen = true; - }), - switchMap((txid) => this.apiService.getTransactionTimes$([txid]).pipe( - retry({ count: 2, delay: 2000 }), - // Try again until we either get a valid response, or the transaction is confirmed - repeat({ delay: 2000 }), - filter((transactionTimes) => transactionTimes?.length && transactionTimes[0] > 0 && !this.tx.status?.confirmed), - take(1), - )), - ) - .subscribe((transactionTimes) => { - this.isLoadingFirstSeen = false; - if (transactionTimes?.length && transactionTimes[0]) { - this.transactionTime = transactionTimes[0]; - } - }); + ); } ngAfterViewInit(): void {