From 86f38adb77c0ef3f7f60941626f5c84ceef2d117 Mon Sep 17 00:00:00 2001 From: Jack Mallers Date: Thu, 4 Jan 2018 20:53:42 -0600 Subject: [PATCH] fix(contacts): small bug fixes with contacts error and UI --- app/components/Contacts/ContactsForm.js | 4 ++-- app/lnd/methods/channelController.js | 10 ++++++---- app/lnd/methods/index.js | 5 ----- app/reducers/channels.js | 5 +++++ app/routes/contacts/components/Contacts.js | 4 ++-- app/variables.scss | 2 +- 6 files changed, 16 insertions(+), 14 deletions(-) diff --git a/app/components/Contacts/ContactsForm.js b/app/components/Contacts/ContactsForm.js index ec7bf54f..2d5f536b 100644 --- a/app/components/Contacts/ContactsForm.js +++ b/app/components/Contacts/ContactsForm.js @@ -44,7 +44,7 @@ class ContactsForm extends React.Component { ) } - + if (activeChannelPubkeys.includes(node.pub_key)) { return ( @@ -80,7 +80,7 @@ class ContactsForm extends React.Component { return ( openChannel({ pubkey: node.pub_key, host: node.addresses[0].addr, local_amt: contactsform.contactCapacity })} > Connect diff --git a/app/lnd/methods/channelController.js b/app/lnd/methods/channelController.js index 410b23d4..eebb4905 100644 --- a/app/lnd/methods/channelController.js +++ b/app/lnd/methods/channelController.js @@ -43,16 +43,18 @@ export function connectAndOpen(lnd, meta, event, payload) { const call = lnd.openChannel(channelPayload, meta) - call.on('data', data => event.sender.send('pushchannelupdated', { data })) - call.on('error', error => event.sender.send('pushchannelerror', { error: error.toString() })) + call.on('data', data => event.sender.send('pushchannelupdated', { pubkey, data })) + call.on('error', error => event.sender.send('pushchannelerror', { pubkey, error: error.toString() })) }) .catch(err => { - console.log('connectPeer err: ', err) + console.log('connect peer err: ', err) + event.sender.send('pushchannelerror', { pubkey, error: err.toString() }) }) } }) .catch(err => { - console.log('listPeers err', err) + console.log('list peer err: ', err) + event.sender.send('pushchannelerror', { pubkey, error: err.toString() }) }) }) } diff --git a/app/lnd/methods/index.js b/app/lnd/methods/index.js index a0b9bf6e..b8c7b1c3 100644 --- a/app/lnd/methods/index.js +++ b/app/lnd/methods/index.js @@ -18,11 +18,6 @@ import * as networkController from './networkController' // TODO - SendPayment // TODO - DeleteAllPayments -// const metadata = new grpc.Metadata() -// var macaroonHex = fs.readFileSync('~/Library/Application Support/Lnd/admin.macaroon').toString('hex') -// metadata.add('macaroon', macaroonHex) - - export default function (lnd, meta, event, msg, data) { switch (msg) { case 'info': diff --git a/app/reducers/channels.js b/app/reducers/channels.js index 0c692b6e..d1acbae3 100644 --- a/app/reducers/channels.js +++ b/app/reducers/channels.js @@ -121,8 +121,13 @@ export const receiveChannels = (event, { channels, pendingChannels }) => dispatc export const openChannel = ({ pubkey, host, local_amt, push_amt }) => (dispatch) => { const localamt = btc.btcToSatoshis(local_amt) + console.log('localamt: ', localamt) + console.log('pubkey: ', pubkey) + console.log('host: ', host) + dispatch(openingChannel()) dispatch(addLoadingPubkey(pubkey)) + ipcRenderer.send('lnd', { msg: 'connectAndOpen', data: { pubkey, host, localamt } }) } diff --git a/app/routes/contacts/components/Contacts.js b/app/routes/contacts/components/Contacts.js index 3dd00d35..f8b5e126 100644 --- a/app/routes/contacts/components/Contacts.js +++ b/app/routes/contacts/components/Contacts.js @@ -116,7 +116,7 @@ class Contacts extends Component { value={searchQuery} onChange={event => updateChannelSearchQuery(event.target.value)} className={`${styles.text} ${styles.input}`} - placeholder='Search your friends list...' + placeholder='Search your contacts list...' type='text' id='channelSearch' /> @@ -153,7 +153,7 @@ class Contacts extends Component { { loadingChannelPubkeys.map(pubkey => { console.log('pubkey: ', pubkey) - + return ( ) diff --git a/app/variables.scss b/app/variables.scss index fdaf7d28..04c81bd6 100644 --- a/app/variables.scss +++ b/app/variables.scss @@ -12,7 +12,7 @@ $bluegrey: #555459; $green: #0bb634; $terminalgreen: #00FF00; -$red: #ff0b00; +$red: #FF556A; $blue: #007bb6; $orange: #FF8A65; $curve: cubic-bezier(0.650, 0.000, 0.450, 1.000); \ No newline at end of file