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. 13
      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 styles from './OpenPendingChannel.scss'
const OpenPendingChannel = ({ ticker, channel: { channel }, currentTicker, explorerLinkBase }) => (
<li className={styles.channel} onClick={() => shell.openExternal(`${explorerLinkBase}/tx/${channel.channel_point.split(':')[0]}`)}>
<h1 className={styles.pending}>Opening Channel...</h1>
const OpenPendingChannel = ({ ticker, channel, currentTicker, explorerLinkBase }) => (
<li className={styles.channel} onClick={() => shell.openExternal(`${explorerLinkBase}/tx/${channel.channel.channel_point.split(':')[0]}`)}>
<div className={styles.pending}>
<h1>Opening Channel...</h1>
<span>Blocks till open: {channel.blocks_till_open}</span>
</div>
<div className={styles.left}>
<section className={styles.remotePubkey}>
<span>Remote Pubkey</span>
<h4>{channel.remote_node_pub}</h4>
<h4>{channel.channel.remote_node_pub}</h4>
</section>
<section className={styles.channelPoint}>
<span>Channel Point</span>
<h4>{channel.channel_point}</h4>
<h4>{channel.channel.channel_point}</h4>
</section>
</div>
<div className={styles.right}>
@ -23,9 +26,9 @@ const OpenPendingChannel = ({ ticker, channel: { channel }, currentTicker, explo
<h2>
{
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>
</section>
@ -34,9 +37,9 @@ const OpenPendingChannel = ({ ticker, channel: { channel }, currentTicker, explo
<h4>
{
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>
<span>Local</span>
@ -45,9 +48,9 @@ const OpenPendingChannel = ({ ticker, channel: { channel }, currentTicker, explo
<h4>
{
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>
<span>Remote</span>

13
app/components/Channels/OpenPendingChannel.scss

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

2
app/components/Peers/PeerModal.scss

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

56
app/components/Wallet/ReceiveModal.scss

@ -1,15 +1,58 @@
@import '../../variables.scss';
.closeContainer {
background: $lightgrey;
text-align: right;
padding: 10px;
span {
color: $darkestgrey;
font-size: 20px;
cursor: pointer;
}
}
.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 {
margin: 25px 0;
padding: 25px;
border-bottom: 1px solid $darkestgrey;
h4 {
font-size: 14px;
font-weight: bold;
text-transform: uppercase;
letter-spacing: 1.5px;
margin-bottom: 10px;
@ -19,20 +62,13 @@
}
}
.qrcode {
text-align: center;
margin-top: 20px;
}
p {
font-family: 'Roboto';
text-align: center;
font-size: 14px;
font-weight: 200;
border-radius: 7px;
background: $lightgrey;
border: 1px solid $main;
padding: 10px;
padding: 15px;
}
}
}

9
app/lnd/methods/paymentsController.js

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

2
app/main.dev.js

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

Loading…
Cancel
Save