jackmallers
7 years ago
committed by
GitHub
6 changed files with 48 additions and 11 deletions
@ -1,7 +1,14 @@ |
|||||
import config from './config' |
import config from './config' |
||||
import lightning from './lib/lightning' |
import lightning from './lib/lightning' |
||||
|
import subscribe from './subscribe' |
||||
import methods from './methods' |
import methods from './methods' |
||||
|
|
||||
const lnd = lightning(config.lightningRpc, config.lightningHost) |
const lnd = lightning(config.lightningRpc, config.lightningHost) |
||||
|
|
||||
export default (event, msg, data) => methods(lnd, event, msg, data) |
const lndSubscribe = mainWindow => subscribe(mainWindow, lnd) |
||||
|
const lndMethods = (event, msg, data) => methods(lnd, event, msg, data) |
||||
|
|
||||
|
export default { |
||||
|
lndMethods, |
||||
|
lndSubscribe |
||||
|
} |
||||
|
@ -0,0 +1,5 @@ |
|||||
|
import subscribeToTransactions from './transactions' |
||||
|
|
||||
|
export default (mainWindow, lnd) => { |
||||
|
subscribeToTransactions(mainWindow, lnd) |
||||
|
} |
@ -0,0 +1,8 @@ |
|||||
|
export default function subscribeToTransactions(mainWindow, lnd) { |
||||
|
const call = lnd.subscribeTransactions({}) |
||||
|
|
||||
|
call.on('data', transaction => mainWindow.send('newTransaction', { transaction })) |
||||
|
call.on('end', () => console.log('end')) |
||||
|
call.on('error', error => console.log('error: ', error)) |
||||
|
call.on('status', status => console.log('status: ', status)) |
||||
|
} |
Loading…
Reference in new issue