This commit is contained in:
boufni95 2024-06-24 22:43:47 +02:00
parent 39b70c7b42
commit 655d3a9373

View file

@ -24,7 +24,7 @@ export class LiquidityProvider {
invoicePaidCb: InvoicePaidCb invoicePaidCb: InvoicePaidCb
connecting = false connecting = false
readyInterval: NodeJS.Timeout readyInterval: NodeJS.Timeout
queue: { res: (usable: boolean) => void }[] = [] queue: ((usable: boolean) => void)[] = []
// make the sub process accept client // make the sub process accept client
constructor(pubDestination: string, invoicePaidCb: InvoicePaidCb) { constructor(pubDestination: string, invoicePaidCb: InvoicePaidCb) {
if (!pubDestination) { if (!pubDestination) {
@ -55,7 +55,7 @@ export class LiquidityProvider {
return true return true
} }
return new Promise<boolean>(res => { return new Promise<boolean>(res => {
this.queue.push({ res }) this.queue.push(res)
}) })
} }
@ -70,7 +70,7 @@ export class LiquidityProvider {
if (this.latestMaxWithdrawable === null) { if (this.latestMaxWithdrawable === null) {
return return
} }
this.queue.forEach(q => q.res(true)) this.queue.forEach(q => q(true))
this.log("subbing to user operations") this.log("subbing to user operations")
this.client.GetLiveUserOperations(res => { this.client.GetLiveUserOperations(res => {
console.log("got user operation", res) console.log("got user operation", res)