Browse Source

fix(payment): fix payment error

renovate/lint-staged-8.x
Jack Mallers 7 years ago
parent
commit
ac50de138c
  1. 25
      app/components/Channels/OpenPendingChannel.js
  2. 11
      app/components/Channels/OpenPendingChannel.scss
  3. 2
      app/components/Peers/PeerModal.scss
  4. 38
      app/components/Wallet/ReceiveModal.js
  5. 56
      app/components/Wallet/ReceiveModal.scss
  6. 9
      app/lnd/methods/paymentsController.js
  7. 2
      app/main.dev.js

25
app/components/Channels/OpenPendingChannel.js

@ -4,17 +4,20 @@ import PropTypes from 'prop-types'
import { btc } from 'utils' import { btc } from 'utils'
import styles from './OpenPendingChannel.scss' import styles from './OpenPendingChannel.scss'
const OpenPendingChannel = ({ ticker, channel: { channel }, currentTicker, explorerLinkBase }) => ( const OpenPendingChannel = ({ ticker, channel, currentTicker, explorerLinkBase }) => (
<li className={styles.channel} onClick={() => shell.openExternal(`${explorerLinkBase}/tx/${channel.channel_point.split(':')[0]}`)}> <li className={styles.channel} onClick={() => shell.openExternal(`${explorerLinkBase}/tx/${channel.channel.channel_point.split(':')[0]}`)}>
<h1 className={styles.pending}>Opening Channel...</h1> <div className={styles.pending}>
<h1>Opening Channel...</h1>
<span>Blocks till open: {channel.blocks_till_open}</span>
</div>
<div className={styles.left}> <div className={styles.left}>
<section className={styles.remotePubkey}> <section className={styles.remotePubkey}>
<span>Remote Pubkey</span> <span>Remote Pubkey</span>
<h4>{channel.remote_node_pub}</h4> <h4>{channel.channel.remote_node_pub}</h4>
</section> </section>
<section className={styles.channelPoint}> <section className={styles.channelPoint}>
<span>Channel Point</span> <span>Channel Point</span>
<h4>{channel.channel_point}</h4> <h4>{channel.channel.channel_point}</h4>
</section> </section>
</div> </div>
<div className={styles.right}> <div className={styles.right}>
@ -23,9 +26,9 @@ const OpenPendingChannel = ({ ticker, channel: { channel }, currentTicker, explo
<h2> <h2>
{ {
ticker.currency === 'btc' ? ticker.currency === 'btc' ?
btc.satoshisToBtc(channel.capacity) btc.satoshisToBtc(channel.channel.capacity)
: :
btc.satoshisToUsd(channel.capacity, currentTicker.price_usd) btc.satoshisToUsd(channel.channel.capacity, currentTicker.price_usd)
} }
</h2> </h2>
</section> </section>
@ -34,9 +37,9 @@ const OpenPendingChannel = ({ ticker, channel: { channel }, currentTicker, explo
<h4> <h4>
{ {
ticker.currency === 'btc' ? ticker.currency === 'btc' ?
btc.satoshisToBtc(channel.local_balance) btc.satoshisToBtc(channel.channel.local_balance)
: :
btc.satoshisToUsd(channel.local_balance, currentTicker.price_usd) btc.satoshisToUsd(channel.channel.local_balance, currentTicker.price_usd)
} }
</h4> </h4>
<span>Local</span> <span>Local</span>
@ -45,9 +48,9 @@ const OpenPendingChannel = ({ ticker, channel: { channel }, currentTicker, explo
<h4> <h4>
{ {
ticker.currency === 'btc' ? ticker.currency === 'btc' ?
btc.satoshisToBtc(channel.remote_balance) btc.satoshisToBtc(channel.channel.remote_balance)
: :
btc.satoshisToUsd(channel.remote_balance, currentTicker.price_usd) btc.satoshisToUsd(channel.channel.remote_balance, currentTicker.price_usd)
} }
</h4> </h4>
<span>Remote</span> <span>Remote</span>

11
app/components/Channels/OpenPendingChannel.scss

@ -13,16 +13,23 @@
opacity: 0.5; opacity: 0.5;
.pending { .pending {
color: $main;
position: absolute; position: absolute;
top: 0; top: 0;
left: 10px; left: 10px;
padding: 10px; padding: 10px;
text-transform: uppercase; text-transform: uppercase;
font-weight: bold; font-weight: bold;
h1 {
color: $main;
font-size: 10px; font-size: 10px;
} }
span {
font-size: 8px;
}
}
&:first-child { &:first-child {
border: none; border: none;
} }
@ -30,7 +37,7 @@
.left, .right { .left, .right {
padding: 0 10px; padding: 0 10px;
margin-bottom: 5; margin-bottom: 5;
margin-top: 25px; margin-top: 40px;
section { section {
margin-bottom: 20px; margin-bottom: 20px;

2
app/components/Peers/PeerModal.scss

@ -25,7 +25,7 @@
h2 { h2 {
color: $darkestgrey; color: $darkestgrey;
font-size: 14px; font-size: 12px;
text-align: center; text-align: center;
} }
} }

38
app/components/Wallet/ReceiveModal.js

@ -4,6 +4,7 @@ import ReactModal from 'react-modal'
import copy from 'copy-to-clipboard' import copy from 'copy-to-clipboard'
import QRCode from 'qrcode.react' import QRCode from 'qrcode.react'
import { showNotification } from 'notifications' import { showNotification } from 'notifications'
import { MdClose } from 'react-icons/lib/md'
import styles from './ReceiveModal.scss' import styles from './ReceiveModal.scss'
const ReceiveModal = ({ isOpen, hideActivityModal, pubkey, address, newAddress }) => { const ReceiveModal = ({ isOpen, hideActivityModal, pubkey, address, newAddress }) => {
@ -16,8 +17,10 @@ const ReceiveModal = ({ isOpen, hideActivityModal, pubkey, address, newAddress }
left: '20%', left: '20%',
right: '0', right: '0',
bottom: 'auto', bottom: 'auto',
width: '60%', width: '40%',
margin: '50px auto' margin: '50px auto',
borderRadius: 'none',
padding: '0'
} }
} }
@ -36,22 +39,37 @@ const ReceiveModal = ({ isOpen, hideActivityModal, pubkey, address, newAddress }
parentSelector={() => document.body} parentSelector={() => document.body}
style={customStyles} style={customStyles}
> >
<div className={styles.closeContainer}>
<span onClick={() => hideActivityModal()}>
<MdClose />
</span>
</div>
<div className={styles.container}> <div className={styles.container}>
<section> <header>
<h4>Node Public Key (<span onClick={() => copyOnClick(pubkey)}>Copy</span>)</h4> <div className={styles.qrcodes}>
<p>{pubkey}</p> <QRCode value={address} />
</section> </div>
<ul className={styles.tabs}>
<li className={styles.active}>Wallet address</li>
<li>Node pubkey</li>
</ul>
</header>
<section> <section>
<div className={styles.addressHeader}> <div className={styles.addressHeader}>
<h4>Deposit Address (<span onClick={() => copyOnClick(address)}>Copy</span>)</h4> <h4>Deposit Address (<span onClick={() => copyOnClick(address)}>Copy</span>)</h4>
<span className={styles.newAddress} onClick={() => newAddress('p2pkh')}>New Address</span> <span className={styles.newAddress} onClick={() => newAddress('p2pkh')}>New Address</span>
</div> </div>
<p>{address}</p> <p>
{address}
<span>hi</span>
</p>
</section>
<div className={styles.qrcode}> <section>
<QRCode value={address} /> <h4>Node Public Key (<span onClick={() => copyOnClick(pubkey)}>Copy</span>)</h4>
</div> <p>{pubkey}</p>
</section> </section>
</div> </div>
</ReactModal> </ReactModal>

56
app/components/Wallet/ReceiveModal.scss

@ -1,15 +1,58 @@
@import '../../variables.scss'; @import '../../variables.scss';
.closeContainer {
background: $lightgrey;
text-align: right;
padding: 10px;
span {
color: $darkestgrey;
font-size: 20px;
cursor: pointer;
}
}
.container { .container {
header {
background: $lightgrey;
padding: 10px 40px 40px;
text-align: center;
.qrcodes {
text-align: center;
margin-top: 20px;
}
.tabs {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
margin-top: 20px;
li {
margin: 0 20px;
color: $darkestgrey;
transition: all 0.25s;
&:hover {
color: $black;
}
&.active {
color: $black;
}
}
}
}
section { section {
margin: 25px 0; margin: 25px 0;
padding: 25px; padding: 25px;
border-bottom: 1px solid $darkestgrey;
h4 { h4 {
font-size: 14px; font-size: 14px;
font-weight: bold; font-weight: bold;
text-transform: uppercase;
letter-spacing: 1.5px; letter-spacing: 1.5px;
margin-bottom: 10px; margin-bottom: 10px;
@ -19,20 +62,13 @@
} }
} }
.qrcode {
text-align: center;
margin-top: 20px;
}
p { p {
font-family: 'Roboto'; font-family: 'Roboto';
text-align: center; text-align: center;
font-size: 14px; font-size: 14px;
font-weight: 200; font-weight: 200;
border-radius: 7px;
background: $lightgrey; background: $lightgrey;
border: 1px solid $main; padding: 15px;
padding: 10px;
} }
} }
} }

9
app/lnd/methods/paymentsController.js

@ -6,10 +6,13 @@
*/ */
export function sendPaymentSync(lnd, { paymentRequest }) { export function sendPaymentSync(lnd, { paymentRequest }) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
lnd.sendPaymentSync({ payment_request: paymentRequest }, (err, data) => { lnd.sendPaymentSync({ payment_request: paymentRequest }, (error, data) => {
if (err) { reject(err) } if (error) {
reject({ error })
return
}
if (!data.payment_route) { reject({ error: data.payment_error }) } if (!data || !data.payment_route) { reject({ error: data.payment_error }) }
resolve(data) resolve(data)
}) })

2
app/main.dev.js

@ -166,7 +166,7 @@ export const startLnd = () => {
'--bitcoin.testnet', '--bitcoin.testnet',
'--neutrino.active', '--neutrino.active',
'--neutrino.connect=btcd0.lightning.computer:18333', '--neutrino.connect=btcd0.lightning.computer:18333',
'--neutrino.connect=127.0.0.1:18333', '--neutrino.connect=faucet.lightning.community:18333',
'--autopilot.active', '--autopilot.active',
'--debuglevel=debug', '--debuglevel=debug',
'--no-macaroons', '--no-macaroons',

Loading…
Cancel
Save