diff --git a/frontend/src/app/bisq/bisq-transaction/bisq-transaction.component.html b/frontend/src/app/bisq/bisq-transaction/bisq-transaction.component.html index 4dd1c0a3e..85abafee0 100644 --- a/frontend/src/app/bisq/bisq-transaction/bisq-transaction.component.html +++ b/frontend/src/app/bisq/bisq-transaction/bisq-transaction.component.html @@ -64,7 +64,8 @@ {{ bisqTx.burntFee / 100 | number: '1.2-2' }} BSQ - Fee per vByte + Fee per vByte + Fee per weight unit   diff --git a/frontend/src/app/components/block-fee-rates-graph/block-fee-rates-graph.component.ts b/frontend/src/app/components/block-fee-rates-graph/block-fee-rates-graph.component.ts index cbf33933c..66a594643 100644 --- a/frontend/src/app/components/block-fee-rates-graph/block-fee-rates-graph.component.ts +++ b/frontend/src/app/components/block-fee-rates-graph/block-fee-rates-graph.component.ts @@ -1,6 +1,6 @@ import { ChangeDetectionStrategy, Component, Inject, Input, LOCALE_ID, NgZone, OnInit } from '@angular/core'; import { EChartsOption } from 'echarts'; -import { Observable } from 'rxjs'; +import { Observable, Subscription, combineLatest } from 'rxjs'; import { map, share, startWith, switchMap, tap } from 'rxjs/operators'; import { ApiService } from '../../services/api.service'; import { SeoService } from '../../services/seo.service'; @@ -76,10 +76,11 @@ export class BlockFeeRatesGraphComponent implements OnInit { } }); - this.statsObservable$ = this.radioGroupForm.get('dateSpan').valueChanges - .pipe( - startWith(this.radioGroupForm.controls.dateSpan.value), - switchMap((timespan) => { + this.statsObservable$ = combineLatest([ + this.radioGroupForm.get('dateSpan').valueChanges.pipe(startWith(this.radioGroupForm.controls.dateSpan.value)), + this.stateService.rateUnits$ + ]).pipe( + switchMap(([timespan, rateUnits]) => { this.storageService.setValue('miningWindowPreference', timespan); this.timespan = timespan; this.isLoading = true; @@ -135,8 +136,8 @@ export class BlockFeeRatesGraphComponent implements OnInit { this.prepareChartOptions({ legends: legends, - series: series, - }); + series: series + }, rateUnits === 'wu'); this.isLoading = false; }), map((response) => { @@ -150,7 +151,7 @@ export class BlockFeeRatesGraphComponent implements OnInit { ); } - prepareChartOptions(data) { + prepareChartOptions(data, weightMode) { this.chartOptions = { color: ['#D81B60', '#8E24AA', '#1E88E5', '#7CB342', '#FDD835', '#6D4C41', '#546E7A'], animation: false, @@ -181,7 +182,11 @@ export class BlockFeeRatesGraphComponent implements OnInit { let tooltip = `${formatterXAxis(this.locale, this.timespan, parseInt(data[0].axisValue, 10))}
`; for (const rate of data.reverse()) { - tooltip += `${rate.marker} ${rate.seriesName}: ${rate.data[1]} sats/vByte
`; + if (weightMode) { + tooltip += `${rate.marker} ${rate.seriesName}: ${rate.data[1] / 4} sats/WU
`; + } else { + tooltip += `${rate.marker} ${rate.seriesName}: ${rate.data[1]} sats/vByte
`; + } } if (['24h', '3d'].includes(this.timespan)) { @@ -231,9 +236,12 @@ export class BlockFeeRatesGraphComponent implements OnInit { axisLabel: { color: 'rgb(110, 112, 121)', formatter: (val) => { + if (weightMode) { + val /= 4; + } const selectedPowerOfTen: any = selectPowerOfTen(val); const newVal = Math.round(val / selectedPowerOfTen.divider); - return `${newVal}${selectedPowerOfTen.unit} s/vB`; + return `${newVal}${selectedPowerOfTen.unit} s/${weightMode ? 'WU': 'vB'}`; }, }, splitLine: { diff --git a/frontend/src/app/components/block-overview-tooltip/block-overview-tooltip.component.html b/frontend/src/app/components/block-overview-tooltip/block-overview-tooltip.component.html index 636f2c16a..eece860f8 100644 --- a/frontend/src/app/components/block-overview-tooltip/block-overview-tooltip.component.html +++ b/frontend/src/app/components/block-overview-tooltip/block-overview-tooltip.component.html @@ -34,10 +34,14 @@ - + Virtual size + + Weight + + Audit status diff --git a/frontend/src/app/components/fee-distribution-graph/fee-distribution-graph.component.ts b/frontend/src/app/components/fee-distribution-graph/fee-distribution-graph.component.ts index 823d271a1..f275588a1 100644 --- a/frontend/src/app/components/fee-distribution-graph/fee-distribution-graph.component.ts +++ b/frontend/src/app/components/fee-distribution-graph/fee-distribution-graph.component.ts @@ -1,16 +1,17 @@ -import { OnChanges } from '@angular/core'; +import { OnChanges, OnDestroy } from '@angular/core'; import { Component, Input, OnInit, ChangeDetectionStrategy } from '@angular/core'; import { TransactionStripped } from '../../interfaces/websocket.interface'; import { StateService } from '../../services/state.service'; import { VbytesPipe } from '../../shared/pipes/bytes-pipe/vbytes.pipe'; import { selectPowerOfTen } from '../../bitcoin.utils'; +import { Subscription } from 'rxjs'; @Component({ selector: 'app-fee-distribution-graph', templateUrl: './fee-distribution-graph.component.html', changeDetection: ChangeDetectionStrategy.OnPush, }) -export class FeeDistributionGraphComponent implements OnInit, OnChanges { +export class FeeDistributionGraphComponent implements OnInit, OnChanges, OnDestroy { @Input() feeRange: number[]; @Input() vsize: number; @Input() transactions: TransactionStripped[]; @@ -25,6 +26,8 @@ export class FeeDistributionGraphComponent implements OnInit, OnChanges { data: number[][]; labelInterval: number = 50; + rateUnitSub: Subscription; + weightMode: boolean = false; mempoolVsizeFeesOptions: any; mempoolVsizeFeesInitOptions = { renderer: 'svg' @@ -35,8 +38,13 @@ export class FeeDistributionGraphComponent implements OnInit, OnChanges { private vbytesPipe: VbytesPipe, ) { } - ngOnInit(): void { - this.mountChart(); + ngOnInit() { + this.rateUnitSub = this.stateService.rateUnits$.subscribe(rateUnits => { + this.weightMode = rateUnits === 'wu'; + if (this.data) { + this.mountChart(); + } + }); } ngOnChanges(): void { @@ -122,8 +130,9 @@ export class FeeDistributionGraphComponent implements OnInit, OnChanges { }, axisLabel: { formatter: (value: number): string => { - const selectedPowerOfTen = selectPowerOfTen(value); - const newVal = Math.round(value / selectedPowerOfTen.divider); + const unitValue = this.weightMode ? value / 4 : value; + const selectedPowerOfTen = selectPowerOfTen(unitValue); + const newVal = Math.round(unitValue / selectedPowerOfTen.divider); return `${newVal}${selectedPowerOfTen.unit}`; }, } @@ -138,10 +147,11 @@ export class FeeDistributionGraphComponent implements OnInit, OnChanges { textShadowBlur: 0, formatter: (label: { data: number[] }): string => { const value = label.data[1]; - const selectedPowerOfTen = selectPowerOfTen(value); - const newVal = Math.round(value / selectedPowerOfTen.divider); + const unitValue = this.weightMode ? value / 4 : value; + const selectedPowerOfTen = selectPowerOfTen(unitValue); + const newVal = Math.round(unitValue / selectedPowerOfTen.divider); return `${newVal}${selectedPowerOfTen.unit}`; - }, + } }, showAllSymbol: false, smooth: true, @@ -162,4 +172,8 @@ export class FeeDistributionGraphComponent implements OnInit, OnChanges { }] }; } + + ngOnDestroy(): void { + this.rateUnitSub.unsubscribe(); + } } diff --git a/frontend/src/app/components/footer/footer.component.html b/frontend/src/app/components/footer/footer.component.html index c8d28824f..cc5d1f9b9 100644 --- a/frontend/src/app/components/footer/footer.component.html +++ b/frontend/src/app/components/footer/footer.component.html @@ -10,7 +10,8 @@
 
-
‎{{ mempoolInfoData.vBytesPerSecond | ceil | number }} vB/s
+
‎{{ mempoolInfoData.vBytesPerSecond | ceil | number }} vB/s
+
‎{{ mempoolInfoData.vBytesPerSecond * 4 | ceil | number }} WU/s
diff --git a/frontend/src/app/components/incoming-transactions-graph/incoming-transactions-graph.component.ts b/frontend/src/app/components/incoming-transactions-graph/incoming-transactions-graph.component.ts index d721469b7..219811e9c 100644 --- a/frontend/src/app/components/incoming-transactions-graph/incoming-transactions-graph.component.ts +++ b/frontend/src/app/components/incoming-transactions-graph/incoming-transactions-graph.component.ts @@ -1,9 +1,11 @@ -import { Component, Input, Inject, LOCALE_ID, ChangeDetectionStrategy, OnInit } from '@angular/core'; +import { Component, Input, Inject, LOCALE_ID, ChangeDetectionStrategy, OnInit, OnDestroy } from '@angular/core'; import { EChartsOption } from 'echarts'; import { OnChanges } from '@angular/core'; import { StorageService } from '../../services/storage.service'; import { download, formatterXAxis, formatterXAxisLabel } from '../../shared/graphs.utils'; import { formatNumber } from '@angular/common'; +import { StateService } from '../../services/state.service'; +import { Subscription } from 'rxjs'; @Component({ selector: 'app-incoming-transactions-graph', @@ -18,7 +20,7 @@ import { formatNumber } from '@angular/common'; `], changeDetection: ChangeDetectionStrategy.OnPush, }) -export class IncomingTransactionsGraphComponent implements OnInit, OnChanges { +export class IncomingTransactionsGraphComponent implements OnInit, OnChanges, OnDestroy { @Input() data: any; @Input() theme: string; @Input() height: number | string = '200'; @@ -35,14 +37,24 @@ export class IncomingTransactionsGraphComponent implements OnInit, OnChanges { }; windowPreference: string; chartInstance: any = undefined; + weightMode: boolean = false; + rateUnitSub: Subscription; constructor( @Inject(LOCALE_ID) private locale: string, private storageService: StorageService, + private stateService: StateService, ) { } ngOnInit() { this.isLoading = true; + + this.rateUnitSub = this.stateService.rateUnits$.subscribe(rateUnits => { + this.weightMode = rateUnits === 'wu'; + if (this.data) { + this.mountChart(); + } + }); } ngOnChanges(): void { @@ -118,7 +130,7 @@ export class IncomingTransactionsGraphComponent implements OnInit, OnChanges { itemFormatted += `
${colorSpan(item.color)}
-
${formatNumber(item.value[1], this.locale, '1.0-0')}vB/s
+
${formatNumber(this.weightMode ? item.value[1] * 4 : item.value[1], this.locale, '1.0-0')} ${this.weightMode ? 'WU' : 'vB'}/s
`; } }); @@ -147,6 +159,9 @@ export class IncomingTransactionsGraphComponent implements OnInit, OnChanges { type: 'value', axisLabel: { fontSize: 11, + formatter: (value) => { + return this.weightMode ? value * 4 : value; + } }, splitLine: { lineStyle: { @@ -250,4 +265,8 @@ export class IncomingTransactionsGraphComponent implements OnInit, OnChanges { this.mempoolStatsChartOption.backgroundColor = 'none'; this.chartInstance.setOption(this.mempoolStatsChartOption); } + + ngOnDestroy(): void { + this.rateUnitSub.unsubscribe(); + } } diff --git a/frontend/src/app/components/mempool-graph/mempool-graph.component.ts b/frontend/src/app/components/mempool-graph/mempool-graph.component.ts index 4ab8c33fc..6c9795c89 100644 --- a/frontend/src/app/components/mempool-graph/mempool-graph.component.ts +++ b/frontend/src/app/components/mempool-graph/mempool-graph.component.ts @@ -1,5 +1,6 @@ import { Component, OnInit, Input, Inject, LOCALE_ID, ChangeDetectionStrategy, OnChanges } from '@angular/core'; import { VbytesPipe } from '../../shared/pipes/bytes-pipe/vbytes.pipe'; +import { WuBytesPipe } from '../../shared/pipes/bytes-pipe/wubytes.pipe'; import { formatNumber } from '@angular/common'; import { OptimizedMempoolStats } from '../../interfaces/node-api.interface'; import { StateService } from '../../services/state.service'; @@ -48,9 +49,11 @@ export class MempoolGraphComponent implements OnInit, OnChanges { chartColorsOrdered = chartColors; inverted: boolean; chartInstance: any = undefined; + weightMode: boolean = false; constructor( private vbytesPipe: VbytesPipe, + private wubytesPipe: WuBytesPipe, private stateService: StateService, private storageService: StorageService, @Inject(LOCALE_ID) private locale: string, diff --git a/frontend/src/app/components/rbf-timeline/rbf-timeline-tooltip.component.html b/frontend/src/app/components/rbf-timeline/rbf-timeline-tooltip.component.html index 1ce224760..68f8a1caf 100644 --- a/frontend/src/app/components/rbf-timeline/rbf-timeline-tooltip.component.html +++ b/frontend/src/app/components/rbf-timeline/rbf-timeline-tooltip.component.html @@ -21,10 +21,14 @@ Fee {{ rbfInfo.tx.fee | number }} sat - + Virtual size + + Weight + + Status diff --git a/frontend/src/app/components/rbf-timeline/rbf-timeline.component.html b/frontend/src/app/components/rbf-timeline/rbf-timeline.component.html index 5af1c7a0b..ce5a9678f 100644 --- a/frontend/src/app/components/rbf-timeline/rbf-timeline.component.html +++ b/frontend/src/app/components/rbf-timeline/rbf-timeline.component.html @@ -31,7 +31,7 @@ >
- +
diff --git a/frontend/src/app/components/rbf-timeline/rbf-timeline.component.scss b/frontend/src/app/components/rbf-timeline/rbf-timeline.component.scss index 97388b98e..3745360a5 100644 --- a/frontend/src/app/components/rbf-timeline/rbf-timeline.component.scss +++ b/frontend/src/app/components/rbf-timeline/rbf-timeline.component.scss @@ -126,11 +126,6 @@ } } - .symbol::ng-deep { - display: block; - margin-top: -0.5em; - } - &.selected { .shape-border { background: #9339f4; diff --git a/frontend/src/app/components/transaction/transaction.component.html b/frontend/src/app/components/transaction/transaction.component.html index 5c2457c02..25707b007 100644 --- a/frontend/src/app/components/transaction/transaction.component.html +++ b/frontend/src/app/components/transaction/transaction.component.html @@ -137,7 +137,8 @@ Type TXID - Virtual size + Virtual size + Weight Fee rate @@ -149,7 +150,8 @@ - + + @@ -160,7 +162,8 @@ - + + @@ -171,7 +174,8 @@ - + + diff --git a/frontend/src/app/dashboard/dashboard.component.html b/frontend/src/app/dashboard/dashboard.component.html index e7c17d87a..620678a28 100644 --- a/frontend/src/app/dashboard/dashboard.component.html +++ b/frontend/src/app/dashboard/dashboard.component.html @@ -229,7 +229,8 @@
 
-
‎{{ mempoolInfoData.value.vBytesPerSecond | ceil | number }} vB/s
+
‎{{ mempoolInfoData.value.vBytesPerSecond | ceil | number }} vB/s
+
‎{{ mempoolInfoData.value.vBytesPerSecond * 4 | ceil | number }} WU/s
diff --git a/frontend/src/app/shared/pipes/bytes-pipe/wubytes.pipe.ts b/frontend/src/app/shared/pipes/bytes-pipe/wubytes.pipe.ts index 397873df2..b6566ac0a 100644 --- a/frontend/src/app/shared/pipes/bytes-pipe/wubytes.pipe.ts +++ b/frontend/src/app/shared/pipes/bytes-pipe/wubytes.pipe.ts @@ -17,7 +17,7 @@ export class WuBytesPipe implements PipeTransform { 'TWU': {max: Number.MAX_SAFE_INTEGER, prev: 'GWU'} }; - transform(input: any, decimal: number = 0, from: ByteUnit = 'WU', to?: ByteUnit): any { + transform(input: any, decimal: number = 0, from: ByteUnit = 'WU', to?: ByteUnit, plainText?: boolean): any { if (!(isNumberFinite(input) && isNumberFinite(decimal) && @@ -38,7 +38,7 @@ export class WuBytesPipe implements PipeTransform { const result = toDecimal(WuBytesPipe.calculateResult(format, bytes), decimal); - return WuBytesPipe.formatResult(result, to); + return WuBytesPipe.formatResult(result, to, plainText); } for (const key in WuBytesPipe.formats) { @@ -47,12 +47,15 @@ export class WuBytesPipe implements PipeTransform { const result = toDecimal(WuBytesPipe.calculateResult(format, bytes), decimal); - return WuBytesPipe.formatResult(result, key); + return WuBytesPipe.formatResult(result, key, plainText); } } } - static formatResult(result: number, unit: string): string { + static formatResult(result: number, unit: string, plainText: boolean): string { + if (plainText){ + return `${result} ${unit}`; + } return `${result} ${unit}`; } diff --git a/frontend/src/app/shared/shared.module.ts b/frontend/src/app/shared/shared.module.ts index 5d9b91e11..9cf780116 100644 --- a/frontend/src/app/shared/shared.module.ts +++ b/frontend/src/app/shared/shared.module.ts @@ -209,6 +209,7 @@ import { OnlyVsizeDirective, OnlyWeightDirective } from './components/weight-dir ], providers: [ VbytesPipe, + WuBytesPipe, RelativeUrlPipe, NoSanitizePipe, ShortenStringPipe,