File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ import type {
77 StopMonetizationPayload ,
88} from '@/shared/messages' ;
99import { getSender , getTabId } from '@/background/utils' ;
10- import { OUTGOING_PAYMENT_POLLING_MAX_DURATION } from '@/background/config' ;
1110import {
1211 ErrorWithKey ,
1312 isOkState ,
@@ -313,11 +312,10 @@ export class MonetizationService {
313312 throw new ErrorWithKey ( 'pay_error_notMonetized' ) ;
314313 }
315314
316- const signal = AbortSignal . timeout ( OUTGOING_PAYMENT_POLLING_MAX_DURATION ) ; // can use other signals as well, such as popup closed etc.
317315 const amountToSend = BigInt (
318316 ( Number ( amount ) * 10 ** walletAddress . assetScale ) . toFixed ( 0 ) ,
319317 ) ;
320- const result = await paymentManager . pay ( amountToSend , signal ) ;
318+ const result = await paymentManager . pay ( amountToSend ) ;
321319
322320 const { sentAmount, debitAmount } = result . amounts ;
323321 return {
Original file line number Diff line number Diff line change @@ -8,7 +8,8 @@ import type { PaymentSession } from './paymentSession';
88import {
99 MIN_PAYMENT_WAIT ,
1010 OUTGOING_PAYMENT_POLLING_MAX_ATTEMPTS ,
11- } from '../config' ;
11+ OUTGOING_PAYMENT_POLLING_MAX_DURATION ,
12+ } from '@/background/config' ;
1213import { bigIntMax } from '../utils' ;
1314import {
1415 ErrorWithKey ,
@@ -183,7 +184,7 @@ export class PaymentManager {
183184 // #endregion
184185
185186 // #region One time payment
186- async pay ( amount : bigint , signal ?: AbortSignal ) {
187+ async pay ( amount : bigint ) {
187188 const payableSessions = this . payableSessions ;
188189 if ( ! payableSessions . length ) {
189190 throw new Error ( 'No sessions to pay' ) ;
@@ -219,6 +220,7 @@ export class PaymentManager {
219220 ) ;
220221
221222 this . logger . debug ( 'polling outgoing payments for completion' ) ;
223+ const signal = AbortSignal . timeout ( OUTGOING_PAYMENT_POLLING_MAX_DURATION ) ; // can combined with other signals as well, such as popup closed etc.
222224 const result = await this . getPayStatus (
223225 outgoingPaymentResults ,
224226 Array . from ( distribution . keys ( ) ) ,
You can’t perform that action at this time.
0 commit comments