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
583 B

import { status } from 'grpc'
import { mainLog } from '../../utils/log'
export default function subscribeToTransactions() {
const call = this.service.subscribeTransactions({})
call.on('data', transaction => {
mainLog.info('TRANSACTION:', transaction)
if (this.mainWindow) {
this.mainWindow.send('newTransaction', { transaction })
}
})
call.on('end', () => mainLog.info('end'))
call.on('error', error => error.code !== status.CANCELLED && mainLog.error(error))
call.on('status', status => mainLog.info('TRANSACTION STATUS: ', status))
return call
}