Browse Source

fix(lnd-ipc): fix linting errors

renovate/lint-staged-8.x
Jack Mallers 8 years ago
parent
commit
6c87563aa2
  1. 34
      app/api/index.js
  2. 7
      app/lnd/config/index.js
  3. 7
      app/lnd/lib/lightning.js
  4. 3
      app/lnd/methods/allchannels.js
  5. 32
      app/lnd/methods/index.js
  6. 4
      app/lnd/methods/invoice.js
  7. 13
      app/lnd/methods/openchannel.js
  8. 11
      app/lnd/utils/index.js
  9. 54
      app/reducers/activity.js
  10. 7
      app/reducers/balance.js
  11. 12
      app/reducers/channels.js
  12. 4
      app/reducers/index.js
  13. 6
      app/reducers/invoice.js
  14. 32
      app/reducers/ipc.js
  15. 6
      app/reducers/payment.js
  16. 12
      app/reducers/peers.js
  17. 2
      app/reducers/ticker.js
  18. 3
      app/routes/app/components/App.js
  19. 1
      app/routes/wallet/components/components/Channels/components/ChannelForm/ChannelForm.js

34
app/api/index.js

@ -1,38 +1,6 @@
import axios from 'axios' import axios from 'axios'
export function callApi(endpoint, method = 'get', data = null) { export default function requestTicker() {
const BASE_URL = 'http://localhost:3000/api/'
let payload
if (data) {
payload = {
headers: {
'Content-Type': 'application/json'
},
method,
data,
url: `${BASE_URL}${endpoint}`
}
} else {
payload = {
headers: {
'Content-Type': 'application/json'
},
method,
url: `${BASE_URL}${endpoint}`
}
}
return axios(payload)
.then(response => response.data)
.catch(error => error)
}
export function callApis(endpoints) {
return axios.all(endpoints.map(endpoint => callApi(endpoint)))
}
export function requestTicker() {
const BASE_URL = 'https://api.coinmarketcap.com/v1/ticker/bitcoin/' const BASE_URL = 'https://api.coinmarketcap.com/v1/ticker/bitcoin/'
return axios({ return axios({
method: 'get', method: 'get',

7
app/lnd/config/index.js

@ -1,4 +1,9 @@
// Cert will be located depending on your machine
// Mac OS X: /Users/user/Library/Application Support/Lnd/tls.cert
// Linux: ~/.lnd/tls.cert
// Windows: TODO find out where cert is located for windows machine
export default { export default {
lightningRpc: `${__dirname}/rpc.proto`, lightningRpc: `${__dirname}/rpc.proto`,
lightningHost: 'localhost:10009' lightningHost: 'localhost:10009',
cert: '/Users/jmow/Library/Application Support/Lnd/tls.cert'
} }

7
app/lnd/lib/lightning.js

@ -1,12 +1,13 @@
import fs from 'fs' import fs from 'fs'
import grpc from 'grpc' import grpc from 'grpc'
import config from '../config'
module.exports = (path, host, cert) => { module.exports = (path, host) => {
process.env['GRPC_SSL_CIPHER_SUITES'] = 'HIGH+ECDSA' process.env.GRPC_SSL_CIPHER_SUITES = 'HIGH+ECDSA'
const rpc = grpc.load(path) const rpc = grpc.load(path)
const lndCert = fs.readFileSync('/Users/jmow/Library/Application Support/Lnd/tls.cert') const lndCert = fs.readFileSync(config.cert)
const credentials = grpc.credentials.createSsl(lndCert) const credentials = grpc.credentials.createSsl(lndCert)
return new rpc.lnrpc.Lightning(host, credentials) return new rpc.lnrpc.Lightning(host, credentials)

3
app/lnd/methods/allchannels.js

@ -1,3 +0,0 @@
export default function(channels, pendingchannels) {
return Promise.all([channels, pendingchannels])
}

32
app/lnd/methods/index.js

@ -1,4 +1,3 @@
import allchannels from './allchannels'
import channelbalance from './channelbalance' import channelbalance from './channelbalance'
import channels from './channels' import channels from './channels'
import connectpeer from './connectpeer' import connectpeer from './connectpeer'
@ -14,41 +13,44 @@ import peers from './peers'
import pendingchannels from './pendingchannels' import pendingchannels from './pendingchannels'
import walletbalance from './walletbalance' import walletbalance from './walletbalance'
export default function(lnd, event, msg, data) { export default function (lnd, event, msg, data) {
switch(msg) { switch (msg) {
case 'info': case 'info':
info(lnd) info(lnd)
.then(info =>event.sender.send('receiveInfo', info)) .then(infoData => event.sender.send('receiveInfo', infoData))
.catch(error => console.log('info error: ', error)) .catch(error => console.log('info error: ', error))
break break
case 'peers': case 'peers':
// Data looks like { peers: [] } // Data looks like { peers: [] }
peers(lnd) peers(lnd)
.then(peers => event.sender.send('receivePeers', peers)) .then(peersData => event.sender.send('receivePeers', peersData))
.catch(error => console.log('peers error: ', error)) .catch(error => console.log('peers error: ', error))
break break
case 'channels': case 'channels':
// Data looks like [ { channels: [channel, channel, channel] }, { total_limbo_balance: 0, pending_open_channels: [], pending_closing_channels: [], pending_force_closing_channels: [] } ] // Data looks like
// [ { channels: [] }, { total_limbo_balance: 0, pending_open_channels: [], pending_closing_channels: [], pending_force_closing_channels: [] } ]
Promise.all([channels, pendingchannels].map(func => func(lnd))) Promise.all([channels, pendingchannels].map(func => func(lnd)))
.then(data => event.sender.send('receiveChannels', { channels: data[0].channels, pendingChannels: data[1] })) .then(channelsData =>
event.sender.send('receiveChannels', { channels: channelsData[0].channels, pendingChannels: channelsData[1] })
)
.catch(error => console.log('channels error: ', error)) .catch(error => console.log('channels error: ', error))
break break
case 'payments': case 'payments':
// Data looks like { payments: [] } // Data looks like { payments: [] }
payments(lnd) payments(lnd)
.then(payments => event.sender.send('receivePayments', payments)) .then(paymentsData => event.sender.send('receivePayments', paymentsData))
.catch(error => console.log('payments error: ', error)) .catch(error => console.log('payments error: ', error))
break break
case 'invoices': case 'invoices':
// Data looks like { invoices: [] } // Data looks like { invoices: [] }
invoices(lnd) invoices(lnd)
.then(invoices => event.sender.send('receiveInvoices', invoices)) .then(invoicesData => event.sender.send('receiveInvoices', invoicesData))
.catch(error => console.log('invoices error: ', error)) .catch(error => console.log('invoices error: ', error))
break break
case 'invoice': case 'invoice':
// Data looks like { invoices: [] } // Data looks like { invoices: [] }
invoice(data.payreq) invoice(data.payreq)
.then(invoice => event.sender.send('receiveInvoice', invoice)) .then(invoiceData => event.sender.send('receiveInvoice', invoiceData))
.catch(error => console.log('invoice error: ', error)) .catch(error => console.log('invoice error: ', error))
break break
case 'balance': case 'balance':
@ -61,7 +63,12 @@ export default function(lnd, event, msg, data) {
// Invoice looks like { r_hash: Buffer, payment_request: '' } // Invoice looks like { r_hash: Buffer, payment_request: '' }
// { memo, value } = data // { memo, value } = data
createinvoice(lnd, data) createinvoice(lnd, data)
.then(invoice => event.sender.send('createdInvoice', Object.assign(invoice, { memo: data.memo, value: data.value, r_hash: new Buffer(invoice.r_hash,'hex').toString('hex') }))) .then(newinvoice =>
event.sender.send(
'createdInvoice',
Object.assign(newinvoice, { memo: data.memo, value: data.value, r_hash: new Buffer(newinvoice.r_hash, 'hex').toString('hex') })
)
)
.catch(error => console.log('createInvoice error: ', error)) .catch(error => console.log('createInvoice error: ', error))
break break
case 'sendPayment': case 'sendPayment':
@ -75,7 +82,7 @@ export default function(lnd, event, msg, data) {
// Response is empty. Streaming updates on channel status and updates // Response is empty. Streaming updates on channel status and updates
// { pubkey, localamt, pushamt } = data // { pubkey, localamt, pushamt } = data
openchannel(lnd, event, data) openchannel(lnd, event, data)
.then(channel => { .then((channel) => {
console.log('CHANNEL: ', channel) console.log('CHANNEL: ', channel)
event.sender.send('channelSuccessful', { channel }) event.sender.send('channelSuccessful', { channel })
}) })
@ -102,6 +109,5 @@ export default function(lnd, event, msg, data) {
.catch(error => console.log('disconnectPeer error: ', error)) .catch(error => console.log('disconnectPeer error: ', error))
break break
default: default:
return
} }
} }

4
app/lnd/methods/invoice.js

@ -3,6 +3,10 @@ import { decodeInvoice } from '../utils'
// LND Get Invoice // LND Get Invoice
export default function invoice(payreq) { export default function invoice(payreq) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
try {
resolve(decodeInvoice(payreq)) resolve(decodeInvoice(payreq))
} catch (error) {
reject(error)
}
}) })
} }

13
app/lnd/methods/openchannel.js

@ -1,18 +1,19 @@
import pushchannel from '../push/channel'
import bitcore from 'bitcore-lib' import bitcore from 'bitcore-lib'
import pushchannel from '../push/channel'
const BufferUtil = bitcore.util.buffer const BufferUtil = bitcore.util.buffer
export default function openchannel(lnd, event, data) { export default function openchannel(lnd, event, payload) {
const { pubkey, localamt, pushamt } = data const { pubkey, localamt, pushamt } = payload
const payload = { const res = {
node_pubkey: BufferUtil.hexToBuffer(pubkey), node_pubkey: BufferUtil.hexToBuffer(pubkey),
local_funding_amount: Number(localamt), local_funding_amount: Number(localamt),
push_sat: Number(pushamt) push_sat: Number(pushamt)
} }
return new Promise((resolve, reject) => return new Promise((resolve, reject) =>
pushchannel(lnd, event, payload) pushchannel(lnd, event, res)
.then(data => resolve(data)) .then(data => resolve(data))
.catch(error => reject(err)) .catch(error => reject(error))
) )
} }

11
app/lnd/utils/index.js

@ -4,7 +4,7 @@ function convertBigEndianBufferToLong(longBuffer) {
let longValue = 0 let longValue = 0
const byteArray = Buffer.from(longBuffer).swap64() const byteArray = Buffer.from(longBuffer).swap64()
for (let i = byteArray.length - 1; i >= 0; i--) { for (let i = byteArray.length - 1; i >= 0; i -= 1) {
longValue = (longValue * 256) + byteArray[i] longValue = (longValue * 256) + byteArray[i]
} }
@ -19,9 +19,6 @@ export function decodeInvoice(payreq) {
+ bufferHexRotated.substr(0, bufferHexRotated.length - 1) + bufferHexRotated.substr(0, bufferHexRotated.length - 1)
const buffer = Buffer.from(bufferHex, 'hex') const buffer = Buffer.from(bufferHex, 'hex')
const pubKeyBuffer = buffer.slice(0, 33)
const pubKeyHex = pubKeyBuffer.toString('hex')
const paymentHashBuffer = buffer.slice(33, 65) const paymentHashBuffer = buffer.slice(33, 65)
const paymentHashHex = paymentHashBuffer.toString('hex') const paymentHashHex = paymentHashBuffer.toString('hex')
@ -32,6 +29,10 @@ export function decodeInvoice(payreq) {
return { return {
payreq, payreq,
amount, amount,
r_hash: paymentHashHex, r_hash: paymentHashHex
} }
} }
export default {
decodeInvoice
}

54
app/reducers/activity.js

@ -1,54 +0,0 @@
import { callApis } from '../api'
// ------------------------------------
// Constants
// ------------------------------------
export const GET_ACTIVITY = 'GET_ACTIVITY'
export const RECEIVE_ACTIVITY = 'RECEIVE_ACTIVITY'
// ------------------------------------
// Actions
// ------------------------------------
export function getActivity() {
return {
type: GET_ACTIVITY
}
}
export function receiveActvity(data) {
return {
type: RECEIVE_ACTIVITY,
payments: data[0].data.payments.reverse(),
invoices: data[1].data.invoices.reverse()
}
}
export const fetchActivity = () => async (dispatch) => {
dispatch(getActivity())
const activity = await callApis(['payments', 'invoices'])
dispatch(receiveActvity(activity))
}
// ------------------------------------
// Action Handlers
// ------------------------------------
const ACTION_HANDLERS = {
[GET_ACTIVITY]: state => ({ ...state, activityLoading: true }),
[RECEIVE_ACTIVITY]: (state, { payments, invoices }) => (
{ ...state, activityLoading: false, payments, invoices }
)
}
// ------------------------------------
// Reducer
// ------------------------------------
const initialState = {
activityLoading: false,
payments: [],
invoices: []
}
export default function activityReducer(state = initialState, action) {
const handler = ACTION_HANDLERS[action.type]
return handler ? handler(state, action) : state
}

7
app/reducers/balance.js

@ -14,13 +14,16 @@ export function getBalance() {
} }
} }
// Send IPC event for balance
export const fetchBalance = () => async (dispatch) => { export const fetchBalance = () => async (dispatch) => {
dispatch(getBalance()) dispatch(getBalance())
ipcRenderer.send('lnd', { msg: 'balance' }) ipcRenderer.send('lnd', { msg: 'balance' })
} }
// Receive IPC event for peers // Receive IPC event for balance
export const receiveBalance = (event, { walletBalance, channelBalance }) => dispatch => dispatch({ type: RECEIVE_BALANCE, walletBalance, channelBalance }) export const receiveBalance = (event, { walletBalance, channelBalance }) => dispatch => (
dispatch({ type: RECEIVE_BALANCE, walletBalance, channelBalance })
)
// ------------------------------------ // ------------------------------------
// Action Handlers // Action Handlers

12
app/reducers/channels.js

@ -66,34 +66,34 @@ export const fetchChannels = () => async (dispatch) => {
export const receiveChannels = (event, { channels, pendingChannels }) => dispatch => dispatch({ type: RECEIVE_CHANNELS, channels, pendingChannels }) export const receiveChannels = (event, { channels, pendingChannels }) => dispatch => dispatch({ type: RECEIVE_CHANNELS, channels, pendingChannels })
// Send IPC event for opening a channel // Send IPC event for opening a channel
export const openChannel = ({ pubkey, localamt, pushamt }) => dispatch => { export const openChannel = ({ pubkey, localamt, pushamt }) => (dispatch) => {
dispatch(openingChannel()) dispatch(openingChannel())
ipcRenderer.send('lnd', { msg: 'openChannel', data: { pubkey, localamt, pushamt } }) ipcRenderer.send('lnd', { msg: 'openChannel', data: { pubkey, localamt, pushamt } })
} }
// TODO: Decide how to handle streamed updates for channels // TODO: Decide how to handle streamed updates for channels
// Receive IPC event for openChannel // Receive IPC event for openChannel
export const channelSuccessful = (event, { channel }) => dispatch => { export const channelSuccessful = () => (dispatch) => {
dispatch(fetchChannels()) dispatch(fetchChannels())
} }
// Receive IPC event for updated channel // Receive IPC event for updated channel
export const pushchannelupdated = (event, data) => dispatch => { export const pushchannelupdated = () => (dispatch) => {
dispatch(fetchChannels()) dispatch(fetchChannels())
} }
// Receive IPC event for channel end // Receive IPC event for channel end
export const pushchannelend = (event, data) => dispatch => { export const pushchannelend = () => (dispatch) => {
dispatch(fetchChannels()) dispatch(fetchChannels())
} }
// Receive IPC event for channel error // Receive IPC event for channel error
export const pushchannelerror = (event, data) => dispatch => { export const pushchannelerror = () => (dispatch) => {
dispatch(fetchChannels()) dispatch(fetchChannels())
} }
// Receive IPC event for channel status // Receive IPC event for channel status
export const pushchannelstatus = (event, data) => dispatch => { export const pushchannelstatus = () => (dispatch) => {
dispatch(fetchChannels()) dispatch(fetchChannels())
} }

4
app/reducers/index.js

@ -9,7 +9,6 @@ import peers from './peers'
import channels from './channels' import channels from './channels'
import form from './form' import form from './form'
import invoice from './invoice' import invoice from './invoice'
import activity from './activity'
const rootReducer = combineReducers({ const rootReducer = combineReducers({
router, router,
@ -20,8 +19,7 @@ const rootReducer = combineReducers({
peers, peers,
channels, channels,
form, form,
invoice, invoice
activity
}) })
export default rootReducer export default rootReducer

6
app/reducers/invoice.js

@ -69,7 +69,7 @@ export function invoiceFailed() {
} }
// Send IPC event for a specific invoice // Send IPC event for a specific invoice
export const fetchInvoice = payreq => dispatch => { export const fetchInvoice = payreq => (dispatch) => {
dispatch(getInvoice()) dispatch(getInvoice())
ipcRenderer.send('lnd', { msg: 'invoice', data: { payreq } }) ipcRenderer.send('lnd', { msg: 'invoice', data: { payreq } })
} }
@ -78,7 +78,7 @@ export const fetchInvoice = payreq => dispatch => {
export const receiveFormInvoice = (event, formInvoice) => dispatch => dispatch({ type: RECEIVE_FORM_INVOICE, formInvoice }) export const receiveFormInvoice = (event, formInvoice) => dispatch => dispatch({ type: RECEIVE_FORM_INVOICE, formInvoice })
// Send IPC event for invoices // Send IPC event for invoices
export const fetchInvoices = () => dispatch => { export const fetchInvoices = () => (dispatch) => {
dispatch(getInvoices()) dispatch(getInvoices())
ipcRenderer.send('lnd', { msg: 'invoices' }) ipcRenderer.send('lnd', { msg: 'invoices' })
} }
@ -87,7 +87,7 @@ export const fetchInvoices = () => dispatch => {
export const receiveInvoices = (event, { invoices }) => dispatch => dispatch({ type: RECEIVE_INVOICES, invoices }) export const receiveInvoices = (event, { invoices }) => dispatch => dispatch({ type: RECEIVE_INVOICES, invoices })
// Send IPC event for creating an invoice // Send IPC event for creating an invoice
export const createInvoice = (amount, memo, currency, rate) => dispatch => { export const createInvoice = (amount, memo, currency, rate) => (dispatch) => {
const value = currency === 'btc' ? btc.btcToSatoshis(amount) : btc.btcToSatoshis(usd.usdToBtc(amount, rate)) const value = currency === 'btc' ? btc.btcToSatoshis(amount) : btc.btcToSatoshis(usd.usdToBtc(amount, rate))
dispatch(sendInvoice()) dispatch(sendInvoice())
ipcRenderer.send('lnd', { msg: 'createInvoice', data: { value, memo } }) ipcRenderer.send('lnd', { msg: 'createInvoice', data: { value, memo } })

32
app/reducers/ipc.js

@ -15,22 +15,22 @@ import { receiveBalance } from './balance'
// Import all receiving IPC event handlers and pass them into createIpc // Import all receiving IPC event handlers and pass them into createIpc
const ipc = createIpc({ const ipc = createIpc({
'receiveInfo': receiveInfo, receiveInfo,
'receivePeers': receivePeers, receivePeers,
'receiveChannels': receiveChannels, receiveChannels,
'receivePayments': receivePayments, receivePayments,
'receiveInvoices': receiveInvoices, receiveInvoices,
'receiveInvoice': receiveFormInvoice, receiveInvoice: receiveFormInvoice,
'receiveBalance': receiveBalance, receiveBalance,
'createdInvoice': createdInvoice, createdInvoice,
'paymentSuccessful': paymentSuccessful, paymentSuccessful,
'channelSuccessful': channelSuccessful, channelSuccessful,
'pushchannelupdated': pushchannelupdated, pushchannelupdated,
'pushchannelend': pushchannelend, pushchannelend,
'pushchannelerror': pushchannelerror, pushchannelerror,
'pushchannelstatus': pushchannelstatus, pushchannelstatus,
'connectSuccess': connectSuccess, connectSuccess,
'disconnectSuccess': disconnectSuccess disconnectSuccess
}) })
export default ipc export default ipc

6
app/reducers/payment.js

@ -1,6 +1,5 @@
import { createSelector } from 'reselect' import { createSelector } from 'reselect'
import { ipcRenderer } from 'electron' import { ipcRenderer } from 'electron'
import { callApi } from '../api'
// ------------------------------------ // ------------------------------------
// Constants // Constants
@ -50,7 +49,7 @@ export function paymentFailed() {
} }
// Send IPC event for payments // Send IPC event for payments
export const fetchPayments = () => dispatch => { export const fetchPayments = () => (dispatch) => {
dispatch(getPayments()) dispatch(getPayments())
ipcRenderer.send('lnd', { msg: 'payments' }) ipcRenderer.send('lnd', { msg: 'payments' })
} }
@ -58,12 +57,13 @@ export const fetchPayments = () => dispatch => {
// Receive IPC event for payments // Receive IPC event for payments
export const receivePayments = (event, { payments }) => dispatch => dispatch({ type: RECEIVE_PAYMENTS, payments }) export const receivePayments = (event, { payments }) => dispatch => dispatch({ type: RECEIVE_PAYMENTS, payments })
export const payInvoice = paymentRequest => dispatch => { export const payInvoice = paymentRequest => (dispatch) => {
dispatch(sendPayment()) dispatch(sendPayment())
ipcRenderer.send('lnd', { msg: 'sendPayment', data: { paymentRequest } }) ipcRenderer.send('lnd', { msg: 'sendPayment', data: { paymentRequest } })
} }
// Receive IPC event for successful payment // Receive IPC event for successful payment
// TODO: Add payment to state, not a total re-fetch
export const paymentSuccessful = () => fetchPayments() export const paymentSuccessful = () => fetchPayments()

12
app/reducers/peers.js

@ -75,7 +75,7 @@ export const fetchPeers = () => async (dispatch) => {
export const receivePeers = (event, { peers }) => dispatch => dispatch({ type: RECEIVE_PEERS, peers }) export const receivePeers = (event, { peers }) => dispatch => dispatch({ type: RECEIVE_PEERS, peers })
// Send IPC event for connecting to a peer // Send IPC event for connecting to a peer
export const connectRequest = ({ pubkey, host }) => dispatch => { export const connectRequest = ({ pubkey, host }) => (dispatch) => {
dispatch(connectPeer()) dispatch(connectPeer())
ipcRenderer.send('lnd', { msg: 'connectPeer', data: { pubkey, host } }) ipcRenderer.send('lnd', { msg: 'connectPeer', data: { pubkey, host } })
} }
@ -84,7 +84,7 @@ export const connectRequest = ({ pubkey, host }) => dispatch => {
export const connectSuccess = (event, peer) => dispatch => dispatch({ type: CONNECT_SUCCESS, peer }) export const connectSuccess = (event, peer) => dispatch => dispatch({ type: CONNECT_SUCCESS, peer })
// Send IPC send for disconnecting from a peer // Send IPC send for disconnecting from a peer
export const disconnectRequest = ({ pubkey }) => dispatch => { export const disconnectRequest = ({ pubkey }) => (dispatch) => {
dispatch(disconnectPeer()) dispatch(disconnectPeer())
ipcRenderer.send('lnd', { msg: 'disconnectPeer', data: { pubkey } }) ipcRenderer.send('lnd', { msg: 'disconnectPeer', data: { pubkey } })
} }
@ -97,11 +97,15 @@ export const disconnectSuccess = (event, { pubkey }) => dispatch => dispatch({ t
// ------------------------------------ // ------------------------------------
const ACTION_HANDLERS = { const ACTION_HANDLERS = {
[DISCONNECT_PEER]: state => ({ ...state, disconnecting: true }), [DISCONNECT_PEER]: state => ({ ...state, disconnecting: true }),
[DISCONNECT_SUCCESS]: (state, { pubkey }) => ({ ...state, disconnecting: false, peer: null, peers: state.peers.filter(peer => peer.pub_key !== pubkey) }), [DISCONNECT_SUCCESS]: (state, { pubkey }) => (
{ ...state, disconnecting: false, peer: null, peers: state.peers.filter(peer => peer.pub_key !== pubkey) }
),
[DISCONNECT_FAILURE]: state => ({ ...state, disconnecting: false }), [DISCONNECT_FAILURE]: state => ({ ...state, disconnecting: false }),
[CONNECT_PEER]: state => ({ ...state, connecting: true }), [CONNECT_PEER]: state => ({ ...state, connecting: true }),
[CONNECT_SUCCESS]: (state, { peer }) => ({ ...state, connecting: false, peerForm: { pubkey: '', host: '', isOpen: false }, peers: [...state.peers, peer] }), [CONNECT_SUCCESS]: (state, { peer }) => (
{ ...state, connecting: false, peerForm: { pubkey: '', host: '', isOpen: false }, peers: [...state.peers, peer] }
),
[CONNECT_FAILURE]: state => ({ ...state, connecting: false }), [CONNECT_FAILURE]: state => ({ ...state, connecting: false }),
[SET_PEER_FORM]: (state, { form }) => ({ ...state, peerForm: Object.assign({}, state.peerForm, form) }), [SET_PEER_FORM]: (state, { form }) => ({ ...state, peerForm: Object.assign({}, state.peerForm, form) }),

2
app/reducers/ticker.js

@ -1,4 +1,4 @@
import { requestTicker } from '../api' import requestTicker from '../api'
// ------------------------------------ // ------------------------------------
// Constants // Constants
// ------------------------------------ // ------------------------------------

3
app/routes/app/components/App.js

@ -1,4 +1,3 @@
import { ipcRenderer } from 'electron'
import React, { Component } from 'react' import React, { Component } from 'react'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import Form from './components/Form' import Form from './components/Form'
@ -29,7 +28,6 @@ class App extends Component {
setForm, setForm,
createInvoice, createInvoice,
payInvoice, payInvoice,
fetchChannels,
fetchInvoice, fetchInvoice,
children children
} = this.props } = this.props
@ -83,7 +81,6 @@ App.propTypes = {
setForm: PropTypes.func.isRequired, setForm: PropTypes.func.isRequired,
createInvoice: PropTypes.func.isRequired, createInvoice: PropTypes.func.isRequired,
payInvoice: PropTypes.func.isRequired, payInvoice: PropTypes.func.isRequired,
fetchChannels: PropTypes.func.isRequired,
fetchInvoice: PropTypes.func.isRequired, fetchInvoice: PropTypes.func.isRequired,
children: PropTypes.object.isRequired children: PropTypes.object.isRequired
} }

1
app/routes/wallet/components/components/Channels/components/ChannelForm/ChannelForm.js

@ -14,7 +14,6 @@ const ChannelForm = ({ form, setForm, ticker, peers, openChannel }) => {
openChannel({ pubkey: node_key, localamt, pushamt }) openChannel({ pubkey: node_key, localamt, pushamt })
setForm({ isOpen: false }) setForm({ isOpen: false })
} }
const customStyles = { const customStyles = {

Loading…
Cancel
Save