+ |
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
|