[accelerator] frontend on-demand polling support
This commit is contained in:
parent
b49a6c4cac
commit
7b3cc6372b
@ -9,6 +9,7 @@ import { Transaction } from '../../interfaces/electrs.interface';
|
|||||||
import { MiningStats } from '../../services/mining.service';
|
import { MiningStats } from '../../services/mining.service';
|
||||||
import { IAuth, AuthServiceMempool } from '../../services/auth.service';
|
import { IAuth, AuthServiceMempool } from '../../services/auth.service';
|
||||||
import { EnterpriseService } from '../../services/enterprise.service';
|
import { EnterpriseService } from '../../services/enterprise.service';
|
||||||
|
import { ApiService } from '../../services/api.service';
|
||||||
|
|
||||||
export type PaymentMethod = 'balance' | 'bitcoin' | 'cashapp';
|
export type PaymentMethod = 'balance' | 'bitcoin' | 'cashapp';
|
||||||
|
|
||||||
@ -123,6 +124,7 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public stateService: StateService,
|
public stateService: StateService,
|
||||||
|
private apiService: ApiService,
|
||||||
private servicesApiService: ServicesApiServices,
|
private servicesApiService: ServicesApiServices,
|
||||||
private etaService: EtaService,
|
private etaService: EtaService,
|
||||||
private audioService: AudioService,
|
private audioService: AudioService,
|
||||||
@ -370,10 +372,11 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
|
|||||||
this.accelerationUUID
|
this.accelerationUUID
|
||||||
).subscribe({
|
).subscribe({
|
||||||
next: () => {
|
next: () => {
|
||||||
|
this.apiService.logAccelerationRequest$(this.tx.txid).subscribe();
|
||||||
this.audioService.playSound('ascend-chime-cartoon');
|
this.audioService.playSound('ascend-chime-cartoon');
|
||||||
this.showSuccess = true;
|
this.showSuccess = true;
|
||||||
this.estimateSubscription.unsubscribe();
|
this.estimateSubscription.unsubscribe();
|
||||||
this.moveToStep('paid')
|
this.moveToStep('paid');
|
||||||
},
|
},
|
||||||
error: (response) => {
|
error: (response) => {
|
||||||
this.accelerateError = response.error;
|
this.accelerateError = response.error;
|
||||||
@ -481,6 +484,7 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
|
|||||||
that.accelerationUUID
|
that.accelerationUUID
|
||||||
).subscribe({
|
).subscribe({
|
||||||
next: () => {
|
next: () => {
|
||||||
|
this.apiService.logAccelerationRequest$(this.tx.txid).subscribe();
|
||||||
that.audioService.playSound('ascend-chime-cartoon');
|
that.audioService.playSound('ascend-chime-cartoon');
|
||||||
if (that.cashAppPay) {
|
if (that.cashAppPay) {
|
||||||
that.cashAppPay.destroy();
|
that.cashAppPay.destroy();
|
||||||
@ -530,9 +534,10 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bitcoinPaymentCompleted(): void {
|
bitcoinPaymentCompleted(): void {
|
||||||
|
this.apiService.logAccelerationRequest$(this.tx.txid).subscribe();
|
||||||
this.audioService.playSound('ascend-chime-cartoon');
|
this.audioService.playSound('ascend-chime-cartoon');
|
||||||
this.estimateSubscription.unsubscribe();
|
this.estimateSubscription.unsubscribe();
|
||||||
this.moveToStep('paid')
|
this.moveToStep('paid');
|
||||||
}
|
}
|
||||||
|
|
||||||
isLoggedIn(): boolean {
|
isLoggedIn(): boolean {
|
||||||
|
@ -536,6 +536,10 @@ export class ApiService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logAccelerationRequest$(txid: string): Observable<any> {
|
||||||
|
return this.httpClient.post(this.apiBaseUrl + this.apiBasePath + '/api/v1/acceleration/request/' + txid, '');
|
||||||
|
}
|
||||||
|
|
||||||
// Cache methods
|
// Cache methods
|
||||||
async setBlockAuditLoaded(hash: string) {
|
async setBlockAuditLoaded(hash: string) {
|
||||||
this.blockAuditLoaded[hash] = true;
|
this.blockAuditLoaded[hash] = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user