Browse Source

feature(subscribe channel graph): add subscribe channel graph functionality and log output

renovate/lint-staged-8.x
Jack Mallers 7 years ago
parent
commit
80213c5e44
  1. 12
      app/lnd/subscribe/channelgraph.js
  2. 2
      app/lnd/subscribe/index.js
  3. 10
      app/reducers/channels.js
  4. 6
      app/reducers/ipc.js
  5. 2
      app/routes/channels/components/Channels.js

12
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 }))
}

2
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)
}

10
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

6
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,

2
app/routes/channels/components/Channels.js

@ -115,7 +115,7 @@ class Channels extends Component {
}
</ul>
</section>
<section className={`${styles.refreshContainer} hint--left`} data-hint='Refresh your peers list'>
<section className={`${styles.refreshContainer} hint--left`} data-hint='Refresh your channels list'>
<FaRepeat
style={{ verticalAlign: 'baseline' }}
onClick={refreshClicked}

Loading…
Cancel
Save