diff --git a/frontend/src/app/components/accelerate-preview/accelerate-preview.component.html b/frontend/src/app/components/accelerate-preview/accelerate-preview.component.html new file mode 100644 index 000000000..e69de29bb diff --git a/frontend/src/app/components/accelerate-preview/accelerate-preview.component.scss b/frontend/src/app/components/accelerate-preview/accelerate-preview.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/frontend/src/app/components/accelerate-preview/accelerate-preview.component.ts b/frontend/src/app/components/accelerate-preview/accelerate-preview.component.ts new file mode 100644 index 000000000..dc8b9b5df --- /dev/null +++ b/frontend/src/app/components/accelerate-preview/accelerate-preview.component.ts @@ -0,0 +1,24 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-accelerator-preview', + templateUrl: 'accelerate-preview.component.html', + styleUrls: ['accelerate-preview.component.scss'] +}) + +export class AcceleratePreviewComponent implements OnInit { + constructor( + private apiService: ApiService + ) { } + + ngOnInit() { + this.apiService.estimate$(this.txId).subscribe((estimate) => { + console.log(estimate.body); + document.getElementById('acceleratePreviewAnchor').scrollIntoView({ + behavior: 'smooth', + inline: 'center', + block: 'center', + }); + }) + } +} \ No newline at end of file diff --git a/frontend/src/app/components/menu/menu.component.scss b/frontend/src/app/components/menu/menu.component.scss index a73f0d012..f1f39b1de 100644 --- a/frontend/src/app/components/menu/menu.component.scss +++ b/frontend/src/app/components/menu/menu.component.scss @@ -6,7 +6,7 @@ position: sticky; top: 65px; transition: 0.25s; - margin-left: -225px; + margin-left: -250px; box-shadow: 5px 0px 30px 0px #000; padding-bottom: 20px; } diff --git a/frontend/src/app/components/transaction/transaction.component.html b/frontend/src/app/components/transaction/transaction.component.html index 133bcaa1d..b9dee8541 100644 --- a/frontend/src/app/components/transaction/transaction.component.html +++ b/frontend/src/app/components/transaction/transaction.component.html @@ -6,6 +6,13 @@ + +

Transaction

@@ -66,12 +73,38 @@
- + +
+

Accelerate

+
+ +
+
+
+ Test +
+
+
+
+ Test +
+
+
+
+ Test +
+
+
+ +
+ + +
@@ -92,16 +125,18 @@ - ETA + ETA - - In several hours (or more) - Accelerate + + In several hours (or more) + @@ -109,9 +144,11 @@ - - - Accelerate + + + diff --git a/frontend/src/app/components/transaction/transaction.component.scss b/frontend/src/app/components/transaction/transaction.component.scss index 5bef401d7..45357471a 100644 --- a/frontend/src/app/components/transaction/transaction.component.scss +++ b/frontend/src/app/components/transaction/transaction.component.scss @@ -228,11 +228,15 @@ } } +.link.accelerator { + cursor: pointer; +} + .accelerate { align-self: auto; margin-top: 3px; + margin-left: 10px; @media (min-width: 850px) { justify-self: start; - margin-left: 0px; } } \ No newline at end of file diff --git a/frontend/src/app/components/transaction/transaction.component.ts b/frontend/src/app/components/transaction/transaction.component.ts index f1f3850e4..db200e9b1 100644 --- a/frontend/src/app/components/transaction/transaction.component.ts +++ b/frontend/src/app/components/transaction/transaction.component.ts @@ -19,6 +19,7 @@ import { WebsocketService } from '../../services/websocket.service'; import { AudioService } from '../../services/audio.service'; import { ApiService } from '../../services/api.service'; import { SeoService } from '../../services/seo.service'; +import { StorageService } from '../../services/storage.service'; import { BlockExtended, CpfpInfo, RbfTree, MempoolPosition, DifficultyAdjustment } from '../../interfaces/node-api.interface'; import { LiquidUnblinding } from './liquid-ublinding'; import { RelativeUrlPipe } from '../../shared/pipes/relative-url/relative-url.pipe'; @@ -88,6 +89,9 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy { rbfEnabled: boolean; taprootEnabled: boolean; hasEffectiveFeeRate: boolean; + accelerateCtaType: 'alert' | 'button' = 'alert'; + acceleratorAvailable: boolean = this.stateService.env.OFFICIAL_MEMPOOL_SPACE && this.stateService.env.ACCELERATOR && this.stateService.network === ''; + showAccelerationSummary = false; @ViewChild('graphContainer') graphContainer: ElementRef; @@ -104,14 +108,20 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy { private apiService: ApiService, private seoService: SeoService, private priceService: PriceService, + private storageService: StorageService ) {} ngOnInit() { this.websocketService.want(['blocks', 'mempool-blocks']); this.stateService.networkChanged$.subscribe( - (network) => (this.network = network) + (network) => { + this.network = network; + this.acceleratorAvailable = this.stateService.env.OFFICIAL_MEMPOOL_SPACE && this.stateService.env.ACCELERATOR && this.stateService.network === ''; + } ); + this.accelerateCtaType = (this.storageService.getValue('accel-cta-type') as 'alert' | 'button') ?? 'alert'; + this.setFlowEnabled(); this.flowPrefSubscription = this.stateService.hideFlow.subscribe((hide) => { this.hideFlow = !!hide; @@ -486,6 +496,19 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy { this.setGraphSize(); } + dismissAccelAlert(): void { + this.storageService.setValue('accel-cta-type', 'button'); + this.accelerateCtaType = 'button'; + } + + onAccelerateClicked(): void { + if (!this.txId) { + return; + } + + this.showAccelerationSummary = true && this.acceleratorAvailable; + } + handleLoadElectrsTransactionError(error: any): Observable { if (error.status === 404 && /^[a-fA-F0-9]{64}$/.test(this.txId)) { this.websocketService.startMultiTrackTransaction(this.txId); diff --git a/frontend/src/app/services/api.service.ts b/frontend/src/app/services/api.service.ts index cd1109da1..2d9077a97 100644 --- a/frontend/src/app/services/api.service.ts +++ b/frontend/src/app/services/api.service.ts @@ -388,4 +388,8 @@ export class ApiService { getServicesBackendInfo$(): Observable { return this.httpClient.get(`${SERVICES_API_PREFIX}/version`); } + + estimate$(txInput: string) { + return this.httpClient.post(`${SERVICES_API_PREFIX}/accelerator/estimate`, { txInput: txInput }, { observe: 'response' }); + } } diff --git a/frontend/src/app/shared/components/confirmations/confirmations.component.html b/frontend/src/app/shared/components/confirmations/confirmations.component.html index db3f1f38a..4ad3cb33a 100644 --- a/frontend/src/app/shared/components/confirmations/confirmations.component.html +++ b/frontend/src/app/shared/components/confirmations/confirmations.component.html @@ -1,19 +1,19 @@ - - + - + - + - + \ No newline at end of file diff --git a/frontend/src/app/shared/components/confirmations/confirmations.component.scss b/frontend/src/app/shared/components/confirmations/confirmations.component.scss index e69de29bb..c8af7dd76 100644 --- a/frontend/src/app/shared/components/confirmations/confirmations.component.scss +++ b/frontend/src/app/shared/components/confirmations/confirmations.component.scss @@ -0,0 +1,4 @@ +.no-cursor { + cursor: default !important; + pointer-events: none; +} \ No newline at end of file