diff --git a/app/lnd/subscribe/channelgraph.js b/app/lnd/subscribe/channelgraph.js new file mode 100644 index 00000000..666cd3cf --- /dev/null +++ b/app/lnd/subscribe/channelgraph.js @@ -0,0 +1,12 @@ +/* eslint-disable */ + +export default function subscribeToChannelGraph(mainWindow, lnd) { + console.log('subscribeChannelGraph is happening') + + const call = lnd.subscribeChannelGraph({}) + + call.on('data', channelGraphData => mainWindow.send('channelGraphData', { channelGraphData })) + call.on('end', () => console.log('channel graph end')) + call.on('error', error => console.log('channelgraph error: ', error)) + call.on('status', channelGraphStatus => mainWindow.send('channelGraphStatus', { channelGraphStatus })) +} diff --git a/app/lnd/subscribe/index.js b/app/lnd/subscribe/index.js index 170adf60..7ad6e1b8 100644 --- a/app/lnd/subscribe/index.js +++ b/app/lnd/subscribe/index.js @@ -1,7 +1,9 @@ import subscribeToTransactions from './transactions' import subscribeToInvoices from './invoices' +import subscribeToChannelGraph from './channelgraph' export default (mainWindow, lnd) => { subscribeToTransactions(mainWindow, lnd) subscribeToInvoices(mainWindow, lnd) + subscribeToChannelGraph(mainWindow, lnd) } diff --git a/app/reducers/channels.js b/app/reducers/channels.js index d6225ed7..06c01795 100644 --- a/app/reducers/channels.js +++ b/app/reducers/channels.js @@ -181,6 +181,16 @@ export const pushclosechannelstatus = () => (dispatch) => { dispatch(fetchChannels()) } +// IPC event for channel graph data +export const channelGraphData = (event, data) => (dispatch) => { + console.log('channelGraphData: ', data) +} + +// IPC event for channel graph status +export const channelGraphStatus = (event, data) => (dispatch) => { + console.log('channelGraphStatus: ', data) +} + export function toggleFilterPulldown() { return { type: TOGGLE_PULLDOWN diff --git a/app/reducers/ipc.js b/app/reducers/ipc.js index 2afcdff5..c31a0e42 100644 --- a/app/reducers/ipc.js +++ b/app/reducers/ipc.js @@ -17,8 +17,10 @@ import { pushclosechannelupdated, pushclosechannelend, pushclosechannelerror, - pushclosechannelstatus + pushclosechannelstatus, + channelGraphData, + channelGraphStatus } from './channels' import { lightningPaymentUri } from './payform' import { receivePayments, paymentSuccessful, paymentFailed } from './payment' @@ -70,6 +72,8 @@ const ipc = createIpc({ pushclosechannelend, pushclosechannelerror, pushclosechannelstatus, + channelGraphData, + channelGraphStatus, connectSuccess, connectFailure, diff --git a/app/routes/channels/components/Channels.js b/app/routes/channels/components/Channels.js index f46ec7fd..7fbad947 100644 --- a/app/routes/channels/components/Channels.js +++ b/app/routes/channels/components/Channels.js @@ -115,7 +115,7 @@ class Channels extends Component { } -
+