Browse Source

fix(lint): fix linting errors

renovate/lint-staged-8.x
Jack Mallers 8 years ago
parent
commit
6713d1d15d
  1. 4
      app/lnd/methods/closechannel.js
  2. 1
      app/lnd/push/closechannel.js
  3. 16
      app/reducers/channels.js
  4. 8
      app/reducers/ipc.js
  5. 8
      app/routes/wallet/components/components/Channels/Channels.js
  6. 6
      test/reducers/__snapshots__/channels.spec.js.snap

4
app/lnd/methods/closechannel.js

@ -5,7 +5,7 @@ const BufferUtil = bitcore.util.buffer
export default function closechannel(lnd, event, payload) { export default function closechannel(lnd, event, payload) {
const tx = payload.channel_point.funding_txid.match(/.{2}/g).reverse().join('') const tx = payload.channel_point.funding_txid.match(/.{2}/g).reverse().join('')
const res = { const res = {
channel_point: { channel_point: {
funding_txid: BufferUtil.hexToBuffer(tx), funding_txid: BufferUtil.hexToBuffer(tx),
output_index: Number(payload.channel_point.output_index) output_index: Number(payload.channel_point.output_index)
@ -17,4 +17,4 @@ export default function closechannel(lnd, event, payload) {
.then(data => resolve(data)) .then(data => resolve(data))
.catch(error => reject(error)) .catch(error => reject(error))
) )
} }

1
app/lnd/push/closechannel.js

@ -10,7 +10,6 @@ export default function pushclosechannel(lnd, event, payload) {
resolve(null, payload) resolve(null, payload)
} catch (error) { } catch (error) {
console.log('error: ', error)
reject(error, null) reject(error, null)
} }
}) })

16
app/reducers/channels.js

@ -111,7 +111,19 @@ export const pushchannelstatus = () => (dispatch) => {
export const closeChannel = ({ channel_point }) => (dispatch) => { export const closeChannel = ({ channel_point }) => (dispatch) => {
dispatch(closingChannel()) dispatch(closingChannel())
const channelPoint = channel_point.split(':') const channelPoint = channel_point.split(':')
ipcRenderer.send('lnd', { msg: 'closeChannel', data: { channel_point: { funding_txid: channelPoint[0], output_index: channelPoint[1] }, force: true } }) ipcRenderer.send(
'lnd',
{
msg: 'closeChannel',
data: {
channel_point: {
funding_txid: channelPoint[0],
output_index: channelPoint[1]
},
force: true
}
}
)
} }
// TODO: Decide how to handle streamed updates for closing channels // TODO: Decide how to handle streamed updates for closing channels
@ -203,7 +215,7 @@ const initialState = {
push_amt: '' push_amt: ''
}, },
openingChannel: false, openingChannel: false,
closeChannel: false closingChannel: false
} }
export default function channelsReducer(state = initialState, action) { export default function channelsReducer(state = initialState, action) {

8
app/reducers/ipc.js

@ -5,7 +5,7 @@ import { receiveCryptocurrency } from './ticker'
import { receivePeers, connectSuccess, disconnectSuccess } from './peers' import { receivePeers, connectSuccess, disconnectSuccess } from './peers'
import { import {
receiveChannels, receiveChannels,
channelSuccessful, channelSuccessful,
pushchannelupdated, pushchannelupdated,
pushchannelend, pushchannelend,
@ -16,7 +16,7 @@ import {
pushclosechannelupdated, pushclosechannelupdated,
pushclosechannelend, pushclosechannelend,
pushclosechannelerror, pushclosechannelerror,
pushclosechannelstatus, pushclosechannelstatus
} from './channels' } from './channels'
import { receivePayments, paymentSuccessful } from './payment' import { receivePayments, paymentSuccessful } from './payment'
@ -38,7 +38,7 @@ const ipc = createIpc({
createdInvoice, createdInvoice,
receiveBalance, receiveBalance,
paymentSuccessful, paymentSuccessful,
channelSuccessful, channelSuccessful,
@ -54,7 +54,7 @@ const ipc = createIpc({
connectSuccess, connectSuccess,
disconnectSuccess, disconnectSuccess,
receiveAddress, receiveAddress,
receiveCryptocurrency receiveCryptocurrency
}) })

8
app/routes/wallet/components/components/Channels/Channels.js

@ -24,7 +24,13 @@ const Channels = ({
explorerLinkBase explorerLinkBase
}) => ( }) => (
<div className={styles.channels}> <div className={styles.channels}>
<ChannelModal isOpen={channelModalOpen} resetChannel={setChannel} channel={modalChannel} explorerLinkBase={explorerLinkBase} closeChannel={closeChannel} /> <ChannelModal
isOpen={channelModalOpen}
resetChannel={setChannel}
channel={modalChannel}
explorerLinkBase={explorerLinkBase}
closeChannel={closeChannel}
/>
<ChannelForm form={channelForm} setForm={setChannelForm} ticker={ticker} peers={peers} openChannel={openChannel} currentTicker={currentTicker} /> <ChannelForm form={channelForm} setForm={setChannelForm} ticker={ticker} peers={peers} openChannel={openChannel} currentTicker={currentTicker} />
<div className={styles.header}> <div className={styles.header}>
<h3>Channels</h3> <h3>Channels</h3>

6
test/reducers/__snapshots__/channels.spec.js.snap

@ -11,6 +11,7 @@ Object {
}, },
"channels": Array [], "channels": Array [],
"channelsLoading": true, "channelsLoading": true,
"closingChannel": false,
"openingChannel": false, "openingChannel": false,
"pendingChannels": Object { "pendingChannels": Object {
"pending_closing_channels": Array [], "pending_closing_channels": Array [],
@ -32,6 +33,7 @@ Object {
}, },
"channels": Array [], "channels": Array [],
"channelsLoading": false, "channelsLoading": false,
"closingChannel": false,
"openingChannel": true, "openingChannel": true,
"pendingChannels": Object { "pendingChannels": Object {
"pending_closing_channels": Array [], "pending_closing_channels": Array [],
@ -56,6 +58,7 @@ Object {
2, 2,
], ],
"channelsLoading": false, "channelsLoading": false,
"closingChannel": false,
"openingChannel": false, "openingChannel": false,
"pendingChannels": Array [ "pendingChannels": Array [
3, 3,
@ -75,6 +78,7 @@ Object {
}, },
"channels": Array [], "channels": Array [],
"channelsLoading": false, "channelsLoading": false,
"closingChannel": false,
"openingChannel": false, "openingChannel": false,
"pendingChannels": Object { "pendingChannels": Object {
"pending_closing_channels": Array [], "pending_closing_channels": Array [],
@ -96,6 +100,7 @@ Object {
}, },
"channels": Array [], "channels": Array [],
"channelsLoading": false, "channelsLoading": false,
"closingChannel": false,
"openingChannel": false, "openingChannel": false,
"pendingChannels": Object { "pendingChannels": Object {
"pending_closing_channels": Array [], "pending_closing_channels": Array [],
@ -117,6 +122,7 @@ Object {
}, },
"channels": Array [], "channels": Array [],
"channelsLoading": false, "channelsLoading": false,
"closingChannel": false,
"openingChannel": false, "openingChannel": false,
"pendingChannels": Object { "pendingChannels": Object {
"pending_closing_channels": Array [], "pending_closing_channels": Array [],

Loading…
Cancel
Save