From b679581cf2c468b61113947d0206720f1b17a3c1 Mon Sep 17 00:00:00 2001 From: Mononaut Date: Mon, 8 Apr 2024 09:25:42 +0000 Subject: [PATCH 1/6] Actually fix sticky button --- .../accelerate-preview/accelerate-preview.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 29358e611..49a0eb158 100644 --- a/frontend/src/app/components/accelerate-preview/accelerate-preview.component.ts +++ b/frontend/src/app/components/accelerate-preview/accelerate-preview.component.ts @@ -398,7 +398,7 @@ export class AcceleratePreviewComponent implements OnInit, OnDestroy, OnChanges @HostListener('window:scroll', ['$event']) // for window scroll events onScroll() { - if (this.estimate && this.user && !this.cashappCTA?.nativeElement) { + if (this.estimate && !this.cashappCTA?.nativeElement) { setTimeout(() => { this.onScroll(); }, 200); From a0ef635c928e217b13eb6560efd0b27b79b3e9a5 Mon Sep 17 00:00:00 2001 From: Mononaut Date: Mon, 8 Apr 2024 09:31:51 +0000 Subject: [PATCH 2/6] Slightly wider sticky button --- .../accelerate-preview/accelerate-preview.component.scss | 8 ++++++++ 1 file changed, 8 insertions(+) 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 e9ff233ae..cb4b5922e 100644 --- a/frontend/src/app/components/accelerate-preview/accelerate-preview.component.scss +++ b/frontend/src/app/components/accelerate-preview/accelerate-preview.component.scss @@ -150,6 +150,14 @@ bottom: 56px; } } + + @media (max-width: 400px) { + width: calc(100% + 1.5rem); + margin: 0 -0.75rem; + &.sticky-top, &.sticky-bottom { + width: calc(100vw - 30px); + } + } } .cashapp-placeholder { From 7959188c063235f78cfe4251d487c750b6095760 Mon Sep 17 00:00:00 2001 From: Mononaut Date: Mon, 8 Apr 2024 11:36:22 +0000 Subject: [PATCH 3/6] Fix missing accelerated fee rate again --- .../src/app/components/transaction/transaction.component.html | 2 +- .../src/app/components/transaction/transaction.component.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/components/transaction/transaction.component.html b/frontend/src/app/components/transaction/transaction.component.html index 7662f2eda..a699d0bf0 100644 --- a/frontend/src/app/components/transaction/transaction.component.html +++ b/frontend/src/app/components/transaction/transaction.component.html @@ -615,7 +615,7 @@ }
- @if (accelerationInfo && (accelerationInfo.acceleratedFeeRate >= tx.effectiveFeePerVsize)) { + @if (accelerationInfo?.acceleratedFeeRate && (!tx.effectiveFeePerVsize || accelerationInfo.acceleratedFeeRate >= tx.effectiveFeePerVsize)) { } @else { diff --git a/frontend/src/app/components/transaction/transaction.component.ts b/frontend/src/app/components/transaction/transaction.component.ts index 5b0239d79..30b7842de 100644 --- a/frontend/src/app/components/transaction/transaction.component.ts +++ b/frontend/src/app/components/transaction/transaction.component.ts @@ -673,7 +673,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy { relatives.reduce((prev, val) => prev + val.fee, 0); this.tx.effectiveFeePerVsize = totalFees / (totalWeight / 4); } else { - this.tx.effectiveFeePerVsize = cpfpInfo.effectiveFeePerVsize; + this.tx.effectiveFeePerVsize = cpfpInfo.effectiveFeePerVsize || this.tx.effectiveFeePerVsize || this.tx.feePerVsize || (this.tx.fee / (this.tx.weight / 4)); } if (cpfpInfo.acceleration) { this.tx.acceleration = cpfpInfo.acceleration; From d7a4a95c05546236a285ca385773c303cef152f8 Mon Sep 17 00:00:00 2001 From: nymkappa <1612910616@pm.me> Date: Mon, 8 Apr 2024 21:43:06 +0900 Subject: [PATCH 4/6] [accelerator] avoid duplicated accel request --- .../accelerate-preview/accelerate-preview.component.ts | 8 ++++++-- frontend/src/app/services/services-api.service.ts | 8 ++++---- 2 files changed, 10 insertions(+), 6 deletions(-) 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 29358e611..ec510b31a 100644 --- a/frontend/src/app/components/accelerate-preview/accelerate-preview.component.ts +++ b/frontend/src/app/components/accelerate-preview/accelerate-preview.component.ts @@ -59,6 +59,7 @@ export class AcceleratePreviewComponent implements OnInit, OnDestroy, OnChanges defaultBid = 0; maxCost = 0; userBid = 0; + accelerationUUID: string; selectFeeRateIndex = 1; isMobile: boolean = window.innerWidth <= 767.98; user: any = undefined; @@ -102,6 +103,7 @@ export class AcceleratePreviewComponent implements OnInit, OnDestroy, OnChanges } ngOnInit() { + this.accelerationUUID = window.crypto.randomUUID(); if (this.stateService.ref === 'https://cash.app/') { this.paymentType = 'cashapp'; } else { @@ -245,7 +247,8 @@ export class AcceleratePreviewComponent implements OnInit, OnDestroy, OnChanges } this.accelerationSubscription = this.servicesApiService.accelerate$( this.tx.txid, - this.userBid + this.userBid, + this.accelerationUUID ).subscribe({ next: () => { this.audioService.playSound('ascend-chime-cartoon'); @@ -348,7 +351,8 @@ export class AcceleratePreviewComponent implements OnInit, OnDestroy, OnChanges that.userBid, tokenResult.token, tokenResult.details.cashAppPay.cashtag, - tokenResult.details.cashAppPay.referenceId + tokenResult.details.cashAppPay.referenceId, + that.accelerationUUID ).subscribe({ next: () => { that.audioService.playSound('ascend-chime-cartoon'); diff --git a/frontend/src/app/services/services-api.service.ts b/frontend/src/app/services/services-api.service.ts index 4a8314e4b..4cc05294f 100644 --- a/frontend/src/app/services/services-api.service.ts +++ b/frontend/src/app/services/services-api.service.ts @@ -128,12 +128,12 @@ export class ServicesApiServices { return this.httpClient.post(`${SERVICES_API_PREFIX}/accelerator/estimate`, { txInput: txInput }, { observe: 'response' }); } - accelerate$(txInput: string, userBid: number) { - return this.httpClient.post(`${SERVICES_API_PREFIX}/accelerator/accelerate`, { txInput: txInput, userBid: userBid }); + accelerate$(txInput: string, userBid: number, accelerationUUID: string) { + return this.httpClient.post(`${SERVICES_API_PREFIX}/accelerator/accelerate`, { txInput: txInput, userBid: userBid, accelerationUUID: accelerationUUID }); } - accelerateWithCashApp$(txInput: string, userBid: number, token: string, cashtag: string, referenceId: string) { - return this.httpClient.post(`${SERVICES_API_PREFIX}/accelerator/accelerate/cashapp`, { txInput: txInput, userBid: userBid, token: token, cashtag: cashtag, referenceId: referenceId }); + accelerateWithCashApp$(txInput: string, userBid: number, token: string, cashtag: string, referenceId: string, accelerationUUID: string) { + return this.httpClient.post(`${SERVICES_API_PREFIX}/accelerator/accelerate/cashapp`, { txInput: txInput, userBid: userBid, token: token, cashtag: cashtag, referenceId: referenceId, accelerationUUID: accelerationUUID }); } getAccelerations$(): Observable { From 4c807866a34918472f01300b6995478dcd5762de Mon Sep 17 00:00:00 2001 From: softsimon Date: Mon, 8 Apr 2024 21:44:29 +0900 Subject: [PATCH 5/6] Fix first seen skeleton loader --- .../components/transaction/transaction.component.html | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/components/transaction/transaction.component.html b/frontend/src/app/components/transaction/transaction.component.html index a699d0bf0..9eec29c93 100644 --- a/frontend/src/app/components/transaction/transaction.component.html +++ b/frontend/src/app/components/transaction/transaction.component.html @@ -458,13 +458,18 @@ - @if (!isLoadingTx && transactionTime !== -1) { + @if (isLoadingTx) { + + } @else if (transactionTime === -1) { + + First seen + + + } @else { First seen - } @else { - } From 88de5412f8afdd676fe1a770a8e007a7e1762bcc Mon Sep 17 00:00:00 2001 From: nymkappa <1612910616@pm.me> Date: Mon, 8 Apr 2024 21:55:47 +0900 Subject: [PATCH 6/6] [accelerator] reset cashapp upon price update --- .../accelerate-preview/accelerate-preview.component.ts | 4 ++++ 1 file changed, 4 insertions(+) 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 ec510b31a..e85ebb9e6 100644 --- a/frontend/src/app/components/accelerate-preview/accelerate-preview.component.ts +++ b/frontend/src/app/components/accelerate-preview/accelerate-preview.component.ts @@ -318,6 +318,10 @@ export class AcceleratePreviewComponent implements OnInit, OnDestroy, OnChanges this.conversionsSubscription = this.stateService.conversions$.subscribe( async (conversions) => { + if (this.cashAppPay) { + this.cashAppPay.destroy(); + } + const maxCostUsd = this.maxCost / 100_000_000 * conversions.USD; const paymentRequest = this.payments.paymentRequest({ countryCode: 'US',