[accelerator] accelerate with lightning

This commit is contained in:
nymkappa
2024-06-26 18:35:36 +09:00
committed by Mononaut
parent f1572f0038
commit 66a88b8422
10 changed files with 453 additions and 48 deletions

View File

@@ -75,7 +75,7 @@
} @else {
<app-time kind="until" [time]="eta.time" [fastRender]="false" [fixedRender]="true"></app-time>
}
@if (!showAccelerationSummary && isMobile && paymentType === 'cashapp' && accelerationEligible && !tx.acceleration && acceleratorAvailable && accelerateCtaType === 'button' && !tx?.acceleration) {
@if (!showAccelerationSummary && isMobile && !tx.acceleration && acceleratorAvailable && accelerateCtaType === 'button' && !tx?.acceleration) {
<a class="btn btn-sm accelerate btn-small-height" i18n="transaction.accelerate|Accelerate button label" (click)="onAccelerateClicked()">Accelerate</a>
}
</span>
@@ -116,7 +116,7 @@
<div class="bottom-panel">
@if (showAccelerationSummary && !accelerationFlowCompleted) {
<app-accelerate-checkout *ngIf="(da$ | async) as da;" [txid]="tx.txid" [eta]="mempoolPosition?.block >= 7 ? null : da.adjustedTimeAvg * (mempoolPosition.block + 1) + now + da.timeOffset" (close)="accelerationFlowCompleted = true" [scrollEvent]="scrollIntoAccelPreview" class="h-100 w-100"></app-accelerate-checkout>
<app-accelerate-checkout *ngIf="(da$ | async) as da;" [cashappEnabled]="accelerationEligible" [txid]="tx.txid" [eta]="mempoolPosition?.block >= 7 ? null : da.adjustedTimeAvg * (mempoolPosition.block + 1) + now + da.timeOffset" (close)="accelerationFlowCompleted = true" [scrollEvent]="scrollIntoAccelPreview" class="h-100 w-100"></app-accelerate-checkout>
} @else {
@if (tx?.acceleration && !tx.status?.confirmed) {
<div class="progress-icon">

View File

@@ -107,7 +107,6 @@ export class TrackerComponent implements OnInit, OnDestroy {
now = Date.now();
da$: Observable<DifficultyAdjustment>;
isMobile: boolean;
paymentType: 'bitcoin' | 'cashapp' = 'bitcoin';
trackerStage: TrackerStage = 'waiting';
@@ -158,9 +157,6 @@ export class TrackerComponent implements OnInit, OnDestroy {
this.acceleratorAvailable = this.stateService.env.OFFICIAL_MEMPOOL_SPACE && this.stateService.env.ACCELERATOR && this.stateService.network === '';
if (this.acceleratorAvailable && this.stateService.referrer === 'https://cash.app/') {
this.paymentType = 'cashapp';
}
const urlParams = new URLSearchParams(window.location.search);
if (urlParams.get('cash_request_id')) {
this.showAccelerationSummary = true;
@@ -390,11 +386,9 @@ export class TrackerComponent implements OnInit, OnDestroy {
this.trackerStage = 'replaced';
}
this.showAccelerationSummary = true;
if (txPosition.position?.block > 0 && this.tx.weight < 4000) {
this.accelerationEligible = true;
if (this.acceleratorAvailable && this.paymentType === 'cashapp') {
this.showAccelerationSummary = true;
}
}
}
} else {