Merge pull request #5662 from mempool/nymkappa/remove-useless-unique-uuid-accel
[accelerator] remove useless accelerationUUID
This commit is contained in:
commit
969687ef39
@ -2,7 +2,7 @@
|
|||||||
import { Component, OnInit, OnDestroy, Output, EventEmitter, Input, ChangeDetectorRef, SimpleChanges, HostListener } from '@angular/core';
|
import { Component, OnInit, OnDestroy, Output, EventEmitter, Input, ChangeDetectorRef, SimpleChanges, HostListener } from '@angular/core';
|
||||||
import { Subscription, tap, of, catchError, Observable, switchMap } from 'rxjs';
|
import { Subscription, tap, of, catchError, Observable, switchMap } from 'rxjs';
|
||||||
import { ServicesApiServices } from '@app/services/services-api.service';
|
import { ServicesApiServices } from '@app/services/services-api.service';
|
||||||
import { md5, insecureRandomUUID } from '@app/shared/common.utils';
|
import { md5 } from '@app/shared/common.utils';
|
||||||
import { StateService } from '@app/services/state.service';
|
import { StateService } from '@app/services/state.service';
|
||||||
import { AudioService } from '@app/services/audio.service';
|
import { AudioService } from '@app/services/audio.service';
|
||||||
import { ETA, EtaService } from '@app/services/eta.service';
|
import { ETA, EtaService } from '@app/services/eta.service';
|
||||||
@ -94,7 +94,6 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
|
|||||||
auth: IAuth | null = null;
|
auth: IAuth | null = null;
|
||||||
|
|
||||||
// accelerator stuff
|
// accelerator stuff
|
||||||
accelerationUUID: string;
|
|
||||||
accelerationSubscription: Subscription;
|
accelerationSubscription: Subscription;
|
||||||
difficultySubscription: Subscription;
|
difficultySubscription: Subscription;
|
||||||
estimateSubscription: Subscription;
|
estimateSubscription: Subscription;
|
||||||
@ -138,7 +137,6 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
|
|||||||
private enterpriseService: EnterpriseService,
|
private enterpriseService: EnterpriseService,
|
||||||
) {
|
) {
|
||||||
this.isProdDomain = this.stateService.env.PROD_DOMAINS.indexOf(document.location.hostname) > -1;
|
this.isProdDomain = this.stateService.env.PROD_DOMAINS.indexOf(document.location.hostname) > -1;
|
||||||
this.accelerationUUID = insecureRandomUUID();
|
|
||||||
|
|
||||||
// Check if Apple Pay available
|
// Check if Apple Pay available
|
||||||
// https://developer.apple.com/documentation/apple_pay_on_the_web/apple_pay_js_api/checking_for_apple_pay_availability#overview
|
// https://developer.apple.com/documentation/apple_pay_on_the_web/apple_pay_js_api/checking_for_apple_pay_availability#overview
|
||||||
@ -388,7 +386,6 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
|
|||||||
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.processing = false;
|
this.processing = false;
|
||||||
@ -522,7 +519,6 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
|
|||||||
tokenResult.token,
|
tokenResult.token,
|
||||||
cardTag,
|
cardTag,
|
||||||
`accelerator-${this.tx.txid.substring(0, 15)}-${Math.round(new Date().getTime() / 1000)}`,
|
`accelerator-${this.tx.txid.substring(0, 15)}-${Math.round(new Date().getTime() / 1000)}`,
|
||||||
this.accelerationUUID,
|
|
||||||
costUSD
|
costUSD
|
||||||
).subscribe({
|
).subscribe({
|
||||||
next: () => {
|
next: () => {
|
||||||
@ -622,7 +618,6 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
|
|||||||
tokenResult.token,
|
tokenResult.token,
|
||||||
cardTag,
|
cardTag,
|
||||||
`accelerator-${this.tx.txid.substring(0, 15)}-${Math.round(new Date().getTime() / 1000)}`,
|
`accelerator-${this.tx.txid.substring(0, 15)}-${Math.round(new Date().getTime() / 1000)}`,
|
||||||
this.accelerationUUID,
|
|
||||||
costUSD
|
costUSD
|
||||||
).subscribe({
|
).subscribe({
|
||||||
next: () => {
|
next: () => {
|
||||||
@ -713,7 +708,6 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
|
|||||||
tokenResult.token,
|
tokenResult.token,
|
||||||
tokenResult.details.cashAppPay.cashtag,
|
tokenResult.details.cashAppPay.cashtag,
|
||||||
tokenResult.details.cashAppPay.referenceId,
|
tokenResult.details.cashAppPay.referenceId,
|
||||||
this.accelerationUUID,
|
|
||||||
costUSD
|
costUSD
|
||||||
).subscribe({
|
).subscribe({
|
||||||
next: () => {
|
next: () => {
|
||||||
|
@ -131,20 +131,20 @@ export class ServicesApiServices {
|
|||||||
return this.httpClient.post<any>(`${this.stateService.env.SERVICES_API}/accelerator/estimate`, { txInput: txInput }, { observe: 'response' });
|
return this.httpClient.post<any>(`${this.stateService.env.SERVICES_API}/accelerator/estimate`, { txInput: txInput }, { observe: 'response' });
|
||||||
}
|
}
|
||||||
|
|
||||||
accelerate$(txInput: string, userBid: number, accelerationUUID: string) {
|
accelerate$(txInput: string, userBid: number) {
|
||||||
return this.httpClient.post<any>(`${this.stateService.env.SERVICES_API}/accelerator/accelerate`, { txInput: txInput, userBid: userBid, accelerationUUID: accelerationUUID });
|
return this.httpClient.post<any>(`${this.stateService.env.SERVICES_API}/accelerator/accelerate`, { txInput: txInput, userBid: userBid});
|
||||||
}
|
}
|
||||||
|
|
||||||
accelerateWithCashApp$(txInput: string, token: string, cashtag: string, referenceId: string, accelerationUUID: string, userApprovedUSD: number) {
|
accelerateWithCashApp$(txInput: string, token: string, cashtag: string, referenceId: string, userApprovedUSD: number) {
|
||||||
return this.httpClient.post<any>(`${this.stateService.env.SERVICES_API}/accelerator/accelerate/cashapp`, { txInput: txInput, token: token, cashtag: cashtag, referenceId: referenceId, accelerationUUID: accelerationUUID, userApprovedUSD: userApprovedUSD });
|
return this.httpClient.post<any>(`${this.stateService.env.SERVICES_API}/accelerator/accelerate/cashapp`, { txInput: txInput, token: token, cashtag: cashtag, referenceId: referenceId, userApprovedUSD: userApprovedUSD });
|
||||||
}
|
}
|
||||||
|
|
||||||
accelerateWithApplePay$(txInput: string, token: string, cardTag: string, referenceId: string, accelerationUUID: string, userApprovedUSD: number) {
|
accelerateWithApplePay$(txInput: string, token: string, cardTag: string, referenceId: string, userApprovedUSD: number) {
|
||||||
return this.httpClient.post<any>(`${this.stateService.env.SERVICES_API}/accelerator/accelerate/applePay`, { txInput: txInput, cardTag: cardTag, token: token, referenceId: referenceId, accelerationUUID: accelerationUUID, userApprovedUSD: userApprovedUSD });
|
return this.httpClient.post<any>(`${this.stateService.env.SERVICES_API}/accelerator/accelerate/applePay`, { txInput: txInput, cardTag: cardTag, token: token, referenceId: referenceId, userApprovedUSD: userApprovedUSD });
|
||||||
}
|
}
|
||||||
|
|
||||||
accelerateWithGooglePay$(txInput: string, token: string, cardTag: string, referenceId: string, accelerationUUID: string, userApprovedUSD: number) {
|
accelerateWithGooglePay$(txInput: string, token: string, cardTag: string, referenceId: string, userApprovedUSD: number) {
|
||||||
return this.httpClient.post<any>(`${this.stateService.env.SERVICES_API}/accelerator/accelerate/googlePay`, { txInput: txInput, cardTag: cardTag, token: token, referenceId: referenceId, accelerationUUID: accelerationUUID, userApprovedUSD: userApprovedUSD });
|
return this.httpClient.post<any>(`${this.stateService.env.SERVICES_API}/accelerator/accelerate/googlePay`, { txInput: txInput, cardTag: cardTag, token: token, referenceId: referenceId, userApprovedUSD: userApprovedUSD });
|
||||||
}
|
}
|
||||||
|
|
||||||
getAccelerations$(): Observable<Acceleration[]> {
|
getAccelerations$(): Observable<Acceleration[]> {
|
||||||
|
@ -214,19 +214,6 @@ export function renderSats(value: number, network: string, mode: 'sats' | 'btc'
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function insecureRandomUUID(): string {
|
|
||||||
const hexDigits = '0123456789abcdef';
|
|
||||||
const uuidLengths = [8, 4, 4, 4, 12];
|
|
||||||
let uuid = '';
|
|
||||||
for (const length of uuidLengths) {
|
|
||||||
for (let i = 0; i < length; i++) {
|
|
||||||
uuid += hexDigits[Math.floor(Math.random() * 16)];
|
|
||||||
}
|
|
||||||
uuid += '-';
|
|
||||||
}
|
|
||||||
return uuid.slice(0, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function sleep$(ms: number): Promise<void> {
|
export function sleep$(ms: number): Promise<void> {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user