Browse Source

style(line length): Drop prettier line length from 120 to 100

Subjectively, this increases general readability, while the higher max-length
limit allows for longer strings and comments, etc.
renovate/lint-staged-8.x
Ben Woosley 6 years ago
parent
commit
dc29c80ad0
No known key found for this signature in database GPG Key ID: 6EE5F3785F78B345
  1. 2
      .prettierrc
  2. 4
      app/api/index.js
  3. 4
      app/components/Activity/Countdown.js
  4. 6
      app/components/Activity/InvoiceModal.js
  5. 5
      app/components/Activity/PaymentModal.js
  6. 26
      app/components/Activity/TransactionModal.js
  7. 8
      app/components/Contacts/AddChannel.js
  8. 9
      app/components/Contacts/ConnectManually.js
  9. 15
      app/components/Contacts/ContactModal.js
  10. 30
      app/components/Contacts/ContactsForm.js
  11. 27
      app/components/Contacts/Network.js
  12. 15
      app/components/Contacts/SubmitChannelForm.js
  13. 11
      app/components/Contacts/SuggestedNodes.js
  14. 6
      app/components/CurrencyIcon/CurrencyIcon.js
  15. 10
      app/components/Form/Pay.js
  16. 5
      app/components/Form/Request.js
  17. 4
      app/components/Onboarding/InitWallet.js
  18. 4
      app/components/Onboarding/Login.js
  19. 5
      app/components/Onboarding/NewAezeedPassword.js
  20. 8
      app/components/Onboarding/NewWalletPassword.js
  21. 2
      app/components/Onboarding/Onboarding.js
  22. 18
      app/components/Wallet/Wallet.js
  23. 8
      app/containers/Root.js
  24. 4
      app/lnd/lib/lightning.js
  25. 8
      app/lnd/methods/channelController.js
  26. 12
      app/lnd/methods/index.js
  27. 5
      app/lnd/methods/walletController.js
  28. 4
      app/lnd/subscribe/channelgraph.js
  29. 9
      app/main.dev.js
  30. 12
      app/menu.js
  31. 37
      app/reducers/activity.js
  32. 3
      app/reducers/address.js
  33. 90
      app/reducers/channels.js
  34. 17
      app/reducers/contactsform.js
  35. 5
      app/reducers/info.js
  36. 9
      app/reducers/invoice.js
  37. 15
      app/reducers/ipc.js
  38. 11
      app/reducers/lnd.js
  39. 15
      app/reducers/network.js
  40. 25
      app/reducers/onboarding.js
  41. 13
      app/reducers/payform.js
  42. 3
      app/reducers/payment.js
  43. 16
      app/reducers/peers.js
  44. 5
      app/reducers/requestform.js
  45. 8
      app/reducers/ticker.js
  46. 14
      app/reducers/transaction.js
  47. 4
      app/routes/activity/components/Activity.js
  48. 4
      app/routes/activity/components/components/Invoice/Invoice.js
  49. 19
      app/routes/activity/components/components/Transaction/Transaction.js
  50. 20
      app/routes/app/containers/AppContainer.js
  51. 3
      app/utils/blockExplorer.js
  52. 4
      internals/scripts/CheckBuiltsExist.js
  53. 10
      test/reducers/channels.spec.js
  54. 12
      test/reducers/invoice.spec.js
  55. 8
      test/reducers/payment.spec.js
  56. 7
      test/reducers/ticker.spec.js
  57. 8
      test/runTests.js
  58. 4
      webpack.config.renderer.dev.js

2
.prettierrc

@ -1,6 +1,6 @@
{
"bracketSpacing": true,
"printWidth": 120,
"printWidth": 100,
"semi": false,
"singleQuote": true,
"trailingComma": "none",

4
app/api/index.js

@ -13,7 +13,9 @@ export function requestTicker(id) {
export function requestTickers(ids) {
return axios
.all(ids.map(id => requestTicker(id)))
.then(axios.spread((btcTicker, ltcTicker) => ({ btcTicker: btcTicker[0], ltcTicker: ltcTicker[0] })))
.then(
axios.spread((btcTicker, ltcTicker) => ({ btcTicker: btcTicker[0], ltcTicker: ltcTicker[0] }))
)
}
export function requestBlockHeight() {

4
app/components/Activity/Countdown.js

@ -44,7 +44,9 @@ class Countdown extends React.Component {
}
const days = convertTwoDigits(Math.floor(distance / (1000 * 60 * 60 * 24)))
const hours = convertTwoDigits(Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)))
const hours = convertTwoDigits(
Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60))
)
const minutes = convertTwoDigits(Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)))
const seconds = convertTwoDigits(Math.floor((distance % (1000 * 60)) / 1000))

6
app/components/Activity/InvoiceModal.js

@ -55,7 +55,11 @@ const InvoiceModal = ({
<div className={styles.details}>
<section className={styles.amount}>
<h1>
<Value value={invoice.value} currency={ticker.currency} currentTicker={currentTicker} />
<Value
value={invoice.value}
currency={ticker.currency}
currentTicker={currentTicker}
/>
</h1>
<section
className={styles.currentCurrency}

5
app/components/Activity/PaymentModal.js

@ -50,7 +50,10 @@ const PaymentModal = ({
<i className={`${styles.symbol} ${payment.value > 0 && styles.active}`}>-</i>
<Value value={payment.value} currency={ticker.currency} currentTicker={currentTicker} />
</h1>
<section className={styles.currentCurrency} onClick={() => setActivityModalCurrencyFilters(!showCurrencyFilters)}>
<section
className={styles.currentCurrency}
onClick={() => setActivityModalCurrencyFilters(!showCurrencyFilters)}
>
<span>{currencyName}</span>
<span>
<FaAngleDown />

26
app/components/Activity/TransactionModal.js

@ -38,12 +38,19 @@ const TransactionModal = ({
<section className={styles.details}>
<div>
<Isvg src={link} />
<span className={styles.link} onClick={() => blockExplorer.showTransaction(network, transaction.tx_hash)}>
<span
className={styles.link}
onClick={() => blockExplorer.showTransaction(network, transaction.tx_hash)}
>
On-Chain
</span>
</div>
<div>
<Value value={transaction.total_fees} currency={ticker.currency} currentTicker={currentTicker} />
<Value
value={transaction.total_fees}
currency={ticker.currency}
currentTicker={currentTicker}
/>
<span> {currencyName} fee</span>
</div>
</section>
@ -54,9 +61,16 @@ const TransactionModal = ({
<i className={`${styles.symbol} ${transaction.amount > 0 && styles.active}`}>
{transaction.amount > 0 ? '+' : '-'}
</i>
<Value value={transaction.amount} currency={ticker.currency} currentTicker={currentTicker} />
<Value
value={transaction.amount}
currency={ticker.currency}
currentTicker={currentTicker}
/>
</h1>
<section className={styles.currentCurrency} onClick={() => setActivityModalCurrencyFilters(!showCurrencyFilters)}>
<section
className={styles.currentCurrency}
onClick={() => setActivityModalCurrencyFilters(!showCurrencyFilters)}
>
<span>{currencyName}</span>
<span>
<FaAngleDown />
@ -76,7 +90,9 @@ const TransactionModal = ({
</div>
<footer className={styles.footer}>
<p onClick={() => blockExplorer.showTransaction(network, transaction.tx_hash)}>{transaction.tx_hash}</p>
<p onClick={() => blockExplorer.showTransaction(network, transaction.tx_hash)}>
{transaction.tx_hash}
</p>
</footer>
</div>
)

8
app/components/Contacts/AddChannel.js

@ -108,7 +108,9 @@ const AddChannel = ({
<h2>
<span>{node.alias.trim()}</span>
<span>
({node.pub_key.substr(0, 10)}...{node.pub_key.substr(node.pub_key.length - 10)})
({node.pub_key.substr(0, 10)}...{node.pub_key.substr(
node.pub_key.length - 10
)})
</span>
</h2>
) : (
@ -125,7 +127,9 @@ const AddChannel = ({
{showManualForm && (
<section className={styles.manualForm}>
<p>Hm, looks like we can&apos;t see that node from here, wanna try to manually connect?</p>
<p>
Hm, looks like we can&apos;t see that node from here, wanna try to manually connect?
</p>
<div className={styles.manualConnectButton} onClick={openManualForm}>
Connect Manually
</div>

9
app/components/Contacts/ConnectManually.js

@ -64,11 +64,16 @@ class ConnectManually extends React.Component {
</section>
<section className={`${styles.errorMessage} ${showErrors.manualInput && styles.active}`}>
{showErrors.manualInput && <span>{manualFormIsValid && manualFormIsValid.errors.manualInput}</span>}
{showErrors.manualInput && (
<span>{manualFormIsValid && manualFormIsValid.errors.manualInput}</span>
)}
</section>
<section className={styles.submit}>
<div className={`${styles.button} ${manualFormIsValid.isValid && styles.active}`} onClick={formSubmitted}>
<div
className={`${styles.button} ${manualFormIsValid.isValid && styles.active}`}
onClick={formSubmitted}
>
Submit
</div>
</section>

15
app/components/Contacts/ContactModal.js

@ -9,7 +9,14 @@ import { btc } from 'utils'
import styles from './ContactModal.scss'
const ContactModal = ({ isOpen, channel, closeContactModal, channelNodes, closeChannel, closingChannelIds }) => {
const ContactModal = ({
isOpen,
channel,
closeContactModal,
channelNodes,
closeChannel,
closingChannelIds
}) => {
if (!channel) {
return <span />
}
@ -32,7 +39,11 @@ const ContactModal = ({ isOpen, channel, closeContactModal, channelNodes, closeC
}
const removeClicked = () => {
closeChannel({ channel_point: channel.channel_point, chan_id: channel.chan_id, force: !channel.active })
closeChannel({
channel_point: channel.channel_point,
chan_id: channel.chan_id,
force: !channel.active
})
}
// the remote node for the channel

30
app/components/Contacts/ContactsForm.js

@ -80,7 +80,11 @@ class ContactsForm extends React.Component {
className={`${styles.connect} hint--left`}
data-hint={`Connect with ${contactsform.contactCapacity} BTC`}
onClick={() =>
openChannel({ pubkey: node.pub_key, host: node.addresses[0].addr, local_amt: contactsform.contactCapacity })
openChannel({
pubkey: node.pub_key,
host: node.addresses[0].addr,
local_amt: contactsform.contactCapacity
})
}
>
Connect
@ -105,7 +109,8 @@ class ContactsForm extends React.Component {
// clear any existing errors
updateManualFormErrors({ manualInput: null })
const [pubkey, host] = contactsform.manualSearchQuery && contactsform.manualSearchQuery.split('@')
const [pubkey, host] =
contactsform.manualSearchQuery && contactsform.manualSearchQuery.split('@')
openChannel({ pubkey, host, local_amt: contactsform.contactCapacity })
@ -159,7 +164,9 @@ class ContactsForm extends React.Component {
<h2>
<span>{node.alias.trim()}</span>
<span>
({node.pub_key.substr(0, 10)}...{node.pub_key.substr(node.pub_key.length - 10)})
({node.pub_key.substr(0, 10)}...{node.pub_key.substr(
node.pub_key.length - 10
)})
</span>
</h2>
) : (
@ -176,7 +183,10 @@ class ContactsForm extends React.Component {
{showManualForm && (
<div className={styles.manualForm}>
<h2>Hm, looks like we cant see that contact from here. Want to try and manually connect?</h2>
<h2>
Hm, looks like we cant see that contact from here. Want to try and manually
connect?
</h2>
<section>
<input
type="text"
@ -197,8 +207,12 @@ class ContactsForm extends React.Component {
)}
</section>
<section className={`${styles.errorMessage} ${showErrors.manualInput && styles.active}`}>
{showErrors.manualInput && <span>{manualFormIsValid && manualFormIsValid.errors.manualInput}</span>}
<section
className={`${styles.errorMessage} ${showErrors.manualInput && styles.active}`}
>
{showErrors.manualInput && (
<span>{manualFormIsValid && manualFormIsValid.errors.manualInput}</span>
)}
</section>
</div>
)}
@ -214,7 +228,9 @@ class ContactsForm extends React.Component {
onClick={inputClicked}
onKeyPress={event => event.charCode === 13 && this.setState({ editing: false })}
readOnly={!editing}
style={{ width: `${editing ? 20 : contactsform.contactCapacity.toString().length + 1}%` }}
style={{
width: `${editing ? 20 : contactsform.contactCapacity.toString().length + 1}%`
}}
/>
</span>
<span className={styles.caption}>

27
app/components/Contacts/Network.js

@ -89,7 +89,11 @@ class Network extends Component {
// when the user clicks the action to close the channel
const removeClicked = removeChannel => {
closeChannel({ channel_point: removeChannel.channel_point, chan_id: removeChannel.chan_id, force: !removeChannel.active })
closeChannel({
channel_point: removeChannel.channel_point,
chan_id: removeChannel.chan_id,
force: !removeChannel.active
})
}
// when a user clicks a channel
@ -109,7 +113,9 @@ class Network extends Component {
return node.alias
}
return displayedChannel.remote_pubkey ? displayedChannel.remote_pubkey.substring(0, 10) : displayedChannel.remote_node_pub.substring(0, 10)
return displayedChannel.remote_pubkey
? displayedChannel.remote_pubkey.substring(0, 10)
: displayedChannel.remote_node_pub.substring(0, 10)
}
const channelStatus = statusChannel => {
@ -145,7 +151,9 @@ class Network extends Component {
<section>
<h2>My Network</h2>
<span className={styles.channelAmount}>
{btc.satoshisToBtc(balance.channelBalance)}BTC ${usdAmount ? usdAmount.toLocaleString() : ''}
{btc.satoshisToBtc(balance.channelBalance)}BTC ${usdAmount
? usdAmount.toLocaleString()
: ''}
</span>
</section>
<section
@ -160,7 +168,8 @@ class Network extends Component {
</header>
<div className={styles.channels}>
{!loadingChannelPubkeys.length && !channels.length && <SuggestedNodes {...suggestedNodesProps} />}
{!loadingChannelPubkeys.length &&
!channels.length && <SuggestedNodes {...suggestedNodesProps} />}
{(loadingChannelPubkeys.length || channels.length) && (
<header className={styles.listHeader}>
@ -227,7 +236,8 @@ class Network extends Component {
return (
<li
key={index}
className={`${styles.channel} ${selectedChannel === channel && styles.selectedChannel}`}
className={`${styles.channel} ${selectedChannel === channel &&
styles.selectedChannel}`}
onClick={() => channelClicked(channel)}
>
<section className={styles.channelTitle}>
@ -246,7 +256,12 @@ class Network extends Component {
<span>{displayNodeName(channel)}</span>
{selectedChannel === channel && (
<span
onClick={() => blockExplorer.showTransaction(network, channel.channel_point.split(':')[0])}
onClick={() =>
blockExplorer.showTransaction(
network,
channel.channel_point.split(':')[0]
)
}
>
<FaExternalLink />
</span>

15
app/components/Contacts/SubmitChannelForm.js

@ -43,7 +43,11 @@ class SubmitChannelForm extends React.Component {
}
// submit the channel to LND
openChannel({ pubkey: node.pub_key, host: node.addresses[0].addr, local_amt: contactCapacity })
openChannel({
pubkey: node.pub_key,
host: node.addresses[0].addr,
local_amt: contactCapacity
})
// close the ChannelForm component
closeChannelForm()
@ -57,8 +61,8 @@ class SubmitChannelForm extends React.Component {
<header className={styles.header}>
<h1>Add Funds to Network</h1>
<p>
Adding a connection will help you send and receive money on the Lightning Network. You aren&apos;t spening
any money, rather moving the money you plan to use onto the network.
Adding a connection will help you send and receive money on the Lightning Network. You
aren&apos;t spening any money, rather moving the money you plan to use onto the network.
</p>
</header>
@ -101,7 +105,10 @@ class SubmitChannelForm extends React.Component {
</section>
<section className={styles.submit}>
<div className={`${styles.button} ${contactCapacity > 0 && styles.active}`} onClick={formSubmitted}>
<div
className={`${styles.button} ${contactCapacity > 0 && styles.active}`}
onClick={formSubmitted}
>
Submit
</div>
</section>

11
app/components/Contacts/SuggestedNodes.js

@ -2,7 +2,12 @@ import React from 'react'
import PropTypes from 'prop-types'
import styles from './SuggestedNodes.scss'
const SuggestedNodes = ({ suggestedNodesLoading, suggestedNodes, setNode, openSubmitChannelForm }) => {
const SuggestedNodes = ({
suggestedNodesLoading,
suggestedNodes,
setNode,
openSubmitChannelForm
}) => {
const nodeClicked = n => {
// set the node public key for the submit form
setNode({ pub_key: n.pubkey, addresses: [{ addr: n.host }] })
@ -22,8 +27,8 @@ const SuggestedNodes = ({ suggestedNodesLoading, suggestedNodes, setNode, openSu
return (
<div className={styles.container}>
<header>
Hmmm, looks like you don&apos;t have any channels yet. Here are some suggested nodes to open a channel with to
get started
Hmmm, looks like you don&apos;t have any channels yet. Here are some suggested nodes to open
a channel with to get started
</header>
<ul className={styles.suggestedNodes}>

6
app/components/CurrencyIcon/CurrencyIcon.js

@ -4,7 +4,11 @@ import FaDollar from 'react-icons/lib/fa/dollar'
import CryptoIcon from '../CryptoIcon'
const CurrencyIcon = ({ currency, crypto, styles }) => {
return currency === 'usd' ? <FaDollar style={styles} /> : <CryptoIcon styles={styles} currency={crypto} />
return currency === 'usd' ? (
<FaDollar style={styles} />
) : (
<CryptoIcon styles={styles} currency={crypto} />
)
}
CurrencyIcon.propTypes = {

10
app/components/Form/Pay.js

@ -142,7 +142,10 @@ class Pay extends Component {
readOnly={isLn}
/>
<div className={styles.currency}>
<section className={styles.currentCurrency} onClick={() => setCurrencyFilters(!showCurrencyFilters)}>
<section
className={styles.currentCurrency}
onClick={() => setCurrencyFilters(!showCurrencyFilters)}
>
<span>{currencyName}</span>
<span>
<FaAngleDown />
@ -160,7 +163,10 @@ class Pay extends Component {
<div className={styles.usdAmount}>{`${usdAmount || 0} USD`}</div>
<section className={`${styles.errorMessage} ${styles.amount} ${showErrors.amount && styles.active}`}>
<section
className={`${styles.errorMessage} ${styles.amount} ${showErrors.amount &&
styles.active}`}
>
{showErrors.amount && <span>{errors.amount}</span>}
</section>
</section>

5
app/components/Form/Request.js

@ -91,7 +91,10 @@ const Request = ({
</section>
<section className={styles.submit}>
<div className={`${styles.button} ${amount > 0 && styles.active}`} onClick={onRequestSubmit}>
<div
className={`${styles.button} ${amount > 0 && styles.active}`}
onClick={onRequestSubmit}
>
Request
</div>
</section>

4
app/components/Onboarding/InitWallet.js

@ -5,7 +5,9 @@ import Signup from './Signup'
import styles from './InitWallet.scss'
const InitWallet = ({ hasSeed, loginProps, signupProps }) => (
<div className={styles.container}>{hasSeed ? <Login {...loginProps} /> : <Signup {...signupProps} />}</div>
<div className={styles.container}>
{hasSeed ? <Login {...loginProps} /> : <Signup {...signupProps} />}
</div>
)
InitWallet.propTypes = {

4
app/components/Onboarding/Login.js

@ -12,7 +12,9 @@ const Login = ({ password, updatePassword, unlockingWallet, unlockWallet, unlock
value={password}
onChange={event => updatePassword(event.target.value)}
/>
<p className={`${unlockWalletError.isError && styles.active} ${styles.error}`}>{unlockWalletError.message}</p>
<p className={`${unlockWalletError.isError && styles.active} ${styles.error}`}>
{unlockWalletError.message}
</p>
<section className={styles.buttons}>
<div>

5
app/components/Onboarding/NewAezeedPassword.js

@ -28,7 +28,10 @@ const NewAezeedPassword = ({
value={aezeedPasswordConfirmation}
onChange={event => updateAezeedPasswordConfirmation(event.target.value)}
/>
<p className={`${styles.errorMessage} ${showAezeedPasswordConfirmationError && styles.visible}`}>
<p
className={`${styles.errorMessage} ${showAezeedPasswordConfirmationError &&
styles.visible}`}
>
Passwords do not match
</p>
</section>

8
app/components/Onboarding/NewWalletPassword.js

@ -24,11 +24,15 @@ const NewWalletPassword = ({
<input
type="password"
placeholder="Confirm Password"
className={`${styles.password} ${showCreateWalletPasswordConfirmationError && styles.error}`}
className={`${styles.password} ${showCreateWalletPasswordConfirmationError &&
styles.error}`}
value={createWalletPasswordConfirmation}
onChange={event => updateCreateWalletPasswordConfirmation(event.target.value)}
/>
<p className={`${styles.errorMessage} ${showCreateWalletPasswordConfirmationError && styles.visible}`}>
<p
className={`${styles.errorMessage} ${showCreateWalletPasswordConfirmationError &&
styles.visible}`}
>
Passwords do not match
</p>
</section>

2
app/components/Onboarding/Onboarding.js

@ -140,7 +140,7 @@ const Onboarding = ({
title={"Alright, let's get set up"}
description="Would you like to create a new wallet or import an existing one?"
back={() => changeStep(4)}
next={() => (initWalletProps.signupProps.signupForm.create ? changeStep(6) : changeStep(5.1))}
next={() => changeStep(initWalletProps.signupProps.signupForm.create ? 6 : 5.1)}
>
<Signup {...initWalletProps.signupProps} />
</FormContainer>

18
app/components/Wallet/Wallet.js

@ -85,7 +85,9 @@ const Wallet = ({
</section>
</span>
</h1>
<span className={styles.usdValue}> ${usdAmount ? usdAmount.toLocaleString() : ''}</span>
<span className={styles.usdValue}>
${usdAmount ? usdAmount.toLocaleString() : ''}
</span>
</div>
</div>
</div>
@ -119,10 +121,16 @@ const Wallet = ({
<AnimatedCheckmark />
</section>
<section>
{
// TODO(jimmymow): remove this
// eslint-disable-next-line
}Successfully <span className={styles.txLink} onClick={() => blockExplorer.showTransaction(network, successTransactionScreen.txid)}>sent</span> transaction
Successfully{' '}
<span
className={styles.txLink}
onClick={() => {
return blockExplorer.showTransaction(network, successTransactionScreen.txid)
}}
>
sent
</span>{' '}
transaction
</section>
</span>
)}

8
app/containers/Root.js

@ -62,8 +62,12 @@ const mapStateToProps = state => ({
syncPercentage: lndSelectors.syncPercentage(state),
passwordIsValid: onboardingSelectors.passwordIsValid(state),
showCreateWalletPasswordConfirmationError: onboardingSelectors.showCreateWalletPasswordConfirmationError(state),
showAezeedPasswordConfirmationError: onboardingSelectors.showAezeedPasswordConfirmationError(state),
showCreateWalletPasswordConfirmationError: onboardingSelectors.showCreateWalletPasswordConfirmationError(
state
),
showAezeedPasswordConfirmationError: onboardingSelectors.showAezeedPasswordConfirmationError(
state
),
reEnterSeedChecker: onboardingSelectors.reEnterSeedChecker(state)
})

4
app/lnd/lib/lightning.js

@ -29,7 +29,9 @@ const lightning = (rpcpath, host) => {
const macaroonHex = fs.readFileSync(lndConfig.macaroon).toString('hex')
metadata.add('macaroon', macaroonHex)
const macaroonCreds = grpc.credentials.createFromMetadataGenerator((params, callback) => callback(null, metadata))
const macaroonCreds = grpc.credentials.createFromMetadataGenerator((params, callback) =>
callback(null, metadata)
)
const credentials = grpc.credentials.combineChannelCredentials(sslCreds, macaroonCreds)
return new rpc.lnrpc.Lightning(host, credentials)

8
app/lnd/methods/channelController.js

@ -30,7 +30,9 @@ export function connectAndOpen(lnd, event, payload) {
})
call.on('data', data => event.sender.send('pushchannelupdated', { pubkey, data }))
call.on('error', error => event.sender.send('pushchannelerror', { pubkey, error: error.toString() }))
call.on('error', error =>
event.sender.send('pushchannelerror', { pubkey, error: error.toString() })
)
return call
})
@ -128,7 +130,9 @@ export function closeChannel(lnd, event, payload) {
call.on('data', data => event.sender.send('pushclosechannelupdated', { data, chan_id }))
call.on('end', () => event.sender.send('pushclosechannelend'))
call.on('error', error => event.sender.send('pushclosechannelerror', { error: error.toString(), chan_id }))
call.on('error', error =>
event.sender.send('pushclosechannelerror', { error: error.toString(), chan_id })
)
call.on('status', status => event.sender.send('pushclosechannelstatus', { status, chan_id }))
resolve(null, res)

12
app/lnd/methods/index.js

@ -87,7 +87,9 @@ export default function(lnd, log, event, msg, data) {
// pending_force_closing_channels: []
// }
// ]
Promise.all([channelController.listChannels, channelController.pendingChannels].map(func => func(lnd)))
Promise.all(
[channelController.listChannels, channelController.pendingChannels].map(func => func(lnd))
)
.then(channelsData =>
event.sender.send('receiveChannels', {
channels: channelsData[0].channels,
@ -126,7 +128,9 @@ export default function(lnd, log, event, msg, data) {
break
case 'balance':
// Balance looks like [ { balance: '129477456' }, { balance: '243914' } ]
Promise.all([walletController.walletBalance, channelController.channelBalance].map(func => func(lnd)))
Promise.all(
[walletController.walletBalance, channelController.channelBalance].map(func => func(lnd))
)
.then(balance => {
event.sender.send('receiveBalance', {
walletBalance: balance[0].total_balance,
@ -188,7 +192,9 @@ export default function(lnd, log, event, msg, data) {
// { amount, addr } = data
walletController
.sendCoins(lnd, data)
.then(({ txid }) => event.sender.send('transactionSuccessful', { amount: data.amount, addr: data.addr, txid }))
.then(({ txid }) =>
event.sender.send('transactionSuccessful', { amount: data.amount, addr: data.addr, txid })
)
.catch(error => {
log.error('error: ', error)
event.sender.send('transactionError', { error: error.toString() })

5
app/lnd/methods/walletController.js

@ -138,7 +138,10 @@ export function unlockWallet(walletUnlocker, { wallet_password }) {
* @param {[type]} password [description]
* @param {[type]} cipher_seed_mnemonic [description]
*/
export function initWallet(walletUnlocker, { wallet_password, cipher_seed_mnemonic, aezeed_passphrase }) {
export function initWallet(
walletUnlocker,
{ wallet_password, cipher_seed_mnemonic, aezeed_passphrase }
) {
return new Promise((resolve, reject) => {
walletUnlocker.initWallet(
{

4
app/lnd/subscribe/channelgraph.js

@ -2,5 +2,7 @@ export default function subscribeToChannelGraph(mainWindow, lnd) {
const call = lnd.subscribeChannelGraph({})
call.on('data', channelGraphData => mainWindow.send('channelGraphData', { channelGraphData }))
call.on('status', channelGraphStatus => mainWindow.send('channelGraphStatus', { channelGraphStatus }))
call.on('status', channelGraphStatus =>
mainWindow.send('channelGraphStatus', { channelGraphStatus })
)
}

9
app/main.dev.js

@ -45,7 +45,9 @@ const installExtensions = async () => {
const forceDownload = !!process.env.UPGRADE_EXTENSIONS
const extensions = ['REACT_DEVELOPER_TOOLS', 'REDUX_DEVTOOLS']
return Promise.all(extensions.map(name => installer.default(installer[name], forceDownload))).catch(mainLog.error)
return Promise.all(
extensions.map(name => installer.default(installer[name], forceDownload))
).catch(mainLog.error)
}
// Send the front end event letting them know the gRPC connection is disconnected
@ -209,7 +211,10 @@ const startLnd = (alias, autopilot) => {
}
// Pass current clock height progress to front end for loading state UX
if (mainWindow && (line.includes('Caught up to height') || line.includes('Catching up block hashes to height'))) {
if (
mainWindow &&
(line.includes('Caught up to height') || line.includes('Catching up block hashes to height'))
) {
// const blockHeight = line.slice(line.indexOf('Caught up to height') + 'Caught up to height'.length).trim()
mainWindow.webContents.send('lndStdout', line)
}

12
app/menu.js

@ -30,7 +30,11 @@ export default class MenuBuilder {
}
setupInputTemplate() {
const selectionMenu = Menu.buildFromTemplate([{ role: 'copy' }, { type: 'separator' }, { role: 'selectall' }])
const selectionMenu = Menu.buildFromTemplate([
{ role: 'copy' },
{ type: 'separator' },
{ role: 'selectall' }
])
const inputMenu = Menu.buildFromTemplate([
{ role: 'undo' },
@ -65,7 +69,11 @@ export default class MenuBuilder {
{ label: 'About Zap', selector: 'orderFrontStandardAboutPanel:' },
{ type: 'separator' },
{ label: 'Hide Zap', accelerator: 'Command+H', selector: 'hide:' },
{ label: 'Hide Others', accelerator: 'Command+Shift+H', selector: 'hideOtherApplications:' },
{
label: 'Hide Others',
accelerator: 'Command+Shift+H',
selector: 'hideOtherApplications:'
},
{ label: 'Show All', selector: 'unhideAllApplications:' },
{ type: 'separator' },
{

37
app/reducers/activity.js

@ -91,14 +91,21 @@ export function setActivityModalCurrencyFilters(showCurrencyFilters) {
// Action Handlers
// ------------------------------------
const ACTION_HANDLERS = {
[SHOW_ACTIVITY_MODAL]: (state, { modalType, modalProps }) => ({ ...state, modal: { modalType, modalProps } }),
[SHOW_ACTIVITY_MODAL]: (state, { modalType, modalProps }) => ({
...state,
modal: { modalType, modalProps }
}),
[HIDE_ACTIVITY_MODAL]: state => ({ ...state, modal: { modalType: null, modalProps: {} } }),
[CHANGE_FILTER]: (state, { filter }) => ({ ...state, filter, filterPulldown: false }),
[TOGGLE_PULLDOWN]: state => ({ ...state, filterPulldown: !state.filterPulldown }),
[SET_ACTIVITY_MODAL_CURRENCY_FILTERS]: (state, { showCurrencyFilters }) => ({
...state,
modal: { modalType: state.modal.modalType, modalProps: state.modal.modalProps, showCurrencyFilters }
modal: {
modalType: state.modal.modalType,
modalProps: state.modal.modalProps,
showCurrencyFilters
}
}),
[UPDATE_SEARCH_ACTIVE]: (state, { searchActive }) => ({ ...state, searchActive }),
@ -137,7 +144,20 @@ function returnTimestamp(transaction) {
// getMonth() returns the month in 0 index (0 for Jan), so we create an arr of the
// string representation we want for the UI
const months = ['Jan', 'Feb', 'Mar', 'April', 'May', 'June', 'July', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
const months = [
'Jan',
'Feb',
'Mar',
'April',
'May',
'June',
'July',
'Aug',
'Sep',
'Oct',
'Nov',
'Dec'
]
// groups the data by day
function groupData(data) {
@ -204,7 +224,10 @@ const allActivity = createSelector(
const invoiceActivity = createSelector(invoicesSelector, invoices => groupAll(invoices))
const sentActivity = createSelector(transactionsSelector, paymentsSelector, (transactions, payments) =>
const sentActivity = createSelector(
transactionsSelector,
paymentsSelector,
(transactions, payments) =>
groupAll([...transactions.filter(transaction => transaction.amount < 0), ...payments])
)
@ -221,8 +244,10 @@ const FILTERS = {
activitySelectors.currentActivity = createSelector(filterSelector, filter => FILTERS[filter.key])
activitySelectors.nonActiveFilters = createSelector(filtersSelector, filterSelector, (filters, filter) =>
filters.filter(f => f.key !== filter.key)
activitySelectors.nonActiveFilters = createSelector(
filtersSelector,
filterSelector,
(filters, filter) => filters.filter(f => f.key !== filter.key)
)
export { activitySelectors }

3
app/reducers/address.js

@ -43,7 +43,8 @@ export const newAddress = type => async dispatch => {
}
// Receive IPC event for info
export const receiveAddress = (event, address) => dispatch => dispatch({ type: RECEIVE_ADDRESS, address })
export const receiveAddress = (event, address) => dispatch =>
dispatch({ type: RECEIVE_ADDRESS, address })
// ------------------------------------
// Action Handlers

90
app/reducers/channels.js

@ -290,13 +290,17 @@ export const channelGraphData = (event, data) => (dispatch, getState) => {
const { advertising_node, connecting_node } = channel_update
// if our node is involved in this update we wanna show a notification
if (info.data.identity_pubkey === advertising_node || info.data.identity_pubkey === connecting_node) {
if (
info.data.identity_pubkey === advertising_node ||
info.data.identity_pubkey === connecting_node
) {
// this channel has to do with the user, lets fetch a new channel list for them
// TODO: full fetch is probably not necessary
dispatch(fetchChannels())
// Construct the notification
const otherParty = info.data.identity_pubkey === advertising_node ? connecting_node : advertising_node
const otherParty =
info.data.identity_pubkey === advertising_node ? connecting_node : advertising_node
const notifBody = `No new friends, just new channels. Your channel with ${otherParty}`
const notifTitle = 'New channel detected'
@ -327,7 +331,10 @@ export function changeFilter(channelFilter) {
// Action Handlers
// ------------------------------------
const ACTION_HANDLERS = {
[SET_CHANNEL_FORM]: (state, { form }) => ({ ...state, channelForm: Object.assign({}, state.channelForm, form) }),
[SET_CHANNEL_FORM]: (state, { form }) => ({
...state,
channelForm: Object.assign({}, state.channelForm, form)
}),
[SET_CHANNEL]: (state, { channel }) => ({ ...state, channel }),
@ -349,7 +356,11 @@ const ACTION_HANDLERS = {
[SET_VIEW_TYPE]: (state, { viewType }) => ({ ...state, viewType }),
[TOGGLE_CHANNEL_PULLDOWN]: state => ({ ...state, filterPulldown: !state.filterPulldown }),
[CHANGE_CHANNEL_FILTER]: (state, { channelFilter }) => ({ ...state, filterPulldown: false, filter: channelFilter }),
[CHANGE_CHANNEL_FILTER]: (state, { channelFilter }) => ({
...state,
filterPulldown: false,
filter: channelFilter
}),
[ADD_LOADING_PUBKEY]: (state, { pubkey }) => ({
...state,
@ -357,30 +368,44 @@ const ACTION_HANDLERS = {
}),
[REMOVE_LOADING_PUBKEY]: (state, { pubkey }) => ({
...state,
loadingChannelPubkeys: state.loadingChannelPubkeys.filter(loadingPubkey => loadingPubkey !== pubkey)
loadingChannelPubkeys: state.loadingChannelPubkeys.filter(
loadingPubkey => loadingPubkey !== pubkey
)
}),
[ADD_ClOSING_CHAN_ID]: (state, { chanId }) => ({ ...state, closingChannelIds: [chanId, ...state.closingChannelIds] }),
[ADD_ClOSING_CHAN_ID]: (state, { chanId }) => ({
...state,
closingChannelIds: [chanId, ...state.closingChannelIds]
}),
[REMOVE_ClOSING_CHAN_ID]: (state, { chanId }) => ({
...state,
closingChannelIds: state.closingChannelIds.filter(closingChanId => closingChanId !== chanId)
}),
[OPEN_CONTACT_MODAL]: (state, { channel }) => ({ ...state, contactModal: { isOpen: true, channel } }),
[OPEN_CONTACT_MODAL]: (state, { channel }) => ({
...state,
contactModal: { isOpen: true, channel }
}),
[CLOSE_CONTACT_MODAL]: state => ({ ...state, contactModal: { isOpen: false, channel: null } }),
[SET_SELECTED_CHANNEL]: (state, { selectedChannel }) => ({ ...state, selectedChannel }),
[GET_SUGGESTED_NODES]: state => ({ ...state, suggestedNodesLoading: true }),
[RECEIVE_SUGGESTED_NODES]: (state, { suggestedNodes }) => ({ ...state, suggestedNodesLoading: false, suggestedNodes })
[RECEIVE_SUGGESTED_NODES]: (state, { suggestedNodes }) => ({
...state,
suggestedNodesLoading: false,
suggestedNodes
})
}
const channelsSelectors = {}
const channelSelector = state => state.channels.channel
const channelsSelector = state => state.channels.channels
const pendingOpenChannelsSelector = state => state.channels.pendingChannels.pending_open_channels
const pendingClosedChannelsSelector = state => state.channels.pendingChannels.pending_closing_channels
const pendingForceClosedChannelsSelector = state => state.channels.pendingChannels.pending_force_closing_channels
const pendingClosedChannelsSelector = state =>
state.channels.pendingChannels.pending_closing_channels
const pendingForceClosedChannelsSelector = state =>
state.channels.pendingChannels.pending_force_closing_channels
const waitingCloseChannelsSelector = state => state.channels.pendingChannels.waiting_close_channels
const channelSearchQuerySelector = state => state.channels.searchQuery
const filtersSelector = state => state.channels.filters
@ -395,7 +420,9 @@ const channelMatchesQuery = (channel, nodes, searchQuery) => {
const remotePubkey = (channel.remote_pubkey || '').toLowerCase()
const displayName = (node ? node.alias : '' || '').toLowerCase()
return remoteNodePub.includes(query) || remotePubkey.includes(query) || displayName.includes(query)
return (
remoteNodePub.includes(query) || remotePubkey.includes(query) || displayName.includes(query)
)
}
channelsSelectors.channelModalOpen = createSelector(channelSelector, channel => !!channel)
@ -421,27 +448,40 @@ channelsSelectors.pendingOpenChannels = createSelector(
pendingOpenChannels => pendingOpenChannels
)
channelsSelectors.pendingOpenChannelPubkeys = createSelector(pendingOpenChannelsSelector, pendingOpenChannels =>
channelsSelectors.pendingOpenChannelPubkeys = createSelector(
pendingOpenChannelsSelector,
pendingOpenChannels =>
pendingOpenChannels.map(pendingChannel => pendingChannel.channel.remote_node_pub)
)
channelsSelectors.closingPendingChannels = createSelector(
pendingClosedChannelsSelector,
pendingForceClosedChannelsSelector,
(pendingClosedChannels, pendingForcedClosedChannels) => [...pendingClosedChannels, ...pendingForcedClosedChannels]
(pendingClosedChannels, pendingForcedClosedChannels) => [
...pendingClosedChannels,
...pendingForcedClosedChannels
]
)
channelsSelectors.activeChanIds = createSelector(channelsSelector, channels => channels.map(channel => channel.chan_id))
channelsSelectors.activeChanIds = createSelector(channelsSelector, channels =>
channels.map(channel => channel.chan_id)
)
channelsSelectors.nonActiveFilters = createSelector(filtersSelector, filterSelector, (filters, channelFilter) =>
filters.filter(f => f.key !== channelFilter.key)
channelsSelectors.nonActiveFilters = createSelector(
filtersSelector,
filterSelector,
(filters, channelFilter) => filters.filter(f => f.key !== channelFilter.key)
)
channelsSelectors.channelNodes = createSelector(channelsSelector, nodesSelector, (channels, nodes) => {
channelsSelectors.channelNodes = createSelector(
channelsSelector,
nodesSelector,
(channels, nodes) => {
const chanPubkeys = channels.map(channel => channel.remote_pubkey)
return filter(nodes, node => chanPubkeys.includes(node.pub_key))
})
}
)
const allChannels = createSelector(
channelsSelectors.activeChannels,
@ -462,16 +502,20 @@ const allChannels = createSelector(
searchQuery,
nodes
) => {
const filterChannel = channel => channelMatchesQuery(channel.channel || channel, nodes, searchQuery)
const filterChannel = channel =>
channelMatchesQuery(channel.channel || channel, nodes, searchQuery)
const filteredActiveChannels = activeChannels.filter(filterChannel)
const filteredNonActiveChannels = nonActiveChannels.filter(filterChannel)
const filterPendingChannel = channel => channelMatchesQuery(channel.channel || channel, nodes, searchQuery)
const filterPendingChannel = channel =>
channelMatchesQuery(channel.channel || channel, nodes, searchQuery)
const filteredPendingOpenChannels = pendingOpenChannels.filter(filterPendingChannel)
const filteredPendingClosedChannels = pendingClosedChannels.filter(filterPendingChannel)
const filteredPendingForcedClosedChannels = pendingForcedClosedChannels.filter(filterPendingChannel)
const filteredPendingForcedClosedChannels = pendingForcedClosedChannels.filter(
filterPendingChannel
)
const filteredWaitingCloseChannels = waitingCloseChannels.filter(filterPendingChannel)
return [
@ -527,7 +571,9 @@ export const currentChannels = createSelector(
}
const channelArray = filteredArray(channelFilter.key)
return channelArray.filter(channel => channelMatchesQuery(channel.channel || channel, nodes, searchQuery))
return channelArray.filter(channel =>
channelMatchesQuery(channel.channel || channel, nodes, searchQuery)
)
}
)

17
app/reducers/contactsform.js

@ -183,9 +183,15 @@ const ACTION_HANDLERS = {
showErrors: Object.assign(state.showErrors, errorsObject)
}),
[UPDATE_MANUAL_FORM_SEARCH_QUERY]: (state, { manualSearchQuery }) => ({ ...state, manualSearchQuery }),
[UPDATE_MANUAL_FORM_SEARCH_QUERY]: (state, { manualSearchQuery }) => ({
...state,
manualSearchQuery
}),
[SET_CONTACTS_CURRENCY_FILTERS]: (state, { showCurrencyFilters }) => ({ ...state, showCurrencyFilters })
[SET_CONTACTS_CURRENCY_FILTERS]: (state, { showCurrencyFilters }) => ({
...state,
showCurrencyFilters
})
}
// ------------------------------------
@ -228,9 +234,10 @@ contactFormSelectors.filteredNetworkNodes = createSelector(
const query = searchQuery.includes('@') ? searchQuery.split('@')[0] : searchQuery
// list of the nodes
const list = filter(nodes, node => node.alias.includes(query) || node.pub_key.includes(query)).sort(
contactableFirst
)
const list = filter(
nodes,
node => node.alias.includes(query) || node.pub_key.includes(query)
).sort(contactableFirst)
// if we don't limit the nodes returned then we take a huge performance hit
// rendering thousands of nodes potentially, so we just render 20 for the time being

5
app/reducers/info.js

@ -64,7 +64,10 @@ const ACTION_HANDLERS = {
network: data.testnet ? networks.testnet : networks.mainnet,
data
}),
[SET_WALLET_CURRENCY_FILTERS]: (state, { showWalletCurrencyFilters }) => ({ ...state, showWalletCurrencyFilters })
[SET_WALLET_CURRENCY_FILTERS]: (state, { showWalletCurrencyFilters }) => ({
...state,
showWalletCurrencyFilters
})
}
// ------------------------------------

9
app/reducers/invoice.js

@ -93,7 +93,8 @@ export const fetchInvoices = () => dispatch => {
}
// Receive IPC event for invoices
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
export const createInvoice = (amount, memo, currency) => dispatch => {
@ -189,13 +190,15 @@ invoiceSelectors.invoiceModalOpen = createSelector(invoiceSelector, invoice => !
invoiceSelectors.invoices = createSelector(
invoicesSelector,
invoicesSearchTextSelector,
(invoices, invoicesSearchText) => invoices.filter(invoice => invoice.memo.includes(invoicesSearchText))
(invoices, invoicesSearchText) =>
invoices.filter(invoice => invoice.memo.includes(invoicesSearchText))
)
invoiceSelectors.invoices = createSelector(
invoicesSelector,
invoicesSearchTextSelector,
(invoices, invoicesSearchText) => invoices.filter(invoice => invoice.memo.includes(invoicesSearchText))
(invoices, invoicesSearchText) =>
invoices.filter(invoice => invoice.memo.includes(invoicesSearchText))
)
export { invoiceSelectors }

15
app/reducers/ipc.js

@ -21,9 +21,20 @@ import {
} from './channels'
import { lightningPaymentUri } from './payform'
import { receivePayments, paymentSuccessful, paymentFailed } from './payment'
import { receiveInvoices, createdInvoice, receiveFormInvoice, invoiceUpdate, invoiceFailed } from './invoice'
import {
receiveInvoices,
createdInvoice,
receiveFormInvoice,
invoiceUpdate,
invoiceFailed
} from './invoice'
import { receiveBalance } from './balance'
import { receiveTransactions, transactionSuccessful, transactionError, newTransaction } from './transaction'
import {
receiveTransactions,
transactionSuccessful,
transactionError,
newTransaction
} from './transaction'
import { receiveDescribeNetwork, receiveQueryRoutes, receiveInvoiceAndQueryRoutes } from './network'

11
app/reducers/lnd.js

@ -57,7 +57,10 @@ export const lndStdout = (event, line) => dispatch => {
if (line.includes('Catching up block hashes to height')) {
trimmed = line
.slice(line.indexOf('Catching up block hashes to height') + 'Catching up block hashes to height'.length)
.slice(
line.indexOf('Catching up block hashes to height') +
'Catching up block hashes to height'.length
)
.trim()
height = trimmed.match(/[-]{0,1}[\d.]*[\d]+/g)[0]
}
@ -95,7 +98,11 @@ const ACTION_HANDLERS = {
[RECEIVE_LINE]: (state, { lndBlockHeight }) => ({ ...state, lndBlockHeight }),
[GET_BLOCK_HEIGHT]: state => ({ ...state, fetchingBlockHeight: true }),
[RECEIVE_BLOCK_HEIGHT]: (state, { blockHeight }) => ({ ...state, blockHeight, fetchingBlockHeight: false }),
[RECEIVE_BLOCK_HEIGHT]: (state, { blockHeight }) => ({
...state,
blockHeight,
fetchingBlockHeight: false
}),
[GRPC_DISCONNECTED]: state => ({ ...state, grpcStarted: false }),
[GRPC_CONNECTED]: state => ({ ...state, grpcStarted: true })

15
app/reducers/network.js

@ -142,7 +142,8 @@ export const queryRoutes = (pubkey, amount) => dispatch => {
ipcRenderer.send('lnd', { msg: 'queryRoutes', data: { pubkey, amount } })
}
export const receiveQueryRoutes = (event, { routes }) => dispatch => dispatch({ type: RECEIVE_QUERY_ROUTES, routes })
export const receiveQueryRoutes = (event, { routes }) => dispatch =>
dispatch({ type: RECEIVE_QUERY_ROUTES, routes })
// take a payreq and query routes for it
export const fetchInvoiceAndQueryRoutes = payreq => dispatch => {
@ -199,7 +200,9 @@ const ACTION_HANDLERS = {
let selectedPeers
if (state.selectedPeers.includes(peer)) {
selectedPeers = state.selectedPeers.filter(selectedPeer => selectedPeer.pub_key !== peer.pub_key)
selectedPeers = state.selectedPeers.filter(
selectedPeer => selectedPeer.pub_key !== peer.pub_key
)
}
if (!state.selectedPeers.includes(peer)) {
@ -217,7 +220,9 @@ const ACTION_HANDLERS = {
let selectedChannels
if (state.selectedChannels.includes(channel)) {
selectedChannels = state.selectedChannels.filter(selectedChannel => selectedChannel.chan_id !== channel.chan_id)
selectedChannels = state.selectedChannels.filter(
selectedChannel => selectedChannel.chan_id !== channel.chan_id
)
}
if (!state.selectedChannels.includes(channel)) {
@ -250,7 +255,9 @@ const currentRouteSelector = state => state.network.currentRoute
// }
// )
networkSelectors.selectedPeerPubkeys = createSelector(selectedPeersSelector, peers => peers.map(peer => peer.pub_key))
networkSelectors.selectedPeerPubkeys = createSelector(selectedPeersSelector, peers =>
peers.map(peer => peer.pub_key)
)
networkSelectors.selectedChannelIds = createSelector(selectedChannelsSelector, channels =>
channels.map(channel => channel.chan_id)

25
app/reducers/onboarding.js

@ -15,7 +15,8 @@ export const SET_CONNECTION_MACAROON = 'SET_CONNECTION_MACAROON'
export const UPDATE_ALIAS = 'UPDATE_ALIAS'
export const UPDATE_PASSWORD = 'UPDATE_PASSWORD'
export const UPDATE_CREATE_WALLET_PASSWORD = 'UPDATE_CREATE_WALLET_PASSWORD'
export const UPDATE_CREATE_WALLET_PASSWORD_CONFIRMATION = 'UPDATE_CREATE_WALLET_PASSWORD_CONFIRMATION'
export const UPDATE_CREATE_WALLET_PASSWORD_CONFIRMATION =
'UPDATE_CREATE_WALLET_PASSWORD_CONFIRMATION'
export const UPDATE_AEZEED_PASSWORD = 'UPDATE_AEZEED_PASSWORD'
export const UPDATE_AEZEED_PASSWORD_CONFIRMATION = 'UPDATE_AEZEED_PASSWORD_CONFIRMATION'
export const UPDATE_SEED_INPUT = 'UPDATE_SEED_INPUT'
@ -155,7 +156,11 @@ export function startLnd(options) {
}
}
export const submitNewWallet = (wallet_password, cipher_seed_mnemonic, aezeed_passphrase) => dispatch => {
export const submitNewWallet = (
wallet_password,
cipher_seed_mnemonic,
aezeed_passphrase
) => dispatch => {
// once the user submits the data needed to start LND we will alert the app that it should start LND
ipcRenderer.send('walletUnlocker', {
msg: 'initWallet',
@ -220,7 +225,10 @@ const ACTION_HANDLERS = {
[SET_CONNECTION_MACAROON]: (state, { connectionMacaroon }) => ({ ...state, connectionMacaroon }),
[UPDATE_ALIAS]: (state, { alias }) => ({ ...state, alias }),
[UPDATE_PASSWORD]: (state, { password }) => ({ ...state, password }),
[UPDATE_CREATE_WALLET_PASSWORD]: (state, { createWalletPassword }) => ({ ...state, createWalletPassword }),
[UPDATE_CREATE_WALLET_PASSWORD]: (state, { createWalletPassword }) => ({
...state,
createWalletPassword
}),
[UPDATE_CREATE_WALLET_PASSWORD_CONFIRMATION]: (state, { createWalletPasswordConfirmation }) => ({
...state,
createWalletPasswordConfirmation
@ -270,7 +278,8 @@ const onboardingSelectors = {}
const passwordSelector = state => state.onboarding.password
const createWalletPasswordSelector = state => state.onboarding.createWalletPassword
const createWalletPasswordConfirmationSelector = state => state.onboarding.createWalletPasswordConfirmation
const createWalletPasswordConfirmationSelector = state =>
state.onboarding.createWalletPasswordConfirmation
const aezeedPasswordSelector = state => state.onboarding.aezeedPassword
const aezeedPasswordConfirmationSelector = state => state.onboarding.aezeedPasswordConfirmation
@ -278,7 +287,10 @@ const aezeedPasswordConfirmationSelector = state => state.onboarding.aezeedPassw
const seedSelector = state => state.onboarding.seed
const seedInputSelector = state => state.onboarding.seedInput
onboardingSelectors.passwordIsValid = createSelector(passwordSelector, password => password.length >= 8)
onboardingSelectors.passwordIsValid = createSelector(
passwordSelector,
password => password.length >= 8
)
onboardingSelectors.showCreateWalletPasswordConfirmationError = createSelector(
createWalletPasswordSelector,
@ -295,7 +307,8 @@ onboardingSelectors.showAezeedPasswordConfirmationError = createSelector(
onboardingSelectors.reEnterSeedChecker = createSelector(
seedSelector,
seedInputSelector,
(seed, seedInput) => seed.length === seedInput.length && seed.every((word, i) => word === seedInput[i].word)
(seed, seedInput) =>
seed.length === seedInput.length && seed.every((word, i) => word === seedInput[i].word)
)
export { onboardingSelectors }

13
app/reducers/payform.js

@ -111,7 +111,10 @@ const ACTION_HANDLERS = {
invoice,
showErrors: Object.assign(state.showErrors, { amount: false })
}),
[SET_PAY_CURRENCY_FILTERS]: (state, { showCurrencyFilters }) => ({ ...state, showCurrencyFilters }),
[SET_PAY_CURRENCY_FILTERS]: (state, { showCurrencyFilters }) => ({
...state,
showCurrencyFilters
}),
[UPDATE_PAY_ERRORS]: (state, { errorsObject }) => ({
...state,
@ -138,14 +141,18 @@ const sendingPaymentSelector = state => state.payment.sendingPayment
// ticker
const currencySelector = state => state.ticker.currency
payFormSelectors.isOnchain = createSelector(payInputSelector, infoSelectors.networkSelector, (input, network) => {
payFormSelectors.isOnchain = createSelector(
payInputSelector,
infoSelectors.networkSelector,
(input, network) => {
try {
bitcoin.address.toOutputScript(input, network.bitcoinJsNetwork)
return true
} catch (e) {
return false
}
})
}
)
payFormSelectors.isLn = createSelector(payInputSelector, input => {
if (!input.startsWith('ln')) {

3
app/reducers/payment.js

@ -69,7 +69,8 @@ export const fetchPayments = () => dispatch => {
}
// 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 })
// Receive IPC event for successful payment
// TODO: Add payment to state, not a total re-fetch

16
app/reducers/peers.js

@ -76,7 +76,8 @@ export const fetchPeers = () => async dispatch => {
}
// Receive IPC event for peers
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
export const connectRequest = ({ pubkey, host }) => dispatch => {
@ -100,7 +101,8 @@ export const disconnectRequest = ({ pubkey }) => dispatch => {
}
// Send IPC receive for successfully disconnecting from a peer
export const disconnectSuccess = (event, { pubkey }) => dispatch => dispatch({ type: DISCONNECT_SUCCESS, pubkey })
export const disconnectSuccess = (event, { pubkey }) => dispatch =>
dispatch({ type: DISCONNECT_SUCCESS, pubkey })
// ------------------------------------
// Action Handlers
@ -124,7 +126,10 @@ const ACTION_HANDLERS = {
}),
[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)
}),
[SET_PEER]: (state, { peer }) => ({ ...state, peer }),
@ -141,7 +146,10 @@ const peersSearchQuerySelector = state => state.peers.searchQuery
peersSelectors.peerModalOpen = createSelector(peerSelector, peer => !!peer)
peersSelectors.filteredPeers = createSelector(peersSelector, peersSearchQuerySelector, (peers, query) =>
peersSelectors.filteredPeers = createSelector(
peersSelector,
peersSearchQuerySelector,
(peers, query) =>
peers.filter(peer => peer.pub_key.includes(query) || peer.address.includes(query))
)

5
app/reducers/requestform.js

@ -55,7 +55,10 @@ export function setRequestCurrencyFilters(showCurrencyFilters) {
const ACTION_HANDLERS = {
[SET_REQUEST_AMOUNT]: (state, { amount }) => ({ ...state, amount }),
[SET_REQUEST_MEMO]: (state, { memo }) => ({ ...state, memo }),
[SET_REQUEST_CURRENCY_FILTERS]: (state, { showCurrencyFilters }) => ({ ...state, showCurrencyFilters }),
[SET_REQUEST_CURRENCY_FILTERS]: (state, { showCurrencyFilters }) => ({
...state,
showCurrencyFilters
}),
[RESET_FORM]: () => initialState
}

8
app/reducers/ticker.js

@ -97,7 +97,10 @@ tickerSelectors.currentCurrencyFilters = createSelector(
(currency, filters) => filters.filter(f => f.key !== currency)
)
tickerSelectors.currencyName = createSelector(currencySelector, infoSelectors.networkSelector, (currency, network) => {
tickerSelectors.currencyName = createSelector(
currencySelector,
infoSelectors.networkSelector,
(currency, network) => {
let unit = currency
if (currency === 'btc') {
unit = 'BTC'
@ -107,7 +110,8 @@ tickerSelectors.currencyName = createSelector(currencySelector, infoSelectors.ne
}
return `${network.unitPrefix}${unit}`
})
}
)
export { tickerSelectors }

14
app/reducers/transaction.js

@ -105,7 +105,8 @@ export const newTransaction = (event, { transaction }) => dispatch => {
dispatch({ type: ADD_TRANSACTION, transaction })
// HTML 5 desktop notification for the new transaction
const notifTitle = transaction.amount > 0 ? 'On-chain Transaction Received!' : 'On-chain Transaction Sent!'
const notifTitle =
transaction.amount > 0 ? 'On-chain Transaction Received!' : 'On-chain Transaction Sent!'
const notifBody =
transaction.amount > 0
? "Lucky you, you just received a new on-chain transaction. I'm jealous."
@ -123,7 +124,11 @@ export const newTransaction = (event, { transaction }) => dispatch => {
const ACTION_HANDLERS = {
[GET_TRANSACTIONS]: state => ({ ...state, transactionLoading: true }),
[SEND_TRANSACTION]: state => ({ ...state, sendingTransaction: true }),
[RECEIVE_TRANSACTIONS]: (state, { transactions }) => ({ ...state, transactionLoading: false, transactions }),
[RECEIVE_TRANSACTIONS]: (state, { transactions }) => ({
...state,
transactionLoading: false,
transactions
}),
[TRANSACTION_SUCCESSFULL]: state => ({ ...state, sendingTransaction: false }),
[TRANSACTION_FAILED]: state => ({ ...state, sendingTransaction: false }),
[ADD_TRANSACTION]: (state, { transaction }) => {
@ -139,7 +144,10 @@ const ACTION_HANDLERS = {
...state,
successTransactionScreen: { show: true, txid }
}),
[HIDE_SUCCESS_TRANSACTION_SCREEN]: state => ({ ...state, successTransactionScreen: { show: false, txid: '' } })
[HIDE_SUCCESS_TRANSACTION_SCREEN]: state => ({
...state,
successTransactionScreen: { show: false, txid: '' }
})
}
// ------------------------------------

4
app/routes/activity/components/Activity.js

@ -135,7 +135,9 @@ class Activity extends Component {
<li className={styles.activity} key={index}>
<h2>{activityBlock.title}</h2>
<ul>
{activityBlock.activity.map((activity, i) => <li key={i}>{this.renderActivity(activity.el)}</li>)}
{activityBlock.activity.map((activity, i) => (
<li key={i}>{this.renderActivity(activity.el)}</li>
))}
</ul>
</li>
))}

4
app/routes/activity/components/components/Invoice/Invoice.js

@ -25,7 +25,9 @@ const Invoice = ({ invoice, ticker, currentTicker, showActivityModal, currencyNa
<h3>{invoice.settled ? 'Received payment' : 'Requested payment'}</h3>
</div>
<div className={styles.subtitle}>
<Moment format="h:mm a">{invoice.settled ? invoice.settled_date * 1000 : invoice.creation_date * 1000}</Moment>
<Moment format="h:mm a">
{invoice.settled ? invoice.settled_date * 1000 : invoice.creation_date * 1000}
</Moment>
</div>
</div>
<div className={`${styles.amount} ${invoice.settled ? styles.positive : styles.negative}`}>

19
app/routes/activity/components/components/Transaction/Transaction.js

@ -8,7 +8,10 @@ import Value from 'components/Value'
import styles from '../Activity.scss'
const Transaction = ({ transaction, ticker, currentTicker, showActivityModal, currencyName }) => (
<div className={styles.container} onClick={() => showActivityModal('TRANSACTION', { transaction })}>
<div
className={styles.container}
onClick={() => showActivityModal('TRANSACTION', { transaction })}
>
<div className={styles.data}>
<div className={styles.title}>
<h3>{transaction.amount > 0 ? 'Received' : 'Sent'}</h3>
@ -17,10 +20,18 @@ const Transaction = ({ transaction, ticker, currentTicker, showActivityModal, cu
<Moment format="h:mm a">{transaction.time_stamp * 1000}</Moment>
</div>
</div>
<div className={`${styles.amount} ${transaction.amount > 0 ? styles.positive : styles.negative}`}>
<div
className={`${styles.amount} ${transaction.amount > 0 ? styles.positive : styles.negative}`}
>
<span className="hint--top" data-hint="Transaction amount">
<i className={transaction.amount > 0 ? styles.plus : styles.minus}>{transaction.amount > 0 ? '+' : '-'}</i>
<Value value={transaction.amount} currency={ticker.currency} currentTicker={currentTicker} />
<i className={transaction.amount > 0 ? styles.plus : styles.minus}>
{transaction.amount > 0 ? '+' : '-'}
</i>
<Value
value={transaction.amount}
currency={ticker.currency}
currentTicker={currentTicker}
/>
<i> {currencyName}</i>
</span>
<span className="hint--bottom" data-hint="Transaction fee">

20
app/routes/app/containers/AppContainer.js

@ -11,9 +11,20 @@ import { fetchInfo } from 'reducers/info'
import { setFormType } from 'reducers/form'
import { setPayAmount, setPayInput, setCurrencyFilters, updatePayErrors, payFormSelectors } from 'reducers/payform'
import {
setPayAmount,
setPayInput,
setCurrencyFilters,
updatePayErrors,
payFormSelectors
} from 'reducers/payform'
import { setRequestAmount, setRequestMemo, setRequestCurrencyFilters, requestFormSelectors } from 'reducers/requestform'
import {
setRequestAmount,
setRequestMemo,
setRequestCurrencyFilters,
requestFormSelectors
} from 'reducers/requestform'
import { sendCoins } from 'reducers/transaction'
@ -230,7 +241,10 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => {
if (!stateProps.payFormIsValid.isValid) {
dispatchProps.updatePayErrors({
amount: Object.prototype.hasOwnProperty.call(stateProps.payFormIsValid.errors, 'amount'),
payInput: Object.prototype.hasOwnProperty.call(stateProps.payFormIsValid.errors, 'payInput')
payInput: Object.prototype.hasOwnProperty.call(
stateProps.payFormIsValid.errors,
'payInput'
)
})
return

3
app/utils/blockExplorer.js

@ -2,7 +2,8 @@ import { shell } from 'electron'
const showTransaction = (network, txid) => shell.openExternal(`${network.explorerUrl}/tx/${txid}`)
const showBlock = (network, blockHash) => shell.openExternal(`${network.explorerUrl}/block/${blockHash}`)
const showBlock = (network, blockHash) =>
shell.openExternal(`${network.explorerUrl}/block/${blockHash}`)
const showChannelClosing = channel => showTransaction(channel.closing_txid)

4
internals/scripts/CheckBuiltsExist.js

@ -10,7 +10,9 @@ function CheckBuildsExist() {
if (!fs.existsSync(mainPath)) {
throw new Error(
chalk.whiteBright.bgRed.bold('The main process is not built yet. Build it by running "npm run build-main"')
chalk.whiteBright.bgRed.bold(
'The main process is not built yet. Build it by running "npm run build-main"'
)
)
}

10
test/reducers/channels.spec.js

@ -43,7 +43,9 @@ describe('reducers', () => {
})
it('should correctly setChannel', () => {
expect(channelsReducer(undefined, { type: SET_CHANNEL, channel: 'channel' })).toMatchSnapshot()
expect(
channelsReducer(undefined, { type: SET_CHANNEL, channel: 'channel' })
).toMatchSnapshot()
})
it('should correctly getChannels', () => {
@ -52,7 +54,11 @@ describe('reducers', () => {
it('should correctly receiveChannel', () => {
expect(
channelsReducer(undefined, { type: RECEIVE_CHANNELS, channels: [1, 2], pendingChannels: [3, 4] })
channelsReducer(undefined, {
type: RECEIVE_CHANNELS,
channels: [1, 2],
pendingChannels: [3, 4]
})
).toMatchSnapshot()
})

12
test/reducers/invoice.spec.js

@ -58,7 +58,9 @@ describe('reducers', () => {
})
it('should correctly searchInvoices', () => {
expect(invoiceReducer(undefined, { type: SEARCH_INVOICES, invoicesSearchText: 'foo' })).toMatchSnapshot()
expect(
invoiceReducer(undefined, { type: SEARCH_INVOICES, invoicesSearchText: 'foo' })
).toMatchSnapshot()
})
it('should correctly setInvoice', () => {
@ -84,7 +86,9 @@ describe('reducers', () => {
})
it('should correctly receiveInvoices', () => {
expect(invoiceReducer(undefined, { type: RECEIVE_INVOICES, invoices: [1, 2] })).toMatchSnapshot()
expect(
invoiceReducer(undefined, { type: RECEIVE_INVOICES, invoices: [1, 2] })
).toMatchSnapshot()
})
it('should correctly sendInvoice', () => {
@ -92,7 +96,9 @@ describe('reducers', () => {
})
it('should correctly invcoiceSuccessful', () => {
expect(invoiceReducer(undefined, { type: INVOICE_SUCCESSFUL, invoice: 'foo' })).toMatchSnapshot()
expect(
invoiceReducer(undefined, { type: INVOICE_SUCCESSFUL, invoice: 'foo' })
).toMatchSnapshot()
})
it('should correctly invcoiceFailed', () => {

8
test/reducers/payment.spec.js

@ -42,11 +42,15 @@ describe('reducers', () => {
})
it('should correctly receivePayments', () => {
expect(paymentReducer(undefined, { type: RECEIVE_PAYMENTS, payments: [1, 2] })).toMatchSnapshot()
expect(
paymentReducer(undefined, { type: RECEIVE_PAYMENTS, payments: [1, 2] })
).toMatchSnapshot()
})
it('should correctly paymentSuccessful', () => {
expect(paymentReducer(undefined, { type: PAYMENT_SUCCESSFULL, payment: 'foo' })).toMatchSnapshot()
expect(
paymentReducer(undefined, { type: PAYMENT_SUCCESSFULL, payment: 'foo' })
).toMatchSnapshot()
})
})
})

7
test/reducers/ticker.spec.js

@ -1,4 +1,9 @@
import tickerReducer, { SET_CURRENCY, SET_CRYPTO, GET_TICKERS, RECIEVE_TICKERS } from '../../app/reducers/ticker'
import tickerReducer, {
SET_CURRENCY,
SET_CRYPTO,
GET_TICKERS,
RECIEVE_TICKERS
} from '../../app/reducers/ticker'
describe('reducers', () => {
describe('tickerReducer', () => {

8
test/runTests.js

@ -3,8 +3,12 @@ const path = require('path')
const s = `\\${path.sep}`
const pattern =
process.argv[2] === 'e2e' ? `test${s}e2e${s}.+\\.spec\\.js` : `test${s}(?!e2e${s})[^${s}]+${s}.+\\.spec\\.js$`
process.argv[2] === 'e2e'
? `test${s}e2e${s}.+\\.spec\\.js`
: `test${s}(?!e2e${s})[^${s}]+${s}.+\\.spec\\.js$`
const result = spawn.sync(path.normalize('./node_modules/.bin/jest'), [pattern], { stdio: 'inherit' })
const result = spawn.sync(path.normalize('./node_modules/.bin/jest'), [pattern], {
stdio: 'inherit'
})
process.exit(result.status)

4
webpack.config.renderer.dev.js

@ -25,7 +25,9 @@ const manifest = path.resolve(dll, 'renderer.json')
* Warn if the DLL is not built
*/
if (!(fs.existsSync(dll) && fs.existsSync(manifest))) {
mainLog.info('The DLL files are missing. Sit back while we build them for you with "npm run build-dll"')
mainLog.info(
'The DLL files are missing. Sit back while we build them for you with "npm run build-dll"'
)
execSync('npm run build-dll')
}

Loading…
Cancel
Save