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.
16 lines
496 B
16 lines
496 B
7 years ago
|
import { status } from 'grpc'
|
||
|
|
||
7 years ago
|
export default function subscribeToTransactions(mainWindow, lnd, log) {
|
||
7 years ago
|
const call = lnd.subscribeTransactions({})
|
||
7 years ago
|
|
||
7 years ago
|
call.on('data', transaction => {
|
||
7 years ago
|
log.info('TRANSACTION:', transaction)
|
||
7 years ago
|
mainWindow.send('newTransaction', { transaction })
|
||
|
})
|
||
7 years ago
|
call.on('end', () => log.info('end'))
|
||
7 years ago
|
call.on('error', error => error.code !== status.CANCELLED && log.error(error))
|
||
7 years ago
|
call.on('status', status => log.info('TRANSACTION STATUS: ', status))
|
||
7 years ago
|
|
||
|
return call
|
||
7 years ago
|
}
|