diff --git a/frontend/src/app/components/accelerate-preview/accelerate-fee-graph.component.html b/frontend/src/app/components/accelerate-preview/accelerate-fee-graph.component.html index 727f833bc..fe0718ecc 100644 --- a/frontend/src/app/components/accelerate-preview/accelerate-fee-graph.component.html +++ b/frontend/src/app/components/accelerate-preview/accelerate-fee-graph.component.html @@ -11,11 +11,11 @@

+
{{ bar.class === 'tx' ? '' : '+' }} {{ bar.fee | number }} sat +
+
-
- -
diff --git a/frontend/src/app/components/accelerate-preview/accelerate-fee-graph.component.scss b/frontend/src/app/components/accelerate-preview/accelerate-fee-graph.component.scss index 84d530e34..6137b53ee 100644 --- a/frontend/src/app/components/accelerate-preview/accelerate-fee-graph.component.scss +++ b/frontend/src/app/components/accelerate-preview/accelerate-fee-graph.component.scss @@ -1,9 +1,8 @@ .fee-graph { height: 100%; - width: 20%; - min-width: 100px; - max-width: 150px; - max-height: 100vh; + min-width: 120px; + width: 120px; + max-height: 90vh; margin-left: 4em; margin-right: 1.5em; padding-bottom: 63px; @@ -20,6 +19,7 @@ left: 0; right: 0; display: flex; + flex-direction: column; justify-content: center; align-items: center; @@ -34,11 +34,18 @@ } .fee { - position: absolute; + font-size: 0.9em; opacity: 0; pointer-events: none; } + .spacer { + width: 100%; + height: 1px; + flex-grow: 1; + pointer-events: none; + } + .line { position: absolute; right: 0; @@ -69,7 +76,7 @@ &.tx { .fill { - background: #105fb0; + background: #3bcc49; } .line { .fee-rate { @@ -77,6 +84,7 @@ } } .fee { + position: absolute; opacity: 1; z-index: 11; } @@ -84,9 +92,10 @@ &.target { .fill { - background: #3bcc49; + background: #653b9c; } .fee { + position: absolute; opacity: 1; z-index: 11; } @@ -105,7 +114,7 @@ } &.active, &:hover { .fill { - background: #653b9c; + background: #105fb0; } .line { .fee-rate .label { @@ -138,10 +147,11 @@ opacity: 0; } } + &.max { + .fill { + background: none; + } + } } } - - .vsize { - text-align: center; - } } \ No newline at end of file diff --git a/frontend/src/app/components/accelerate-preview/accelerate-fee-graph.component.ts b/frontend/src/app/components/accelerate-preview/accelerate-fee-graph.component.ts index 98b47bea0..4d746a0d9 100644 --- a/frontend/src/app/components/accelerate-preview/accelerate-fee-graph.component.ts +++ b/frontend/src/app/components/accelerate-preview/accelerate-fee-graph.component.ts @@ -52,7 +52,7 @@ export class AccelerateFeeGraphComponent implements OnInit, OnChanges { rate: option.rate, style: this.getStyle(option.rate, maxRate, baseHeight), class: 'max', - label: 'max', + label: 'maximum', active: option.index === this.maxRateIndex, rateIndex: option.index, fee: option.fee, @@ -62,14 +62,14 @@ export class AccelerateFeeGraphComponent implements OnInit, OnChanges { rate: this.estimate.targetFeeRate, style: this.getStyle(this.estimate.targetFeeRate, maxRate, baseHeight), class: 'target', - label: 'expected', + label: 'next block', fee: this.estimate.nextBlockFee - this.estimate.txSummary.effectiveFee }); bars.push({ rate: baseRate, style: this.getStyle(baseRate, maxRate, 0), class: 'tx', - label: 'paid', + label: '', fee: this.estimate.txSummary.effectiveFee, }); this.bars = bars; diff --git a/frontend/src/app/components/accelerate-preview/accelerate-preview.component.html b/frontend/src/app/components/accelerate-preview/accelerate-preview.component.html index ad96eb671..8fc77dae4 100644 --- a/frontend/src/app/components/accelerate-preview/accelerate-preview.component.html +++ b/frontend/src/app/components/accelerate-preview/accelerate-preview.component.html @@ -12,14 +12,6 @@ -
-
-
- This transactions is part of a CPFP tree. Fee rates (in sats/vb) are provided for your information. Change in the CPFP tree will lead to different fee rates values. -
-
-
-
-
+
Your transaction
+
+ + Plus {{ estimate.txSummary.ancestorCount - 1 }} unconfirmed ancestor{{ estimate.txSummary.ancestorCount > 2 ? 's' : ''}}. + - - - + - + + + - - - - - - - - - - - - - - - - - - - - +
- Next block market price +
+ Virtual size - {{ estimate.targetFeeRate | number : '1.0-0' }} sat/vB +
+ Size in vbytes of this transaction and its unconfirmed ancestors
- Currently estimated fee to get into next block + + In-band fees - - {{ estimate.nextBlockFee| number }} sats - - + + {{ estimate.txSummary.effectiveFee | number : '1.0-0' }} sats
- Fees paid in-band - - ~{{ (estimate.txSummary.effectiveFee / estimate.txSummary.effectiveVsize) | number : '1.0-0' }} sat/vB -
- What you already paid when you made the transaction - - - {{ estimate.txSummary.effectiveFee | number }} sats - - -
- Extra fee required - - {{ math.max(0, estimate.nextBlockFee - estimate.txSummary.effectiveFee) | number }} sats - -
- Difference between the next block fee and your tx fee +
+ Fees already paid by this transaction and its unconfirmed ancestors
- -
How much more are you willing to pay at most to get into the next block?
+
+
How much more are you willing to pay?
- The maximum extra transaction fee you're willing to pay to get into the next block. If the next block market price becomes too expensive for you, we will automatically cancel your acceleration request. Final charged fee may be smaller based on the fee market. + Choose the maximum extra transaction fee you're willing to pay to get into the next block.
+ If the estimated next block rate rises beyond this limit, we will automatically cancel your acceleration request.
-
+
@@ -117,108 +82,159 @@
-
Acceleration summary
+
Acceleration summary
+
+
+ Estimated cost +
+
+ Maximum cost +
+
+ + + + + + + + + + + + + - - - - - - - + + + + + + + + - + + + - - - - + - + - - + - + - + - - - + + + - - - - + + + + + + - - - - - - - + + + + + + + + + + - - + - +
+ Next block market rate + + {{ estimate.targetFeeRate | number : '1.0-0' }} + sat/vB
+ Estimated extra fee required + + {{ math.max(0, estimate.nextBlockFee - estimate.txSummary.effectiveFee) | number }} + + sats + +
- Your maximum tx fees - - ~{{ ((estimate.txSummary.effectiveFee + userBid) / estimate.txSummary.effectiveVsize) | number : '1.0-0' }} sat/vB -
- The maximum extra transaction fee you're willing to pay - - - {{ userBid | number }} sats + +
+ Your maximum + + ~{{ ((estimate.txSummary.effectiveFee + userBid) / estimate.txSummary.effectiveVsize) | number : '1.0-0' }} + sat/vB
+ The maximum extra transaction fee you could pay + + + {{ userBid | number }} + + + sats - -
- Mempool Acceleratorâ„¢ fee - - +{{ estimate.mempoolBaseFee + estimate.vsizeFee | number }} sats - + + Mempool Acceleratorâ„¢ fees
+
mempool.space fee - - {{ estimate.mempoolBaseFee | number }} sats - - + + +{{ estimate.mempoolBaseFee | number }} + + sats +
+
Transaction vsize fee - - {{ estimate.vsizeFee | number }} sats - - + + +{{ estimate.vsizeFee | number }} + + sats +
- Estimated acceleration cost - - - {{ estimate.cost + estimate.mempoolBaseFee + estimate.vsizeFee | number }} sats + +
+ Estimated acceleration cost + + + {{ estimate.cost + estimate.mempoolBaseFee + estimate.vsizeFee | number }} + + + sats - -
- Cost if your tx is accelerated using {{ estimate.targetFeeRate | number : '1.0-0' }} sat/vB -
+ If your tx is accelerated to {{ estimate.targetFeeRate | number : '1.0-0' }} sat/vB +
- Maximum acceleration cost - - {{ maxCost | number }} sats - - - -
- Cost if your tx is accelerated using ~{{ ((estimate.txSummary.effectiveFee + userBid) / estimate.txSummary.effectiveVsize) | number : '1.0-0' }} sat/vB -
+ Maximum acceleration cost + + + {{ maxCost | number }} + + + sats + + + +
+ If your tx is accelerated to ~{{ ((estimate.txSummary.effectiveFee + userBid) / estimate.txSummary.effectiveVsize) | number : '1.0-0' }} sat/vB +
+
Available balance - {{ estimate.userBalance | number }} sats + + {{ estimate.userBalance | number }} + + sats diff --git a/frontend/src/app/components/accelerate-preview/accelerate-preview.component.scss b/frontend/src/app/components/accelerate-preview/accelerate-preview.component.scss index f6e68a77a..433c05520 100644 --- a/frontend/src/app/components/accelerate-preview/accelerate-preview.component.scss +++ b/frontend/src/app/components/accelerate-preview/accelerate-preview.component.scss @@ -1,6 +1,23 @@ .fee-card { padding: 15px; background-color: #1d1f31; + + .feerate { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + + .fee { + font-size: 1.2em; + } + .rate { + font-size: 0.9em; + .symbol { + color: white; + } + } + } } .btn-border { @@ -19,10 +36,47 @@ pointer-events: none; } +.table-toggle { + width: 100%; + margin-top: 0.5em; +} + .table-accelerator { - table-layout: fixed; - & tr { + tr { text-wrap: wrap; + + td { + padding-top: 0; + padding-bottom: 0; + vertical-align: baseline; + } + + &.group-first { + td { + padding-top: 0.75rem; + } + } + &.group-last { + td { + padding-bottom: 0.75rem; + } + } + } + td { + &:first-child { + width: 100vw; + } + &.info { + color: #6c757d; + } + &.amt { + text-align: right; + padding-right: 0.2em; + } + &.units { + padding-left: 0.2em; + white-space: nowrap; + } } } diff --git a/frontend/src/app/components/accelerate-preview/accelerate-preview.component.ts b/frontend/src/app/components/accelerate-preview/accelerate-preview.component.ts index 27074c724..be47b25fe 100644 --- a/frontend/src/app/components/accelerate-preview/accelerate-preview.component.ts +++ b/frontend/src/app/components/accelerate-preview/accelerate-preview.component.ts @@ -3,6 +3,7 @@ import { ApiService } from '../../services/api.service'; import { Subscription, catchError, of, tap } from 'rxjs'; import { StorageService } from '../../services/storage.service'; import { Transaction } from '../../interfaces/electrs.interface'; +import { nextRoundNumber } from '../../shared/common.utils'; export type AccelerationEstimate = { txSummary: TxSummary; @@ -47,13 +48,15 @@ export class AcceleratePreviewComponent implements OnInit, OnDestroy, OnChanges estimateSubscription: Subscription; accelerationSubscription: Subscription; estimate: any; + hasAncestors: boolean = false; minExtraCost = 0; minBidAllowed = 0; maxBidAllowed = 0; defaultBid = 0; maxCost = 0; userBid = 0; - selectFeeRateIndex = 2; + selectFeeRateIndex = 1; + showTable: 'estimated' | 'maximum' = 'maximum'; maxRateOptions: RateOption[] = []; @@ -96,11 +99,13 @@ export class AcceleratePreviewComponent implements OnInit, OnDestroy, OnChanges this.scrollToPreviewWithTimeout('mempoolError', 'center'); } } + + this.hasAncestors = this.estimate.txSummary.ancestorCount > 1; // Make min extra fee at least 50% of the current tx fee - this.minExtraCost = Math.round(Math.max(this.estimate.cost, this.estimate.txSummary.effectiveFee / 2)); + this.minExtraCost = nextRoundNumber(Math.max(this.estimate.cost * 2, this.estimate.txSummary.effectiveFee)); - this.maxRateOptions = [2, 5, 10, 20].map((multiplier, index) => { + this.maxRateOptions = [1, 2, 4].map((multiplier, index) => { return { fee: this.minExtraCost * multiplier, rate: (this.estimate.txSummary.effectiveFee + (this.minExtraCost * multiplier)) / this.estimate.txSummary.effectiveVsize, diff --git a/frontend/src/app/shared/common.utils.ts b/frontend/src/app/shared/common.utils.ts index 7d206f4b5..af72c0e72 100644 --- a/frontend/src/app/shared/common.utils.ts +++ b/frontend/src/app/shared/common.utils.ts @@ -135,4 +135,12 @@ export function haversineDistance(lat1: number, lon1: number, lat2: number, lon2 export function kmToMiles(km: number): number { return km * 0.62137119; +} + +const roundNumbers = [1, 2, 5, 10, 15, 20, 25, 50, 75, 100, 125, 150, 175, 200, 250, 300, 350, 400, 450, 500, 600, 700, 750, 800, 900, 1000]; +export function nextRoundNumber(num: number): number { + const log = Math.floor(Math.log10(num)); + const factor = log >= 3 ? Math.pow(10, log - 2) : 1; + num /= factor; + return factor * (roundNumbers.find(val => val >= num) || roundNumbers[roundNumbers.length - 1]); } \ No newline at end of file