You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
549 B
18 lines
549 B
import { status } from 'grpc'
|
|
import { mainLog } from '../../utils/log'
|
|
|
|
export default function subscribeToInvoices() {
|
|
const call = this.lnd.subscribeInvoices({})
|
|
|
|
call.on('data', invoice => {
|
|
mainLog.info('INVOICE:', invoice)
|
|
if (this.mainWindow) {
|
|
this.mainWindow.send('invoiceUpdate', { invoice })
|
|
}
|
|
})
|
|
call.on('end', () => mainLog.info('end'))
|
|
call.on('error', error => error.code !== status.CANCELLED && mainLog.error(error))
|
|
call.on('status', status => mainLog.info('INVOICE STATUS:', status))
|
|
|
|
return call
|
|
}
|
|
|