-
-
-
+
+
+
+
+
Pending Accelerations
+
-
+
diff --git a/frontend/src/app/components/acceleration/accelerator-dashboard/accelerator-dashboard.component.scss b/frontend/src/app/components/acceleration/accelerator-dashboard/accelerator-dashboard.component.scss
index 6d863fb60..0d1c3b1c0 100644
--- a/frontend/src/app/components/acceleration/accelerator-dashboard/accelerator-dashboard.component.scss
+++ b/frontend/src/app/components/acceleration/accelerator-dashboard/accelerator-dashboard.component.scss
@@ -132,4 +132,17 @@
text-align: right;
width: 20%;
}
+}
+
+.card {
+ height: 385px;
+}
+.list-card {
+ height: 410px;
+}
+
+.mempool-block-wrapper {
+ max-height: 380px;
+ max-width: 380px;
+ margin: auto;
}
\ No newline at end of file
diff --git a/frontend/src/app/components/acceleration/accelerator-dashboard/accelerator-dashboard.component.ts b/frontend/src/app/components/acceleration/accelerator-dashboard/accelerator-dashboard.component.ts
index 00b3d303b..c3a40730b 100644
--- a/frontend/src/app/components/acceleration/accelerator-dashboard/accelerator-dashboard.component.ts
+++ b/frontend/src/app/components/acceleration/accelerator-dashboard/accelerator-dashboard.component.ts
@@ -3,8 +3,15 @@ import { SeoService } from '../../../services/seo.service';
import { WebsocketService } from '../../../services/websocket.service';
import { Acceleration, BlockExtended } from '../../../interfaces/node-api.interface';
import { StateService } from '../../../services/state.service';
-import { Observable, Subject, catchError, combineLatest, distinctUntilChanged, of, share, switchMap, tap } from 'rxjs';
+import { Observable, Subject, catchError, combineLatest, distinctUntilChanged, interval, map, of, share, startWith, switchMap, tap } from 'rxjs';
import { ApiService } from '../../../services/api.service';
+import { Color } from '../../block-overview-graph/sprite-types';
+import { hexToColor } from '../../block-overview-graph/utils';
+import TxView from '../../block-overview-graph/tx-view';
+import { feeLevels, mempoolFeeColors } from '../../../app.constants';
+
+const acceleratedColor: Color = hexToColor('8F5FF6');
+const normalColors = mempoolFeeColors.map(hex => hexToColor(hex + '5F'));
interface AccelerationBlock extends BlockExtended {
accelerationCount: number,
@@ -19,6 +26,8 @@ interface AccelerationBlock extends BlockExtended {
export class AcceleratorDashboardComponent implements OnInit {
blocks$: Observable
;
accelerations$: Observable;
+ pendingAccelerations$: Observable;
+ minedAccelerations$: Observable;
loadingBlocks: boolean = true;
constructor(
@@ -33,6 +42,17 @@ export class AcceleratorDashboardComponent implements OnInit {
ngOnInit(): void {
this.websocketService.want(['blocks', 'mempool-blocks', 'stats']);
+ this.pendingAccelerations$ = interval(30000).pipe(
+ startWith(true),
+ switchMap(() => {
+ return this.apiService.getAccelerations$();
+ }),
+ catchError((e) => {
+ return of([]);
+ }),
+ share(),
+ );
+
this.accelerations$ = this.stateService.chainTip$.pipe(
distinctUntilChanged(),
switchMap((chainTip) => {
@@ -44,6 +64,12 @@ export class AcceleratorDashboardComponent implements OnInit {
share(),
);
+ this.minedAccelerations$ = this.accelerations$.pipe(
+ map(accelerations => {
+ return accelerations.filter(acc => ['mined', 'completed'].includes(acc.status))
+ })
+ );
+
this.blocks$ = combineLatest([
this.accelerations$,
this.stateService.blocks$.pipe(
@@ -83,4 +109,14 @@ export class AcceleratorDashboardComponent implements OnInit {
})
);
}
+
+ getAcceleratorColor(tx: TxView): Color {
+ if (tx.status === 'accelerated' || tx.acc) {
+ return acceleratedColor;
+ } else {
+ const rate = tx.fee / tx.vsize; // color by simple single-tx fee rate
+ const feeLevelIndex = feeLevels.findIndex((feeLvl) => Math.max(1, rate) < feeLvl) - 1;
+ return normalColors[feeLevelIndex] || normalColors[mempoolFeeColors.length - 1];
+ }
+ }
}
diff --git a/frontend/src/app/components/acceleration/pending-stats/pending-stats.component.html b/frontend/src/app/components/acceleration/pending-stats/pending-stats.component.html
index 5b7bc356a..c94bbf43a 100644
--- a/frontend/src/app/components/acceleration/pending-stats/pending-stats.component.html
+++ b/frontend/src/app/components/acceleration/pending-stats/pending-stats.component.html
@@ -20,7 +20,7 @@
Total vsize
-
{{ (stats.totalVsize / 1_000_000).toFixed(2) }}% of next block
+
{{ (stats.totalVsize / 1_000_000 * 100).toFixed(2) }}% of next block