diff --git a/frontend/src/app/components/acceleration-stats/acceleration-stats.component.html b/frontend/src/app/components/acceleration-stats/acceleration-stats.component.html index a2f201eb4..2180a1ad6 100644 --- a/frontend/src/app/components/acceleration-stats/acceleration-stats.component.html +++ b/frontend/src/app/components/acceleration-stats/acceleration-stats.component.html @@ -10,17 +10,26 @@
Fee delta
-
{{ stats.totalFeeDelta | number }} sat
-
paid out of band
+
{{ stats.totalFeeDelta / 100_000_000 | amountShortener: 4 }} BTC
+ + +
-
+
Success rate
{{ stats.successRate.toFixed(2) }} %
mined in the next block
+
+
Total vsize
+
+
+
{{ (stats.totalVsize / 1_000_000).toFixed(2) }}% of next block
+
+
@@ -40,12 +49,19 @@
-
+
Success rate
+
+
Total vsize
+
+
+
+
+
diff --git a/frontend/src/app/components/acceleration-stats/acceleration-stats.component.ts b/frontend/src/app/components/acceleration-stats/acceleration-stats.component.ts index ab423a216..4d06a31e2 100644 --- a/frontend/src/app/components/acceleration-stats/acceleration-stats.component.ts +++ b/frontend/src/app/components/acceleration-stats/acceleration-stats.component.ts @@ -10,7 +10,7 @@ import { ApiService } from '../../services/api.service'; changeDetection: ChangeDetectionStrategy.OnPush, }) export class AccelerationStatsComponent implements OnInit { - @Input() timespan: '24h' | '1w' = '24h'; + @Input() timespan: 'now' | '24h' | '1w' = '24h'; public accelerationStats$: Observable; constructor( @@ -18,26 +18,46 @@ export class AccelerationStatsComponent implements OnInit { ) { } ngOnInit(): void { - this.accelerationStats$ = this.apiService.getAccelerationHistory$(this.timespan).pipe( - switchMap(accelerations => { - let totalFeeDelta = 0; - let totalMined = 0; - let totalCanceled = 0; - for (const acceleration of accelerations) { - if (acceleration.status === 'completed' || acceleration.status === 'mined') { - totalMined++; - totalFeeDelta += acceleration.feeDelta; - } else if (acceleration.status === 'failed') { - totalCanceled++; + if (this.timespan === 'now') { + this.accelerationStats$ = this.apiService.getAccelerations$().pipe( + switchMap(accelerations => { + let totalAccelerations = 0; + let totalFeeDelta = 0; + let totalVsize = 0; + for (const acceleration of accelerations) { + totalAccelerations++; + totalFeeDelta += acceleration.feeDelta || 0; + totalVsize += acceleration.effectiveVsize || 0; } - } - return of({ - count: totalMined, - totalFeeDelta, - successRate: (totalMined + totalCanceled > 0) ? ((totalMined / (totalMined + totalCanceled)) * 100) : 0.0, - }); - }) - ); + return of({ + count: totalAccelerations, + totalFeeDelta, + totalVsize, + }); + }) + ); + } else { + this.accelerationStats$ = this.apiService.getAccelerationHistory$(this.timespan).pipe( + switchMap(accelerations => { + let totalFeeDelta = 0; + let totalMined = 0; + let totalCanceled = 0; + for (const acceleration of accelerations) { + if (acceleration.status === 'completed') { + totalMined++; + totalFeeDelta += acceleration.feeDelta || 0; + } else if (acceleration.status === 'failed') { + totalCanceled++; + } + } + return of({ + count: totalMined, + totalFeeDelta, + successRate: (totalMined + totalCanceled > 0) ? ((totalMined / (totalMined + totalCanceled)) * 100) : 0.0, + }); + }) + ); + } } diff --git a/frontend/src/app/components/accelerator-dashboard/accelerator-dashboard.component.html b/frontend/src/app/components/accelerator-dashboard/accelerator-dashboard.component.html index 039252e3a..155f3c4c6 100644 --- a/frontend/src/app/components/accelerator-dashboard/accelerator-dashboard.component.html +++ b/frontend/src/app/components/accelerator-dashboard/accelerator-dashboard.component.html @@ -7,13 +7,12 @@
- Acceleration stats  - (144 blocks) + Pending accelerations
- +