Merge branch 'master' into hunicus/bid-boost-link

This commit is contained in:
hunicus 2024-04-08 22:17:10 +09:00 committed by GitHub
commit fef9b93a05
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 33 additions and 12 deletions

View file

@ -150,6 +150,14 @@
bottom: 56px; 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 { .cashapp-placeholder {

View file

@ -59,6 +59,7 @@ export class AcceleratePreviewComponent implements OnInit, OnDestroy, OnChanges
defaultBid = 0; defaultBid = 0;
maxCost = 0; maxCost = 0;
userBid = 0; userBid = 0;
accelerationUUID: string;
selectFeeRateIndex = 1; selectFeeRateIndex = 1;
isMobile: boolean = window.innerWidth <= 767.98; isMobile: boolean = window.innerWidth <= 767.98;
user: any = undefined; user: any = undefined;
@ -102,6 +103,7 @@ export class AcceleratePreviewComponent implements OnInit, OnDestroy, OnChanges
} }
ngOnInit() { ngOnInit() {
this.accelerationUUID = window.crypto.randomUUID();
if (this.stateService.ref === 'https://cash.app/') { if (this.stateService.ref === 'https://cash.app/') {
this.paymentType = 'cashapp'; this.paymentType = 'cashapp';
} else { } else {
@ -245,7 +247,8 @@ export class AcceleratePreviewComponent implements OnInit, OnDestroy, OnChanges
} }
this.accelerationSubscription = this.servicesApiService.accelerate$( this.accelerationSubscription = this.servicesApiService.accelerate$(
this.tx.txid, this.tx.txid,
this.userBid this.userBid,
this.accelerationUUID
).subscribe({ ).subscribe({
next: () => { next: () => {
this.audioService.playSound('ascend-chime-cartoon'); this.audioService.playSound('ascend-chime-cartoon');
@ -315,6 +318,10 @@ export class AcceleratePreviewComponent implements OnInit, OnDestroy, OnChanges
this.conversionsSubscription = this.stateService.conversions$.subscribe( this.conversionsSubscription = this.stateService.conversions$.subscribe(
async (conversions) => { async (conversions) => {
if (this.cashAppPay) {
this.cashAppPay.destroy();
}
const maxCostUsd = this.maxCost / 100_000_000 * conversions.USD; const maxCostUsd = this.maxCost / 100_000_000 * conversions.USD;
const paymentRequest = this.payments.paymentRequest({ const paymentRequest = this.payments.paymentRequest({
countryCode: 'US', countryCode: 'US',
@ -348,7 +355,8 @@ export class AcceleratePreviewComponent implements OnInit, OnDestroy, OnChanges
that.userBid, that.userBid,
tokenResult.token, tokenResult.token,
tokenResult.details.cashAppPay.cashtag, tokenResult.details.cashAppPay.cashtag,
tokenResult.details.cashAppPay.referenceId tokenResult.details.cashAppPay.referenceId,
that.accelerationUUID
).subscribe({ ).subscribe({
next: () => { next: () => {
that.audioService.playSound('ascend-chime-cartoon'); that.audioService.playSound('ascend-chime-cartoon');
@ -398,7 +406,7 @@ export class AcceleratePreviewComponent implements OnInit, OnDestroy, OnChanges
@HostListener('window:scroll', ['$event']) // for window scroll events @HostListener('window:scroll', ['$event']) // for window scroll events
onScroll() { onScroll() {
if (this.estimate && this.user && !this.cashappCTA?.nativeElement) { if (this.estimate && !this.cashappCTA?.nativeElement) {
setTimeout(() => { setTimeout(() => {
this.onScroll(); this.onScroll();
}, 200); }, 200);

View file

@ -458,13 +458,18 @@
</ng-template> </ng-template>
<ng-template #firstSeenRow> <ng-template #firstSeenRow>
@if (!isLoadingTx && transactionTime !== -1) { @if (isLoadingTx) {
<ng-container *ngTemplateOutlet="skeletonDetailsRow"></ng-container>
} @else if (transactionTime === -1) {
<tr>
<td i18n="transaction.first-seen|Transaction first seen">First seen</td>
<td><span class="skeleton-loader"></span></td>
</tr>
} @else {
<tr> <tr>
<td i18n="transaction.first-seen|Transaction first seen">First seen</td> <td i18n="transaction.first-seen|Transaction first seen">First seen</td>
<td><i><app-time kind="since" [time]="transactionTime" [fastRender]="true"></app-time></i></td> <td><i><app-time kind="since" [time]="transactionTime" [fastRender]="true"></app-time></i></td>
</tr> </tr>
} @else {
<ng-container *ngTemplateOutlet="skeletonDetailsRow"></ng-container>
} }
</ng-template> </ng-template>
@ -615,7 +620,7 @@
} }
<td> <td>
<div class="effective-fee-container"> <div class="effective-fee-container">
@if (accelerationInfo && (accelerationInfo.acceleratedFeeRate >= tx.effectiveFeePerVsize)) { @if (accelerationInfo?.acceleratedFeeRate && (!tx.effectiveFeePerVsize || accelerationInfo.acceleratedFeeRate >= tx.effectiveFeePerVsize)) {
<app-fee-rate [fee]="accelerationInfo.acceleratedFeeRate"></app-fee-rate> <app-fee-rate [fee]="accelerationInfo.acceleratedFeeRate"></app-fee-rate>
} @else { } @else {
<app-fee-rate [fee]="tx.effectiveFeePerVsize"></app-fee-rate> <app-fee-rate [fee]="tx.effectiveFeePerVsize"></app-fee-rate>

View file

@ -676,7 +676,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
relatives.reduce((prev, val) => prev + val.fee, 0); relatives.reduce((prev, val) => prev + val.fee, 0);
this.tx.effectiveFeePerVsize = totalFees / (totalWeight / 4); this.tx.effectiveFeePerVsize = totalFees / (totalWeight / 4);
} else { } 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) { if (cpfpInfo.acceleration) {
this.tx.acceleration = cpfpInfo.acceleration; this.tx.acceleration = cpfpInfo.acceleration;

View file

@ -128,12 +128,12 @@ export class ServicesApiServices {
return this.httpClient.post<any>(`${SERVICES_API_PREFIX}/accelerator/estimate`, { txInput: txInput }, { observe: 'response' }); return this.httpClient.post<any>(`${SERVICES_API_PREFIX}/accelerator/estimate`, { txInput: txInput }, { observe: 'response' });
} }
accelerate$(txInput: string, userBid: number) { accelerate$(txInput: string, userBid: number, accelerationUUID: string) {
return this.httpClient.post<any>(`${SERVICES_API_PREFIX}/accelerator/accelerate`, { txInput: txInput, userBid: userBid }); return this.httpClient.post<any>(`${SERVICES_API_PREFIX}/accelerator/accelerate`, { txInput: txInput, userBid: userBid, accelerationUUID: accelerationUUID });
} }
accelerateWithCashApp$(txInput: string, userBid: number, token: string, cashtag: string, referenceId: string) { accelerateWithCashApp$(txInput: string, userBid: number, token: string, cashtag: string, referenceId: string, accelerationUUID: string) {
return this.httpClient.post<any>(`${SERVICES_API_PREFIX}/accelerator/accelerate/cashapp`, { txInput: txInput, userBid: userBid, token: token, cashtag: cashtag, referenceId: referenceId }); return this.httpClient.post<any>(`${SERVICES_API_PREFIX}/accelerator/accelerate/cashapp`, { txInput: txInput, userBid: userBid, token: token, cashtag: cashtag, referenceId: referenceId, accelerationUUID: accelerationUUID });
} }
getAccelerations$(): Observable<Acceleration[]> { getAccelerations$(): Observable<Acceleration[]> {