@@ -4,7 +4,7 @@ import type {
44 WalletAddress ,
55} from '@interledger/open-payments' ;
66import type { Cradle as Cradle_ } from '@/background/container' ;
7- import { PaymentSession } from './paymentSession' ;
7+ import type { PaymentSession } from './paymentSession' ;
88import {
99 MIN_PAYMENT_WAIT ,
1010 OUTGOING_PAYMENT_POLLING_MAX_ATTEMPTS ,
@@ -17,7 +17,6 @@ import {
1717 sleep ,
1818 Timeout ,
1919} from '@/shared/helpers' ;
20- import { isOutOfBalanceError } from './openPayments' ;
2120
2221type Cradle = Pick <
2322 Cradle_ ,
@@ -29,6 +28,7 @@ type Cradle = Pick<
2928 | 'events'
3029 | 'tabState'
3130 | 'message'
31+ | 'PaymentSession'
3232> ;
3333
3434/** Payable amount to increase by {@linkcode Interval.units} every {@linkcode Interval.duration}ms. */
@@ -159,7 +159,6 @@ export class PaymentManager {
159159 this . tabId ,
160160 this . sender ,
161161 this . rootLogger ,
162- PaymentSession ,
163162 this . deps ,
164163 ) ;
165164 this . streams . set ( frameId , stream ) ;
@@ -202,6 +201,7 @@ export class PaymentManager {
202201 payableSessions : PaymentSession [ ] ,
203202 signal ?: AbortSignal ,
204203 ) {
204+ const { isOutOfBalanceError } = await import ( './openPayments' ) ;
205205 const outgoingPayments = new Map < string , OutgoingPayment | null > (
206206 payableSessions . map ( ( session , i ) => [
207207 session . id ,
@@ -497,8 +497,7 @@ export class PaymentStream {
497497 private readonly tabId : TabId ,
498498 private sender : WalletAddress ,
499499 private rootLogger : Cradle [ 'rootLogger' ] ,
500- private PaymentSessionConstructor : typeof PaymentSession ,
501- private deps : ConstructorParameters < typeof PaymentSession > [ 6 ] ,
500+ private deps : Cradle ,
502501 ) {
503502 this . iter = this . sessionsIter ( this ) ;
504503 }
@@ -510,7 +509,7 @@ export class PaymentStream {
510509 session . enable ( ) ; // if was disabled earlier
511510 return session ;
512511 }
513- session = new this . PaymentSessionConstructor (
512+ session = new this . deps . PaymentSession (
514513 receiver ,
515514 sessionId ,
516515 this . tabId ,
0 commit comments