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x-jlpjZ?somXgsjI8mucxM_E*S;}OOuk4QrK8O@w~wzjq@XY^3=uW2HE|-
zk6NBvRYm0~`1Vz}x`WdFeTg`@xN|r-c)vF`Huem|!JwTx!qiMFLqi?Q$)19Vv9Wi<
z0~4^a{QMoh701b$8P1`ek>l@}6DQJ7F_#flEH@IX7zzr_c~f~^S9Mg+vowr1u)C>M
zRWI6>ifQTS1_Me>aB*Y1+L9156BCJaR*u}-TK1lM=O`7izeGrz@*mO3&CTtmBs2$6
zjJdzS^ox~-v6-1X;Vbw2<0Hzp=_evceirZFw~M2o{J0EgSsI<5mJSE62a69Cy88J1
aBf{IdzfRh8_SnG4AxMhKeJ&B!|NcKUOg29N
literal 0
HcmV?d00001
From d3e3650cac33a88403cccc3a4c80a02468cbefcc Mon Sep 17 00:00:00 2001
From: nymkappa <1612910616@pm.me>
Date: Thu, 25 Jul 2024 21:49:48 +0200
Subject: [PATCH 2/5] [accelerator] avoid premature square setup call
---
.../accelerate-checkout.component.ts | 40 +++++++++----------
1 file changed, 19 insertions(+), 21 deletions(-)
diff --git a/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.ts b/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.ts
index f2a2e6e7c..72dfc5de2 100644
--- a/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.ts
+++ b/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.ts
@@ -90,7 +90,6 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
auth: IAuth | null = null;
// accelerator stuff
- square: { appId: string, locationId: string};
accelerationUUID: string;
accelerationSubscription: Subscription;
difficultySubscription: Subscription;
@@ -113,7 +112,6 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
loadingCashapp = false;
loadingApplePay = false;
loadingGooglePay = false;
- cashappError = false;
cashappSubmit: any;
payments: any;
cashAppPay: any;
@@ -170,13 +168,6 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
this.moveToStep('summary');
}
- this.servicesApiService.setupSquare$().subscribe(ids => {
- this.square = {
- appId: ids.squareAppId,
- locationId: ids.squareLocationId
- };
- });
-
this.conversionsSubscription = this.stateService.conversions$.subscribe(
async (conversions) => {
this.conversions = conversions;
@@ -443,20 +434,27 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
}
async initSquare(): Promise {
try {
- //@ts-ignore
- this.payments = window.Square.payments(this.square.appId, this.square.locationId)
- const urlParams = new URLSearchParams(window.location.search);
- if (this._step === 'cashapp' || urlParams.get('cash_request_id')) {
- await this.requestCashAppPayment();
- } else if (this._step === 'applepay') {
- await this.requestApplePayPayment();
- } else if (this._step === 'googlepay') {
- await this.requestGooglePayPayment();
- }
+ this.servicesApiService.setupSquare$().subscribe({
+ next: async (ids) => {
+ //@ts-ignore
+ this.payments = window.Square.payments(ids.squareAppId, ids.squareLocationId)
+ const urlParams = new URLSearchParams(window.location.search);
+ if (this._step === 'cashapp' || urlParams.get('cash_request_id')) {
+ await this.requestCashAppPayment();
+ } else if (this._step === 'applepay') {
+ await this.requestApplePayPayment();
+ } else if (this._step === 'googlepay') {
+ await this.requestGooglePayPayment();
+ }
+ },
+ error: () => {
+ console.debug('Error loading Square Payments');
+ this.accelerateError = 'cannot_setup_square';
+ }
+ });
} catch (e) {
console.debug('Error loading Square Payments', e);
- this.cashappError = true;
- return;
+ this.accelerateError = 'cannot_setup_square';
}
}
From 6081daaceffd11d7de77855554d87cc9c092136a Mon Sep 17 00:00:00 2001
From: Mononaut
Date: Fri, 26 Jul 2024 09:06:47 +0000
Subject: [PATCH 3/5] [accelerator] add missing getters etc
---
.../accelerate-checkout.component.ts | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.ts b/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.ts
index 72dfc5de2..3d97b336e 100644
--- a/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.ts
+++ b/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.ts
@@ -11,7 +11,7 @@ import { IAuth, AuthServiceMempool } from '../../services/auth.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' | 'applepay' | 'googlepay';
export type AccelerationEstimate = {
hasAccess: boolean;
@@ -24,7 +24,7 @@ export type AccelerationEstimate = {
mempoolBaseFee: number;
vsizeFee: number;
pools: number[];
- availablePaymentMethods: {[method: string]: {min: number, max: number}};
+ availablePaymentMethods: Record;
unavailable?: boolean;
options: { // recommended bid options
fee: number; // recommended userBid in sats
@@ -512,6 +512,7 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
this.accelerationUUID
).subscribe({
next: () => {
+ this.apiService.logAccelerationRequest$(this.tx.txid).subscribe();
this.audioService.playSound('ascend-chime-cartoon');
if (this.applePay) {
this.applePay.destroy();
@@ -601,6 +602,7 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
this.accelerationUUID
).subscribe({
next: () => {
+ this.apiService.logAccelerationRequest$(this.tx.txid).subscribe();
this.audioService.playSound('ascend-chime-cartoon');
if (this.googlePay) {
this.googlePay.destroy();
@@ -790,7 +792,7 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
}
get couldPay() {
- return this.couldPayWithBalance || this.couldPayWithBitcoin || this.couldPayWithCashapp || this.couldPayWithApplePay;
+ return this.couldPayWithBalance || this.couldPayWithBitcoin || this.couldPayWithCashapp || this.couldPayWithApplePay || this.couldPayWithGooglePay;
}
get canPayWithBitcoin() {
@@ -855,7 +857,7 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
}
get canPay() {
- return this.canPayWithBalance || this.canPayWithBitcoin || this.canPayWithCashapp || this.canPayWithApplePay;
+ return this.canPayWithBalance || this.canPayWithBitcoin || this.canPayWithCashapp || this.canPayWithApplePay || this.canPayWithGooglePay;
}
get hasAccessToBalanceMode() {
From 6adbda5185ca4fd4dd76763ce812bdd051f87132 Mon Sep 17 00:00:00 2001
From: Mononaut
Date: Fri, 26 Jul 2024 09:27:18 +0000
Subject: [PATCH 4/5] Fix accelerator checkout linting & type errors
---
.../accelerate-checkout.component.ts | 100 +++++++++---------
.../src/app/interfaces/websocket.interface.ts | 2 +-
frontend/src/app/services/state.service.ts | 2 +-
3 files changed, 50 insertions(+), 54 deletions(-)
diff --git a/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.ts b/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.ts
index 3d97b336e..d9f270111 100644
--- a/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.ts
+++ b/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.ts
@@ -1,7 +1,8 @@
+/* eslint-disable no-console */
import { Component, OnInit, OnDestroy, Output, EventEmitter, Input, ChangeDetectorRef, SimpleChanges, HostListener } from '@angular/core';
import { Subscription, tap, of, catchError, Observable, switchMap } from 'rxjs';
import { ServicesApiServices } from '../../services/services-api.service';
-import { md5, nextRoundNumber, insecureRandomUUID } from '../../shared/common.utils';
+import { md5, insecureRandomUUID } from '../../shared/common.utils';
import { StateService } from '../../services/state.service';
import { AudioService } from '../../services/audio.service';
import { ETA, EtaService } from '../../services/eta.service';
@@ -11,7 +12,7 @@ import { IAuth, AuthServiceMempool } from '../../services/auth.service';
import { EnterpriseService } from '../../services/enterprise.service';
import { ApiService } from '../../services/api.service';
-export type PaymentMethod = 'balance' | 'bitcoin' | 'cashapp' | 'applepay' | 'googlepay';
+export type PaymentMethod = 'balance' | 'bitcoin' | 'cashapp' | 'applePay' | 'googlePay';
export type AccelerationEstimate = {
hasAccess: boolean;
@@ -112,14 +113,13 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
loadingCashapp = false;
loadingApplePay = false;
loadingGooglePay = false;
- cashappSubmit: any;
payments: any;
cashAppPay: any;
applePay: any;
googlePay: any;
conversionsSubscription: Subscription;
- conversions: any;
-
+ conversions: Record;
+
// btcpay
loadingBtcpayInvoice = false;
invoice = undefined;
@@ -137,13 +137,13 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
this.accelerationUUID = insecureRandomUUID();
// Check if Apple Pay available
- // @ts-ignore https://developer.apple.com/documentation/apple_pay_on_the_web/apple_pay_js_api/checking_for_apple_pay_availability#overview
- if (window.ApplePaySession) {
+ // https://developer.apple.com/documentation/apple_pay_on_the_web/apple_pay_js_api/checking_for_apple_pay_availability#overview
+ if (window['ApplePaySession']) {
this.applePayEnabled = true;
}
}
- ngOnInit() {
+ ngOnInit(): void {
this.authSubscription$ = this.authService.getAuth$().subscribe((auth) => {
if (this.auth?.user?.userId !== auth?.user?.userId) {
this.auth = auth;
@@ -175,7 +175,7 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
);
}
- ngOnDestroy() {
+ ngOnDestroy(): void {
if (this.estimateSubscription) {
this.estimateSubscription.unsubscribe();
}
@@ -195,7 +195,7 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
}
}
- moveToStep(step: CheckoutStep) {
+ moveToStep(step: CheckoutStep): void {
this._step = step;
if (this.timeoutTimer) {
clearTimeout(this.timeoutTimer);
@@ -232,7 +232,7 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
if (this.step === 'paid') {
this.accelerateError = 'internal_server_error';
}
- }, 120000)
+ }, 120000);
}
this.hasDetails.emit(this._step === 'quote');
}
@@ -250,7 +250,7 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
this.scrollToElement(id, position);
}, timeout);
}
- scrollToElement(id: string, position: ScrollLogicalPosition) {
+ scrollToElement(id: string, position: ScrollLogicalPosition): void {
const acceleratePreviewAnchor = document.getElementById(id);
if (acceleratePreviewAnchor) {
this.cd.markForCheck();
@@ -265,7 +265,7 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
/**
* Accelerator
*/
- fetchEstimate() {
+ fetchEstimate(): void {
if (this.estimateSubscription) {
this.estimateSubscription.unsubscribe();
}
@@ -329,7 +329,7 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
}
}),
- catchError((response) => {
+ catchError(() => {
this.estimate = undefined;
this.quoteError = `cannot_accelerate_tx`;
this.estimateSubscription.unsubscribe();
@@ -400,8 +400,7 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
* Square
*/
insertSquare(): void {
- //@ts-ignore
- if (window.Square) {
+ if (window['Square']) {
return;
}
let statsUrl = 'https://sandbox.web.squarecdn.com/v1/square.js';
@@ -413,19 +412,17 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
statsUrl = 'https://web.squarecdn.com/v1/square.js';
}
- (function() {
+ (function(): void {
const d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
- // @ts-ignore
g.type='text/javascript'; g.src=statsUrl; s.parentNode.insertBefore(g, s);
})();
}
- setupSquare() {
- const init = () => {
+ setupSquare(): void {
+ const init = (): void => {
this.initSquare();
};
- //@ts-ignore
- if (!window.Square) {
+ if (!window['Square']) {
console.debug('Square.js failed to load properly. Retrying in 1 second.');
setTimeout(init, 1000);
} else {
@@ -436,8 +433,7 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
try {
this.servicesApiService.setupSquare$().subscribe({
next: async (ids) => {
- //@ts-ignore
- this.payments = window.Square.payments(ids.squareAppId, ids.squareLocationId)
+ this.payments = window['Square'].payments(ids.squareAppId, ids.squareLocationId);
const urlParams = new URLSearchParams(window.location.search);
if (this._step === 'cashapp' || urlParams.get('cash_request_id')) {
await this.requestCashAppPayment();
@@ -451,7 +447,7 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
console.debug('Error loading Square Payments');
this.accelerateError = 'cannot_setup_square';
}
- });
+ });
} catch (e) {
console.debug('Error loading Square Payments', e);
this.accelerateError = 'cannot_setup_square';
@@ -461,11 +457,11 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
/**
* APPLE PAY
*/
- async requestApplePayPayment() {
+ async requestApplePayPayment(): Promise {
if (this.conversionsSubscription) {
this.conversionsSubscription.unsubscribe();
}
-
+
this.conversionsSubscription = this.stateService.conversions$.subscribe(
async (conversions) => {
this.conversions = conversions;
@@ -552,11 +548,11 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
/**
* GOOGLE PAY
*/
- async requestGooglePayPayment() {
+ async requestGooglePayPayment(): Promise {
if (this.conversionsSubscription) {
this.conversionsSubscription.unsubscribe();
}
-
+
this.conversionsSubscription = this.stateService.conversions$.subscribe(
async (conversions) => {
this.conversions = conversions;
@@ -579,7 +575,7 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
await this.googlePay.attach(`#google-pay-button`, {
buttonType: 'pay',
- onClick: (e) => { console.log(e, 'hi') }
+ onClick: (e) => { console.log(e); }
});
this.loadingGooglePay = false;
@@ -630,7 +626,7 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
)}`;
}
throw new Error(errorMessage);
- }
+ }
});
}
);
@@ -639,11 +635,11 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
/**
* CASHAPP
*/
- async requestCashAppPayment() {
+ async requestCashAppPayment(): Promise {
if (this.conversionsSubscription) {
this.conversionsSubscription.unsubscribe();
}
-
+
this.conversionsSubscription = this.stateService.conversions$.subscribe(
async (conversions) => {
this.conversions = conversions;
@@ -668,7 +664,7 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
referenceId: `accelerator-${this.tx.txid.substring(0, 15)}-${Math.round(new Date().getTime() / 1000)}`
});
- await this.cashAppPay.attach(`#cash-app-pay`, { theme: 'light', size: 'small', shape: 'semiround' })
+ await this.cashAppPay.attach(`#cash-app-pay`, { theme: 'light', size: 'small', shape: 'semiround' });
this.loadingCashapp = false;
this.cashAppPay.addEventListener('ontokenization', event => {
@@ -717,7 +713,7 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
/**
* BTCPay
*/
- async requestBTCPayInvoice() {
+ async requestBTCPayInvoice(): Promise {
this.servicesApiService.generateBTCPayAcceleratorInvoice$(this.tx.txid, this.userBid).pipe(
switchMap(response => {
return this.servicesApiService.retreiveInvoice$(response.btcpayInvoiceId);
@@ -747,60 +743,60 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
/**
* UI events
*/
- selectedOptionChanged(event) {
+ selectedOptionChanged(event): void {
this.selectedOption = event.target.id;
}
- get step() {
+ get step(): CheckoutStep {
return this._step;
}
- get paymentMethods() {
- return Object.keys(this.estimate?.availablePaymentMethods || {});
+ get paymentMethods(): PaymentMethod[] {
+ return Object.keys(this.estimate?.availablePaymentMethods || {}) as PaymentMethod[];
}
- get couldPayWithBitcoin() {
+ get couldPayWithBitcoin(): boolean {
return !!this.estimate?.availablePaymentMethods?.bitcoin;
}
- get couldPayWithCashapp() {
+ get couldPayWithCashapp(): boolean {
if (!this.cashappEnabled) {
return false;
}
return !!this.estimate?.availablePaymentMethods?.cashapp;
}
- get couldPayWithApplePay() {
+ get couldPayWithApplePay(): boolean {
if (!this.applePayEnabled) {
return false;
}
return !!this.estimate?.availablePaymentMethods?.applePay;
}
- get couldPayWithGooglePay() {
+ get couldPayWithGooglePay(): boolean {
if (!this.googlePayEnabled) {
return false;
}
return !!this.estimate?.availablePaymentMethods?.googlePay;
}
- get couldPayWithBalance() {
+ get couldPayWithBalance(): boolean {
if (!this.hasAccessToBalanceMode) {
return false;
}
return !!this.estimate?.availablePaymentMethods?.balance;
}
- get couldPay() {
+ get couldPay(): boolean {
return this.couldPayWithBalance || this.couldPayWithBitcoin || this.couldPayWithCashapp || this.couldPayWithApplePay || this.couldPayWithGooglePay;
}
- get canPayWithBitcoin() {
+ get canPayWithBitcoin(): boolean {
const paymentMethod = this.estimate?.availablePaymentMethods?.bitcoin;
return paymentMethod && this.cost >= paymentMethod.min && this.cost <= paymentMethod.max;
}
- get canPayWithCashapp() {
+ get canPayWithCashapp(): boolean {
if (!this.cashappEnabled || !this.conversions) {
return false;
}
@@ -816,7 +812,7 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
return false;
}
- get canPayWithApplePay() {
+ get canPayWithApplePay(): boolean {
if (!this.applePayEnabled || !this.conversions) {
return false;
}
@@ -832,7 +828,7 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
return false;
}
- get canPayWithGooglePay() {
+ get canPayWithGooglePay(): boolean {
if (!this.googlePayEnabled || !this.conversions) {
return false;
}
@@ -848,7 +844,7 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
return false;
}
- get canPayWithBalance() {
+ get canPayWithBalance(): boolean {
if (!this.hasAccessToBalanceMode) {
return false;
}
@@ -856,11 +852,11 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
return paymentMethod && this.cost >= paymentMethod.min && this.cost <= paymentMethod.max && this.cost <= this.estimate?.userBalance;
}
- get canPay() {
+ get canPay(): boolean {
return this.canPayWithBalance || this.canPayWithBitcoin || this.canPayWithCashapp || this.canPayWithApplePay || this.canPayWithGooglePay;
}
- get hasAccessToBalanceMode() {
+ get hasAccessToBalanceMode(): boolean {
return this.isLoggedIn() && this.estimate?.hasAccess;
}
diff --git a/frontend/src/app/interfaces/websocket.interface.ts b/frontend/src/app/interfaces/websocket.interface.ts
index 22789986e..35e0ffa09 100644
--- a/frontend/src/app/interfaces/websocket.interface.ts
+++ b/frontend/src/app/interfaces/websocket.interface.ts
@@ -7,7 +7,7 @@ export interface WebsocketResponse {
backend?: 'esplora' | 'electrum' | 'none';
block?: BlockExtended;
blocks?: BlockExtended[];
- conversions?: any;
+ conversions?: Record;
txConfirmed?: string;
historicalDate?: string;
mempoolInfo?: MempoolInfo;
diff --git a/frontend/src/app/services/state.service.ts b/frontend/src/app/services/state.service.ts
index 05f1ac69f..8928245a7 100644
--- a/frontend/src/app/services/state.service.ts
+++ b/frontend/src/app/services/state.service.ts
@@ -138,7 +138,7 @@ export class StateService {
blocksSubject$ = new BehaviorSubject([]);
blocks$: Observable;
transactions$ = new BehaviorSubject(null);
- conversions$ = new ReplaySubject(1);
+ conversions$ = new ReplaySubject>(1);
bsqPrice$ = new ReplaySubject(1);
mempoolInfo$ = new ReplaySubject(1);
mempoolBlocks$ = new ReplaySubject(1);
From 12456735754d43c97289f9f7818253b41150332e Mon Sep 17 00:00:00 2001
From: nymkappa <1612910616@pm.me>
Date: Fri, 26 Jul 2024 17:39:58 +0200
Subject: [PATCH 5/5] [accelerator] polish UI
---
.../accelerate-checkout.component.html | 18 ++--
.../accelerate-checkout.component.ts | 4 +-
frontend/src/resources/apple-pay.png | Bin 0 -> 47582 bytes
frontend/src/resources/apple-pay.svg | 84 ------------------
frontend/src/resources/google-pay.png | Bin 34146 -> 30980 bytes
5 files changed, 13 insertions(+), 93 deletions(-)
create mode 100644 frontend/src/resources/apple-pay.png
delete mode 100755 frontend/src/resources/apple-pay.svg
diff --git a/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.html b/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.html
index 04b76055c..b9a176055 100644
--- a/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.html
+++ b/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.html
@@ -402,12 +402,16 @@
}
@if (canPayWithApplePay) {
- @if (canPayWithCashapp) {
}
-
+ @if (canPayWithCashapp) { }
+
+

+
}
@if (canPayWithGooglePay) {
- @if (canPayWithCashapp || canPayWithApplePay) {
}
-
+ @if (canPayWithCashapp || canPayWithApplePay) { }
+
+

+
}