diff --git a/.eslintrc b/.eslintrc index 24d49d7e..359c47a9 100644 --- a/.eslintrc +++ b/.eslintrc @@ -44,7 +44,7 @@ "camelcase": 0, "curly": ["error", "all"], "react/require-default-props": 0, - "max-len": ["error", { "code": 150, "ignoreUrls": true }], + "max-len": ["error", { "code": 120, "ignoreUrls": true }], "import/no-extraneous-dependencies": 0, "no-confusing-arrow": "error", "no-mixed-operators": "error", diff --git a/.prettierrc b/.prettierrc index 201a0be2..9f5cdc16 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,6 +1,6 @@ { "bracketSpacing": true, - "printWidth": 150, + "printWidth": 100, "semi": false, "singleQuote": true, "trailingComma": "none", diff --git a/app/api/index.js b/app/api/index.js index 86d630a4..beb21fac 100644 --- a/app/api/index.js +++ b/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() { diff --git a/app/components/Activity/ActivityModal.js b/app/components/Activity/ActivityModal.js index 11ab91b8..414ffe89 100644 --- a/app/components/Activity/ActivityModal.js +++ b/app/components/Activity/ActivityModal.js @@ -37,7 +37,13 @@ const ActivityModal = ({ - + ) } diff --git a/app/components/Activity/Countdown.js b/app/components/Activity/Countdown.js index 7ced66a2..fcc7beea 100644 --- a/app/components/Activity/Countdown.js +++ b/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)) diff --git a/app/components/Activity/InvoiceModal.js b/app/components/Activity/InvoiceModal.js index 391ecc42..3f5c2bc1 100644 --- a/app/components/Activity/InvoiceModal.js +++ b/app/components/Activity/InvoiceModal.js @@ -20,7 +20,13 @@ const InvoiceModal = ({ ticker, currentTicker, - toggleCurrencyProps: { setActivityModalCurrencyFilters, showCurrencyFilters, currencyName, currentCurrencyFilters, onCurrencyFilterClick } + toggleCurrencyProps: { + setActivityModalCurrencyFilters, + showCurrencyFilters, + currencyName, + currentCurrencyFilters, + onCurrencyFilterClick + } }) => { const copyPaymentRequest = () => { copy(invoice.payment_request) @@ -49,9 +55,16 @@ const InvoiceModal = ({

- +

-
setActivityModalCurrencyFilters(!showCurrencyFilters)}> +
setActivityModalCurrencyFilters(!showCurrencyFilters)} + > {currencyName} diff --git a/app/components/Activity/PaymentModal.js b/app/components/Activity/PaymentModal.js index 411ceaec..9b981e03 100644 --- a/app/components/Activity/PaymentModal.js +++ b/app/components/Activity/PaymentModal.js @@ -19,7 +19,13 @@ const PaymentModal = ({ ticker, currentTicker, - toggleCurrencyProps: { setActivityModalCurrencyFilters, showCurrencyFilters, currencyName, currentCurrencyFilters, onCurrencyFilterClick } + toggleCurrencyProps: { + setActivityModalCurrencyFilters, + showCurrencyFilters, + currencyName, + currentCurrencyFilters, + onCurrencyFilterClick + } }) => (
@@ -44,7 +50,10 @@ const PaymentModal = ({ 0 && styles.active}`}>- -
setActivityModalCurrencyFilters(!showCurrencyFilters)}> +
setActivityModalCurrencyFilters(!showCurrencyFilters)} + > {currencyName} diff --git a/app/components/Activity/TransactionModal.js b/app/components/Activity/TransactionModal.js index 8eef184a..7ee3f867 100644 --- a/app/components/Activity/TransactionModal.js +++ b/app/components/Activity/TransactionModal.js @@ -21,7 +21,13 @@ const TransactionModal = ({ currentTicker, network, - toggleCurrencyProps: { setActivityModalCurrencyFilters, showCurrencyFilters, currencyName, currentCurrencyFilters, onCurrencyFilterClick } + toggleCurrencyProps: { + setActivityModalCurrencyFilters, + showCurrencyFilters, + currencyName, + currentCurrencyFilters, + onCurrencyFilterClick + } }) => (
@@ -32,12 +38,19 @@ const TransactionModal = ({
- blockExplorer.showTransaction(network, transaction.tx_hash)}> + blockExplorer.showTransaction(network, transaction.tx_hash)} + > On-Chain
- + {currencyName} fee
@@ -45,10 +58,19 @@ const TransactionModal = ({

- 0 && styles.active}`}>{transaction.amount > 0 ? '+' : '-'} - + 0 && styles.active}`}> + {transaction.amount > 0 ? '+' : '-'} + +

-
setActivityModalCurrencyFilters(!showCurrencyFilters)}> +
setActivityModalCurrencyFilters(!showCurrencyFilters)} + > {currencyName} @@ -68,7 +90,9 @@ const TransactionModal = ({
-

blockExplorer.showTransaction(network, transaction.tx_hash)}>{transaction.tx_hash}

+

blockExplorer.showTransaction(network, transaction.tx_hash)}> + {transaction.tx_hash} +

) diff --git a/app/components/Contacts/AddChannel.js b/app/components/Contacts/AddChannel.js index abd44edc..92e47fd9 100644 --- a/app/components/Contacts/AddChannel.js +++ b/app/components/Contacts/AddChannel.js @@ -108,7 +108,9 @@ const AddChannel = ({

{node.alias.trim()} - ({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 + )})

) : ( @@ -125,7 +127,9 @@ const AddChannel = ({ {showManualForm && (
-

Hm, looks like we can't see that node from here, wanna try to manually connect?

+

+ Hm, looks like we can't see that node from here, wanna try to manually connect? +

Connect Manually
diff --git a/app/components/Contacts/ConnectManually.js b/app/components/Contacts/ConnectManually.js index 38ba8e6c..adc380d7 100644 --- a/app/components/Contacts/ConnectManually.js +++ b/app/components/Contacts/ConnectManually.js @@ -64,11 +64,16 @@ class ConnectManually extends React.Component {
- {showErrors.manualInput && {manualFormIsValid && manualFormIsValid.errors.manualInput}} + {showErrors.manualInput && ( + {manualFormIsValid && manualFormIsValid.errors.manualInput} + )}
-
+
Submit
diff --git a/app/components/Contacts/ContactModal.js b/app/components/Contacts/ContactModal.js index aa6a0671..867057a6 100644 --- a/app/components/Contacts/ContactModal.js +++ b/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 } @@ -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 @@ -71,7 +82,10 @@ const ContactModal = ({ isOpen, channel, closeContactModal, channelNodes, closeC

Can Pay

-
+
{btc.satoshisToBtc(channel.local_balance)} BTC
@@ -79,7 +93,10 @@ const ContactModal = ({ isOpen, channel, closeContactModal, channelNodes, closeC

Can Receive

-
+
{btc.satoshisToBtc(channel.remote_balance)} BTC
diff --git a/app/components/Contacts/ContactsForm.js b/app/components/Contacts/ContactsForm.js index 6e9a8f9e..4231f7ac 100644 --- a/app/components/Contacts/ContactsForm.js +++ b/app/components/Contacts/ContactsForm.js @@ -79,7 +79,13 @@ class ContactsForm extends React.Component { openChannel({ pubkey: node.pub_key, host: node.addresses[0].addr, local_amt: contactsform.contactCapacity })} + onClick={() => + openChannel({ + pubkey: node.pub_key, + host: node.addresses[0].addr, + local_amt: contactsform.contactCapacity + }) + } > Connect @@ -103,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 }) @@ -157,7 +164,9 @@ class ContactsForm extends React.Component {

{node.alias.trim()} - ({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 + )})

) : ( @@ -174,7 +183,10 @@ class ContactsForm extends React.Component { {showManualForm && (
-

Hm, looks like we can’t see that contact from here. Want to try and manually connect?

+

+ Hm, looks like we can’t see that contact from here. Want to try and manually + connect? +

-
- {showErrors.manualInput && {manualFormIsValid && manualFormIsValid.errors.manualInput}} +
+ {showErrors.manualInput && ( + {manualFormIsValid && manualFormIsValid.errors.manualInput} + )}
)} @@ -212,12 +228,17 @@ 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}%` + }} /> BTC per contact - + diff --git a/app/components/Contacts/Network.js b/app/components/Contacts/Network.js index ef5c345b..88fb996d 100644 --- a/app/components/Contacts/Network.js +++ b/app/components/Contacts/Network.js @@ -26,7 +26,15 @@ class Network extends Component { render() { const { - channels: { searchQuery, filterPulldown, filter, selectedChannel, loadingChannelPubkeys, closingChannelIds, channels }, + channels: { + searchQuery, + filterPulldown, + filter, + selectedChannel, + loadingChannelPubkeys, + closingChannelIds, + channels + }, currentChannels, balance, ticker, @@ -81,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 @@ -101,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 => { @@ -137,10 +151,16 @@ class Network extends Component {

My Network

- {btc.satoshisToBtc(balance.channelBalance)}BTC ≈ ${usdAmount ? usdAmount.toLocaleString() : ''} + {btc.satoshisToBtc(balance.channelBalance)}BTC ≈ ${usdAmount + ? usdAmount.toLocaleString() + : ''}
-
+
@@ -148,7 +168,8 @@ class Network extends Component {
- {!loadingChannelPubkeys.length && !channels.length && } + {!loadingChannelPubkeys.length && + !channels.length && } {(loadingChannelPubkeys.length || channels.length) && (
@@ -207,17 +228,23 @@ class Network extends Component { })} {currentChannels.length && currentChannels.map((channelObj, index) => { - const channel = Object.prototype.hasOwnProperty.call(channelObj, 'channel') ? channelObj.channel : channelObj + const channel = Object.prototype.hasOwnProperty.call(channelObj, 'channel') + ? channelObj.channel + : channelObj const pubkey = channel.remote_node_pub || channel.remote_pubkey return (
  • channelClicked(channel)} >
    - + {closingChannelIds.includes(channel.chan_id) ? ( @@ -228,7 +255,14 @@ class Network extends Component { {displayNodeName(channel)} {selectedChannel === channel && ( - blockExplorer.showTransaction(network, channel.channel_point.split(':')[0])}> + + blockExplorer.showTransaction( + network, + channel.channel_point.split(':')[0] + ) + } + > )} @@ -243,14 +277,22 @@ class Network extends Component {
    Pay Limit

    - + {ticker.currency.toUpperCase()}

    Request Limit

    - + {ticker.currency.toUpperCase()}

    diff --git a/app/components/Contacts/SubmitChannelForm.js b/app/components/Contacts/SubmitChannelForm.js index 153dbd7a..85e2a8a0 100644 --- a/app/components/Contacts/SubmitChannelForm.js +++ b/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 {

    Add Funds to Network

    - Adding a connection will help you send and receive money on the Lightning Network. You aren'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't spening any money, rather moving the money you plan to use onto the network.

    @@ -78,7 +82,10 @@ class SubmitChannelForm extends React.Component { id="amount" />
    -
    setContactsCurrencyFilters(!showCurrencyFilters)}> +
    setContactsCurrencyFilters(!showCurrencyFilters)} + > {currencyName} @@ -98,7 +105,10 @@ class SubmitChannelForm extends React.Component {
    -
    0 && styles.active}`} onClick={formSubmitted}> +
    0 && styles.active}`} + onClick={formSubmitted} + > Submit
    diff --git a/app/components/Contacts/SuggestedNodes.js b/app/components/Contacts/SuggestedNodes.js index 5f136f3a..ef362224 100644 --- a/app/components/Contacts/SuggestedNodes.js +++ b/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 }] }) @@ -21,7 +26,10 @@ const SuggestedNodes = ({ suggestedNodesLoading, suggestedNodes, setNode, openSu return (
    -
    Hmmm, looks like you don't have any channels yet. Here are some suggested nodes to open a channel with to get started
    +
    + Hmmm, looks like you don't have any channels yet. Here are some suggested nodes to open + a channel with to get started +
      {suggestedNodes.map(node => ( diff --git a/app/components/CurrencyIcon/CurrencyIcon.js b/app/components/CurrencyIcon/CurrencyIcon.js index 89972a64..e77d1904 100644 --- a/app/components/CurrencyIcon/CurrencyIcon.js +++ b/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' ? : + return currency === 'usd' ? ( + + ) : ( + + ) } CurrencyIcon.propTypes = { diff --git a/app/components/Form/Pay.js b/app/components/Form/Pay.js index c1dd3d1b..89e36c04 100644 --- a/app/components/Form/Pay.js +++ b/app/components/Form/Pay.js @@ -142,7 +142,10 @@ class Pay extends Component { readOnly={isLn} />
      -
      setCurrencyFilters(!showCurrencyFilters)}> +
      setCurrencyFilters(!showCurrencyFilters)} + > {currencyName} @@ -160,7 +163,10 @@ class Pay extends Component {
      {`≈ ${usdAmount || 0} USD`}
      -
      +
      {showErrors.amount && {errors.amount}}
      diff --git a/app/components/Form/Request.js b/app/components/Form/Request.js index 66075818..385af043 100644 --- a/app/components/Form/Request.js +++ b/app/components/Form/Request.js @@ -45,9 +45,18 @@ const Request = ({
      - setRequestAmount(event.target.value)} id="amount" placeholder="0.00000000" /> + setRequestAmount(event.target.value)} + id="amount" + placeholder="0.00000000" + />
      -
      setRequestCurrencyFilters(!showCurrencyFilters)}> +
      setRequestCurrencyFilters(!showCurrencyFilters)} + > {currencyName} @@ -82,7 +91,10 @@ const Request = ({
      -
      0 && styles.active}`} onClick={onRequestSubmit}> +
      0 && styles.active}`} + onClick={onRequestSubmit} + > Request
      diff --git a/app/components/Onboarding/ConnectionDetails.js b/app/components/Onboarding/ConnectionDetails.js index 16ca89d9..51f9317a 100644 --- a/app/components/Onboarding/ConnectionDetails.js +++ b/app/components/Onboarding/ConnectionDetails.js @@ -2,7 +2,14 @@ import React from 'react' import PropTypes from 'prop-types' import styles from './ConnectionDetails.scss' -const ConnectionDetails = ({ connectionHost, connectionCert, connectionMacaroon, setConnectionHost, setConnectionCert, setConnectionMacaroon }) => ( +const ConnectionDetails = ({ + connectionHost, + connectionCert, + connectionMacaroon, + setConnectionHost, + setConnectionCert, + setConnectionMacaroon +}) => (
      diff --git a/app/components/Onboarding/InitWallet.js b/app/components/Onboarding/InitWallet.js index 6f6393fe..271d2adb 100644 --- a/app/components/Onboarding/InitWallet.js +++ b/app/components/Onboarding/InitWallet.js @@ -5,7 +5,9 @@ import Signup from './Signup' import styles from './InitWallet.scss' const InitWallet = ({ hasSeed, loginProps, signupProps }) => ( -
      {hasSeed ? : }
      +
      + {hasSeed ? : } +
      ) InitWallet.propTypes = { diff --git a/app/components/Onboarding/Login.js b/app/components/Onboarding/Login.js index 949fee12..83a68209 100644 --- a/app/components/Onboarding/Login.js +++ b/app/components/Onboarding/Login.js @@ -12,11 +12,16 @@ const Login = ({ password, updatePassword, unlockingWallet, unlockWallet, unlock value={password} onChange={event => updatePassword(event.target.value)} /> -

      {unlockWalletError.message}

      +

      + {unlockWalletError.message} +

      - unlockWallet(password)}> + unlockWallet(password)} + > {unlockingWallet ? : 'Unlock'}
      diff --git a/app/components/Onboarding/NewAezeedPassword.js b/app/components/Onboarding/NewAezeedPassword.js index 824bfedb..5808cb10 100644 --- a/app/components/Onboarding/NewAezeedPassword.js +++ b/app/components/Onboarding/NewAezeedPassword.js @@ -28,7 +28,12 @@ const NewAezeedPassword = ({ value={aezeedPasswordConfirmation} onChange={event => updateAezeedPasswordConfirmation(event.target.value)} /> -

      Passwords do not match

      +

      + Passwords do not match +

      ) diff --git a/app/components/Onboarding/NewWalletPassword.js b/app/components/Onboarding/NewWalletPassword.js index d8b23040..bdd14768 100644 --- a/app/components/Onboarding/NewWalletPassword.js +++ b/app/components/Onboarding/NewWalletPassword.js @@ -24,11 +24,17 @@ const NewWalletPassword = ({ updateCreateWalletPasswordConfirmation(event.target.value)} /> -

      Passwords do not match

      +

      + Passwords do not match +

      ) diff --git a/app/components/Onboarding/Onboarding.js b/app/components/Onboarding/Onboarding.js index 738a8fbc..f686ae3c 100644 --- a/app/components/Onboarding/Onboarding.js +++ b/app/components/Onboarding/Onboarding.js @@ -107,7 +107,12 @@ const Onboarding = ({ ) case 3: return ( - + ) @@ -135,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)} > diff --git a/app/components/Onboarding/ReEnterSeed.js b/app/components/Onboarding/ReEnterSeed.js index a41245ee..8f1a2fc5 100644 --- a/app/components/Onboarding/ReEnterSeed.js +++ b/app/components/Onboarding/ReEnterSeed.js @@ -17,7 +17,9 @@ const ReEnterSeed = ({ seed, seedInput, updateSeedInput }) => ( placeholder="word" value={seedInput[index] ? seedInput[index].word : ''} onChange={event => updateSeedInput({ word: event.target.value, index })} - className={`${styles.word} ${seedInput[index] && word === seedInput[index].word ? styles.valid : styles.invalid}`} + className={`${styles.word} ${ + seedInput[index] && word === seedInput[index].word ? styles.valid : styles.invalid + }`} />
  • diff --git a/app/components/Onboarding/Syncing.js b/app/components/Onboarding/Syncing.js index f416a848..99750486 100644 --- a/app/components/Onboarding/Syncing.js +++ b/app/components/Onboarding/Syncing.js @@ -23,9 +23,16 @@ class Syncing extends Component {

    Syncing to the blockchain...

    -
    +
    -

    {Number.isNaN(parseInt(syncPercentage, 10)) || syncPercentage.toString().length === 0 ? '' : `${syncPercentage}%`}

    +

    + {Number.isNaN(parseInt(syncPercentage, 10)) || syncPercentage.toString().length === 0 + ? '' + : `${syncPercentage}%`} +

    diff --git a/app/components/Wallet/ReceiveModal.js b/app/components/Wallet/ReceiveModal.js index e000ea0d..73b1728d 100644 --- a/app/components/Wallet/ReceiveModal.js +++ b/app/components/Wallet/ReceiveModal.js @@ -65,7 +65,14 @@ class ReceiveModal extends React.Component {
    - +
    @@ -73,7 +80,11 @@ class ReceiveModal extends React.Component {

    Node Public Key

    {pubkey} - copyOnClick(pubkey)} className={`${styles.copy} hint--left`} data-hint="Copy pubkey"> + copyOnClick(pubkey)} + className={`${styles.copy} hint--left`} + data-hint="Copy pubkey" + >

    @@ -83,7 +94,11 @@ class ReceiveModal extends React.Component {

    Bitcoin {network.name} Address

    {address} - copyOnClick(address)} className={`${styles.copy} hint--left`} data-hint="Copy address"> + copyOnClick(address)} + className={`${styles.copy} hint--left`} + data-hint="Copy address" + >

    diff --git a/app/components/Wallet/Wallet.js b/app/components/Wallet/Wallet.js index c0e8b763..cfc50842 100644 --- a/app/components/Wallet/Wallet.js +++ b/app/components/Wallet/Wallet.js @@ -29,7 +29,10 @@ const Wallet = ({ setWalletCurrencyFilters, network }) => { - const usdAmount = btc.satoshisToUsd(parseInt(balance.walletBalance, 10) + parseInt(balance.channelBalance, 10), currentTicker.price_usd) + const usdAmount = btc.satoshisToUsd( + parseInt(balance.walletBalance, 10) + parseInt(balance.channelBalance, 10), + currentTicker.price_usd + ) const onCurrencyFilterClick = currency => { setCurrency(currency) @@ -82,7 +85,9 @@ const Wallet = ({
    - ≈ ${usdAmount ? usdAmount.toLocaleString() : ''} + + ≈ ${usdAmount ? usdAmount.toLocaleString() : ''} +
    @@ -116,10 +121,16 @@ const Wallet = ({
    - { - // TODO(jimmymow): remove this - // eslint-disable-next-line - }Successfully blockExplorer.showTransaction(network, successTransactionScreen.txid)}>sent transaction + Successfully{' '} + { + return blockExplorer.showTransaction(network, successTransactionScreen.txid) + }} + > + sent + {' '} + transaction
    )} diff --git a/app/containers/Root.js b/app/containers/Root.js index e17970f5..762ac0da 100644 --- a/app/containers/Root.js +++ b/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) }) diff --git a/app/lnd/index.js b/app/lnd/index.js index 67e70c47..d132e722 100644 --- a/app/lnd/index.js +++ b/app/lnd/index.js @@ -21,7 +21,8 @@ const initWalletUnlocker = callback => { const lndConfig = config.lnd() const walletUnlockerObj = walletUnlocker(lndConfig.lightningRpc, lndConfig.lightningHost) - const walletUnlockerMethodsCallback = (event, msg, data) => walletUnlockerMethods(walletUnlockerObj, mainLog, event, msg, data) + const walletUnlockerMethodsCallback = (event, msg, data) => + walletUnlockerMethods(walletUnlockerObj, mainLog, event, msg, data) callback(walletUnlockerMethodsCallback) } diff --git a/app/lnd/lib/lightning.js b/app/lnd/lib/lightning.js index ef999f57..61fb342a 100644 --- a/app/lnd/lib/lightning.js +++ b/app/lnd/lib/lightning.js @@ -12,7 +12,12 @@ import config from '../config' // https://github.com/ssllabs/research/wiki/SSL-and-TLS-Deployment-Best-Practices#23-use-secure-cipher-suites process.env.GRPC_SSL_CIPHER_SUITES = process.env.GRPC_SSL_CIPHER_SUITES || - ['ECDHE-ECDSA-AES128-GCM-SHA256', 'ECDHE-ECDSA-AES256-GCM-SHA384', 'ECDHE-ECDSA-AES128-CBC-SHA256', 'ECDHE-ECDSA-CHACHA20-POLY1305'].join(':') + [ + 'ECDHE-ECDSA-AES128-GCM-SHA256', + 'ECDHE-ECDSA-AES256-GCM-SHA384', + 'ECDHE-ECDSA-AES128-CBC-SHA256', + 'ECDHE-ECDSA-CHACHA20-POLY1305' + ].join(':') const lightning = (rpcpath, host) => { const lndConfig = config.lnd() @@ -24,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) diff --git a/app/lnd/lib/walletUnlocker.js b/app/lnd/lib/walletUnlocker.js index e43dd4b0..b43c8b85 100644 --- a/app/lnd/lib/walletUnlocker.js +++ b/app/lnd/lib/walletUnlocker.js @@ -12,7 +12,12 @@ import config from '../config' // https://github.com/ssllabs/research/wiki/SSL-and-TLS-Deployment-Best-Practices#23-use-secure-cipher-suites process.env.GRPC_SSL_CIPHER_SUITES = process.env.GRPC_SSL_CIPHER_SUITES || - ['ECDHE-ECDSA-AES128-GCM-SHA256', 'ECDHE-ECDSA-AES256-GCM-SHA384', 'ECDHE-ECDSA-AES128-CBC-SHA256', 'ECDHE-ECDSA-CHACHA20-POLY1305'].join(':') + [ + 'ECDHE-ECDSA-AES128-GCM-SHA256', + 'ECDHE-ECDSA-AES256-GCM-SHA384', + 'ECDHE-ECDSA-AES128-CBC-SHA256', + 'ECDHE-ECDSA-CHACHA20-POLY1305' + ].join(':') const walletUnlocker = (rpcpath, host) => { const lndConfig = config.lnd() diff --git a/app/lnd/methods/channelController.js b/app/lnd/methods/channelController.js index ae69ca4c..07bc86a2 100644 --- a/app/lnd/methods/channelController.js +++ b/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) diff --git a/app/lnd/methods/index.js b/app/lnd/methods/index.js index 4cc55bbd..3c2a2521 100644 --- a/app/lnd/methods/index.js +++ b/app/lnd/methods/index.js @@ -78,9 +78,24 @@ export default function(lnd, log, event, msg, data) { break case 'channels': // Data looks like - // [ { channels: [] }, { total_limbo_balance: 0, pending_open_channels: [], pending_closing_channels: [], pending_force_closing_channels: [] } ] - Promise.all([channelController.listChannels, channelController.pendingChannels].map(func => func(lnd))) - .then(channelsData => event.sender.send('receiveChannels', { channels: channelsData[0].channels, pendingChannels: channelsData[1] })) + // [ + // { channels: [] }, + // { + // total_limbo_balance: 0, + // pending_open_channels: [], + // pending_closing_channels: [], + // pending_force_closing_channels: [] + // } + // ] + Promise.all( + [channelController.listChannels, channelController.pendingChannels].map(func => func(lnd)) + ) + .then(channelsData => + event.sender.send('receiveChannels', { + channels: channelsData[0].channels, + pendingChannels: channelsData[1] + }) + ) .catch(error => log.error('channels:', error)) break case 'transactions': @@ -113,9 +128,14 @@ 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, channelBalance: balance[1].balance }) + event.sender.send('receiveBalance', { + walletBalance: balance[0].total_balance, + channelBalance: balance[1].balance + }) return balance }) .catch(error => log.error('balance:', error)) @@ -172,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() }) diff --git a/app/lnd/methods/networkController.js b/app/lnd/methods/networkController.js index 068bcc1f..e7c4afae 100644 --- a/app/lnd/methods/networkController.js +++ b/app/lnd/methods/networkController.js @@ -51,7 +51,8 @@ export function describeGraph(lnd) { } /** - * Attempts to query the daemon’s Channel Router for a possible route to a target destination capable of carrying a specific amount of satoshis + * Attempts to query the daemon’s Channel Router for a possible route to a + * target destination capable of carrying a specific amount of satoshis * @param {[type]} lnd [description] * @param {[type]} pubkey [description] * @param {[type]} amount [description] diff --git a/app/lnd/methods/walletController.js b/app/lnd/methods/walletController.js index 3e6c0f5f..1d0309b4 100644 --- a/app/lnd/methods/walletController.js +++ b/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( { diff --git a/app/lnd/subscribe/channelgraph.js b/app/lnd/subscribe/channelgraph.js index c1e2e882..5f63948f 100644 --- a/app/lnd/subscribe/channelgraph.js +++ b/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 }) + ) } diff --git a/app/main.dev.js b/app/main.dev.js index 96413d0a..2216c5c6 100644 --- a/app/main.dev.js +++ b/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 @@ -154,7 +156,11 @@ const startLnd = (alias, autopilot) => { mainLog.debug(' > cert:', lndConfig.cert) mainLog.debug(' > macaroon:', lndConfig.macaroon) - const neutrinoArgs = [`--configfile=${lndConfig.configPath}`, `${autopilot ? '--autopilot.active' : ''}`, `${alias ? `--alias=${alias}` : ''}`] + const neutrinoArgs = [ + `--configfile=${lndConfig.configPath}`, + `${autopilot ? '--autopilot.active' : ''}`, + `${alias ? `--alias=${alias}` : ''}` + ] const neutrino = spawn(lndConfig.lndPath, neutrinoArgs) .on('error', error => { @@ -205,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) } diff --git a/app/menu.js b/app/menu.js index a320c6b0..150dea1c 100644 --- a/app/menu.js +++ b/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' }, { diff --git a/app/reducers/activity.js b/app/reducers/activity.js index e0029ce1..dc80db0a 100644 --- a/app/reducers/activity.js +++ b/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,8 +224,11 @@ const allActivity = createSelector( const invoiceActivity = createSelector(invoicesSelector, invoices => groupAll(invoices)) -const sentActivity = createSelector(transactionsSelector, paymentsSelector, (transactions, payments) => - groupAll([...transactions.filter(transaction => transaction.amount < 0), ...payments]) +const sentActivity = createSelector( + transactionsSelector, + paymentsSelector, + (transactions, payments) => + groupAll([...transactions.filter(transaction => transaction.amount < 0), ...payments]) ) const pendingActivity = createSelector(invoicesSelector, invoices => @@ -221,7 +244,11 @@ 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 } diff --git a/app/reducers/address.js b/app/reducers/address.js index 580f2e24..29af7b97 100644 --- a/app/reducers/address.js +++ b/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 diff --git a/app/reducers/channels.js b/app/reducers/channels.js index b578f4e5..cebf0cb5 100644 --- a/app/reducers/channels.js +++ b/app/reducers/channels.js @@ -180,7 +180,8 @@ export const fetchChannels = () => async dispatch => { } // Receive IPC event for channels -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 export const openChannel = ({ pubkey, host, local_amt }) => dispatch => { @@ -289,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' @@ -326,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 }), @@ -348,35 +356,56 @@ 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, loadingChannelPubkeys: [pubkey, ...state.loadingChannelPubkeys] }), + [ADD_LOADING_PUBKEY]: (state, { pubkey }) => ({ + ...state, + loadingChannelPubkeys: [pubkey, ...state.loadingChannelPubkeys] + }), [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 @@ -391,46 +420,68 @@ 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) -channelsSelectors.activeChannels = createSelector(channelsSelector, openChannels => openChannels.filter(channel => channel.active)) +channelsSelectors.activeChannels = createSelector(channelsSelector, openChannels => + openChannels.filter(channel => channel.active) +) channelsSelectors.activeChannelPubkeys = createSelector(channelsSelector, openChannels => openChannels.filter(channel => channel.active).map(c => c.remote_pubkey) ) -channelsSelectors.nonActiveChannels = createSelector(channelsSelector, openChannels => openChannels.filter(channel => !channel.active)) +channelsSelectors.nonActiveChannels = createSelector(channelsSelector, openChannels => + openChannels.filter(channel => !channel.active) +) channelsSelectors.nonActiveChannelPubkeys = createSelector(channelsSelector, openChannels => openChannels.filter(channel => !channel.active).map(c => c.remote_pubkey) ) -channelsSelectors.pendingOpenChannels = createSelector(pendingOpenChannelsSelector, pendingOpenChannels => pendingOpenChannels) +channelsSelectors.pendingOpenChannels = createSelector( + pendingOpenChannelsSelector, + pendingOpenChannels => pendingOpenChannels +) -channelsSelectors.pendingOpenChannelPubkeys = createSelector(pendingOpenChannelsSelector, pendingOpenChannels => - pendingOpenChannels.map(pendingChannel => pendingChannel.channel.remote_node_pub) +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) => { - const chanPubkeys = channels.map(channel => channel.remote_pubkey) +channelsSelectors.channelNodes = createSelector( + channelsSelector, + nodesSelector, + (channels, nodes) => { + const chanPubkeys = channels.map(channel => channel.remote_pubkey) - return filter(nodes, node => chanPubkeys.includes(node.pub_key)) -}) + return filter(nodes, node => chanPubkeys.includes(node.pub_key)) + } +) const allChannels = createSelector( channelsSelectors.activeChannels, @@ -451,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 [ @@ -516,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) + ) } ) diff --git a/app/reducers/contactsform.js b/app/reducers/contactsform.js index ce9e761c..25b91fc2 100644 --- a/app/reducers/contactsform.js +++ b/app/reducers/contactsform.js @@ -178,11 +178,20 @@ const ACTION_HANDLERS = { [SET_NODE]: (state, { node }) => ({ ...state, node }), - [UPDATE_MANUAL_FORM_ERRORS]: (state, { errorsObject }) => ({ ...state, showErrors: Object.assign(state.showErrors, errorsObject) }), + [UPDATE_MANUAL_FORM_ERRORS]: (state, { errorsObject }) => ({ + ...state, + 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 + }) } // ------------------------------------ @@ -207,27 +216,34 @@ const contactableFirst = (a, b) => { return 0 } -contactFormSelectors.filteredNetworkNodes = createSelector(networkNodesSelector, searchQuerySelector, (nodes, searchQuery) => { - // If there is no search query default to showing the first 20 nodes from the nodes array - // (performance hit to render the entire thing by default) - // if (!searchQuery.length) { return nodes.sort(contactableFirst).slice(0, 20) } +contactFormSelectors.filteredNetworkNodes = createSelector( + networkNodesSelector, + searchQuerySelector, + (nodes, searchQuery) => { + // If there is no search query default to showing the first 20 nodes from the nodes array + // (performance hit to render the entire thing by default) + // if (!searchQuery.length) { return nodes.sort(contactableFirst).slice(0, 20) } - // return an empty array if there is no search query - if (!searchQuery.length) { - return [] - } + // return an empty array if there is no search query + if (!searchQuery.length) { + return [] + } - // if there is an '@' in the search query we are assuming they are using the format pubkey@host - // we can ignore the '@' and the host and just grab the pubkey for our search - const query = searchQuery.includes('@') ? searchQuery.split('@')[0] : searchQuery + // if there is an '@' in the search query we are assuming they are using the format pubkey@host + // we can ignore the '@' and the host and just grab the pubkey for our search + 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) + // list of the nodes + 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 - return list.slice(0, 20) -}) + // 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 + return list.slice(0, 20) + } +) contactFormSelectors.showManualForm = createSelector( searchQuerySelector, diff --git a/app/reducers/info.js b/app/reducers/info.js index f626ebb0..49dba465 100644 --- a/app/reducers/info.js +++ b/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 + }) } // ------------------------------------ diff --git a/app/reducers/invoice.js b/app/reducers/invoice.js index d399c853..4ab41be7 100644 --- a/app/reducers/invoice.js +++ b/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 => { @@ -156,7 +157,11 @@ const ACTION_HANDLERS = { [RECEIVE_INVOICES]: (state, { invoices }) => ({ ...state, invoiceLoading: false, invoices }), [SEND_INVOICE]: state => ({ ...state, invoiceLoading: true }), - [INVOICE_SUCCESSFUL]: (state, { invoice }) => ({ ...state, invoiceLoading: false, invoices: [invoice, ...state.invoices] }), + [INVOICE_SUCCESSFUL]: (state, { invoice }) => ({ + ...state, + invoiceLoading: false, + invoices: [invoice, ...state.invoices] + }), [INVOICE_FAILED]: state => ({ ...state, invoiceLoading: false, data: null }), [UPDATE_INVOICE]: (state, action) => { @@ -182,12 +187,18 @@ const invoicesSearchTextSelector = state => state.invoice.invoicesSearchText invoiceSelectors.invoiceModalOpen = createSelector(invoiceSelector, invoice => !!invoice) -invoiceSelectors.invoices = createSelector(invoicesSelector, invoicesSearchTextSelector, (invoices, invoicesSearchText) => - invoices.filter(invoice => invoice.memo.includes(invoicesSearchText)) +invoiceSelectors.invoices = createSelector( + invoicesSelector, + invoicesSearchTextSelector, + (invoices, invoicesSearchText) => + invoices.filter(invoice => invoice.memo.includes(invoicesSearchText)) ) -invoiceSelectors.invoices = createSelector(invoicesSelector, invoicesSearchTextSelector, (invoices, invoicesSearchText) => - invoices.filter(invoice => invoice.memo.includes(invoicesSearchText)) +invoiceSelectors.invoices = createSelector( + invoicesSelector, + invoicesSearchTextSelector, + (invoices, invoicesSearchText) => + invoices.filter(invoice => invoice.memo.includes(invoicesSearchText)) ) export { invoiceSelectors } diff --git a/app/reducers/ipc.js b/app/reducers/ipc.js index ed3fcaed..67f01834 100644 --- a/app/reducers/ipc.js +++ b/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' diff --git a/app/reducers/lnd.js b/app/reducers/lnd.js index 5d72e6a9..7c45858c 100644 --- a/app/reducers/lnd.js +++ b/app/reducers/lnd.js @@ -56,7 +56,12 @@ 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).trim() + trimmed = line + .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] } @@ -93,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 }) @@ -118,15 +127,19 @@ const lndSelectors = {} const blockHeightSelector = state => state.lnd.blockHeight const lndBlockHeightSelector = state => state.lnd.lndBlockHeight -lndSelectors.syncPercentage = createSelector(blockHeightSelector, lndBlockHeightSelector, (blockHeight, lndBlockHeight) => { - const percentage = Math.floor((lndBlockHeight / blockHeight) * 100) +lndSelectors.syncPercentage = createSelector( + blockHeightSelector, + lndBlockHeightSelector, + (blockHeight, lndBlockHeight) => { + const percentage = Math.floor((lndBlockHeight / blockHeight) * 100) - if (percentage === Infinity) { - return '' - } + if (percentage === Infinity) { + return '' + } - return percentage -}) + return percentage + } +) export { lndSelectors } diff --git a/app/reducers/network.js b/app/reducers/network.js index 685b8fd9..e4e7b705 100644 --- a/app/reducers/network.js +++ b/app/reducers/network.js @@ -134,14 +134,16 @@ export const fetchDescribeNetwork = () => dispatch => { } // Receive IPC event for describeNetwork -export const receiveDescribeNetwork = (event, { nodes, edges }) => dispatch => dispatch({ type: RECEIVE_DESCRIBE_NETWORK, nodes, edges }) +export const receiveDescribeNetwork = (event, { nodes, edges }) => dispatch => + dispatch({ type: RECEIVE_DESCRIBE_NETWORK, nodes, edges }) export const queryRoutes = (pubkey, amount) => dispatch => { dispatch(getQueryRoutes(pubkey)) 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 => { @@ -149,7 +151,8 @@ export const fetchInvoiceAndQueryRoutes = payreq => dispatch => { ipcRenderer.send('lnd', { msg: 'getInvoiceAndQueryRoutes', data: { payreq } }) } -export const receiveInvoiceAndQueryRoutes = (event, { routes }) => dispatch => dispatch({ type: RECEIVE_INFO_AND_QUERY_ROUTES, routes }) +export const receiveInvoiceAndQueryRoutes = (event, { routes }) => dispatch => + dispatch({ type: RECEIVE_INFO_AND_QUERY_ROUTES, routes }) // ------------------------------------ // Action Handlers @@ -163,7 +166,11 @@ const ACTION_HANDLERS = { edges }), - [GET_QUERY_ROUTES]: (state, { pubkey }) => ({ ...state, networkLoading: true, selectedNode: { pubkey, routes: [], currentRoute: {} } }), + [GET_QUERY_ROUTES]: (state, { pubkey }) => ({ + ...state, + networkLoading: true, + selectedNode: { pubkey, routes: [], currentRoute: {} } + }), [RECEIVE_QUERY_ROUTES]: (state, { routes }) => ({ ...state, networkLoading: false, @@ -182,14 +189,20 @@ const ACTION_HANDLERS = { [RESET_PAY_REQ]: state => ({ ...state, pay_req: '' }), [GET_INFO_AND_QUERY_ROUTES]: state => ({ ...state, fetchingInvoiceAndQueryingRoutes: true }), - [RECEIVE_INFO_AND_QUERY_ROUTES]: (state, { routes }) => ({ ...state, fetchingInvoiceAndQueryingRoutes: false, payReqRoutes: routes }), + [RECEIVE_INFO_AND_QUERY_ROUTES]: (state, { routes }) => ({ + ...state, + fetchingInvoiceAndQueryingRoutes: false, + payReqRoutes: routes + }), [CLEAR_QUERY_ROUTES]: state => ({ ...state, payReqRoutes: [], currentRoute: {} }), [UPDATE_SELECTED_PEERS]: (state, { peer }) => { 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)) { @@ -207,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)) { @@ -240,9 +255,13 @@ 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)) +networkSelectors.selectedChannelIds = createSelector(selectedChannelsSelector, channels => + channels.map(channel => channel.chan_id) +) networkSelectors.payReqIsLn = createSelector(payReqSelector, input => { if (!input.startsWith('ln')) { diff --git a/app/reducers/onboarding.js b/app/reducers/onboarding.js index 2e5ffbe8..56c69f21 100644 --- a/app/reducers/onboarding.js +++ b/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,9 +156,16 @@ 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', data: { wallet_password, cipher_seed_mnemonic, aezeed_passphrase } }) + ipcRenderer.send('walletUnlocker', { + msg: 'initWallet', + data: { wallet_password, cipher_seed_mnemonic, aezeed_passphrase } + }) dispatch({ type: CREATING_NEW_WALLET }) } @@ -217,10 +225,19 @@ 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_CONFIRMATION]: (state, { createWalletPasswordConfirmation }) => ({ ...state, createWalletPasswordConfirmation }), + [UPDATE_CREATE_WALLET_PASSWORD]: (state, { createWalletPassword }) => ({ + ...state, + createWalletPassword + }), + [UPDATE_CREATE_WALLET_PASSWORD_CONFIRMATION]: (state, { createWalletPasswordConfirmation }) => ({ + ...state, + createWalletPasswordConfirmation + }), [UPDATE_AEZEED_PASSWORD]: (state, { aezeedPassword }) => ({ ...state, aezeedPassword }), - [UPDATE_AEZEED_PASSWORD_CONFIRMATION]: (state, { aezeedPasswordConfirmation }) => ({ ...state, aezeedPasswordConfirmation }), + [UPDATE_AEZEED_PASSWORD_CONFIRMATION]: (state, { aezeedPasswordConfirmation }) => ({ + ...state, + aezeedPasswordConfirmation + }), [UPDATE_SEED_INPUT]: (state, { inputSeedObj }) => ({ ...state, seedInput: Object.assign([], state.seedInput, { [inputSeedObj.index]: inputSeedObj }) @@ -242,8 +259,16 @@ const ACTION_HANDLERS = { [CREATING_NEW_WALLET]: state => ({ ...state, creatingNewWallet: true }), [UNLOCKING_WALLET]: state => ({ ...state, unlockingWallet: true }), - [WALLET_UNLOCKED]: state => ({ ...state, unlockingWallet: false, unlockWalletError: { isError: false, message: '' } }), - [SET_UNLOCK_WALLET_ERROR]: state => ({ ...state, unlockingWallet: false, unlockWalletError: { isError: true, message: 'Incorrect password' } }), + [WALLET_UNLOCKED]: state => ({ + ...state, + unlockingWallet: false, + unlockWalletError: { isError: false, message: '' } + }), + [SET_UNLOCK_WALLET_ERROR]: state => ({ + ...state, + unlockingWallet: false, + unlockWalletError: { isError: true, message: 'Incorrect password' } + }), [SET_SIGNUP_CREATE]: state => ({ ...state, signupForm: { create: true, import: false } }), [SET_SIGNUP_IMPORT]: state => ({ ...state, signupForm: { create: false, import: true } }) @@ -253,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 @@ -261,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, @@ -278,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 } diff --git a/app/reducers/payform.js b/app/reducers/payform.js index 04edcd78..50ec8453 100644 --- a/app/reducers/payform.js +++ b/app/reducers/payform.js @@ -96,12 +96,30 @@ export function resetPayForm() { // Action Handlers // ------------------------------------ const ACTION_HANDLERS = { - [SET_PAY_AMOUNT]: (state, { amount }) => ({ ...state, amount, showErrors: Object.assign(state.showErrors, { amount: false }) }), - [SET_PAY_INPUT]: (state, { payInput }) => ({ ...state, payInput, showErrors: Object.assign(state.showErrors, { payInput: false }) }), - [SET_PAY_INVOICE]: (state, { invoice }) => ({ ...state, invoice, showErrors: Object.assign(state.showErrors, { amount: false }) }), - [SET_PAY_CURRENCY_FILTERS]: (state, { showCurrencyFilters }) => ({ ...state, showCurrencyFilters }), + [SET_PAY_AMOUNT]: (state, { amount }) => ({ + ...state, + amount, + showErrors: Object.assign(state.showErrors, { amount: false }) + }), + [SET_PAY_INPUT]: (state, { payInput }) => ({ + ...state, + payInput, + showErrors: Object.assign(state.showErrors, { payInput: false }) + }), + [SET_PAY_INVOICE]: (state, { invoice }) => ({ + ...state, + invoice, + showErrors: Object.assign(state.showErrors, { amount: false }) + }), + [SET_PAY_CURRENCY_FILTERS]: (state, { showCurrencyFilters }) => ({ + ...state, + showCurrencyFilters + }), - [UPDATE_PAY_ERRORS]: (state, { errorsObject }) => ({ ...state, showErrors: Object.assign(state.showErrors, errorsObject) }), + [UPDATE_PAY_ERRORS]: (state, { errorsObject }) => ({ + ...state, + showErrors: Object.assign(state.showErrors, errorsObject) + }), [RESET_FORM]: () => initialState } @@ -123,14 +141,18 @@ const sendingPaymentSelector = state => state.payment.sendingPayment // ticker const currencySelector = state => state.ticker.currency -payFormSelectors.isOnchain = createSelector(payInputSelector, infoSelectors.networkSelector, (input, network) => { - try { - bitcoin.address.toOutputScript(input, network.bitcoinJsNetwork) - return true - } catch (e) { - return false +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')) { @@ -228,24 +250,29 @@ payFormSelectors.showPayLoadingScreen = createSelector( (sendingTransaction, sendingPayment) => sendingTransaction || sendingPayment ) -payFormSelectors.payFormIsValid = createSelector(payFormSelectors.isOnchain, payFormSelectors.isLn, payAmountSelector, (isOnchain, isLn, amount) => { - const errors = {} +payFormSelectors.payFormIsValid = createSelector( + payFormSelectors.isOnchain, + payFormSelectors.isLn, + payAmountSelector, + (isOnchain, isLn, amount) => { + const errors = {} - if (!isLn && amount <= 0) { - errors.amount = 'Amount must be more than 0' - } + if (!isLn && amount <= 0) { + errors.amount = 'Amount must be more than 0' + } - if (!isOnchain && !isLn) { - errors.payInput = 'Must be a valid BTC address or Lightning Network request' - } + if (!isOnchain && !isLn) { + errors.payInput = 'Must be a valid BTC address or Lightning Network request' + } - return { - errors, - amountIsValid: isEmpty(errors.amount), - payInputIsValid: isEmpty(errors.payInput), - isValid: isEmpty(errors) + return { + errors, + amountIsValid: isEmpty(errors.amount), + payInputIsValid: isEmpty(errors.payInput), + isValid: isEmpty(errors) + } } -}) +) export { payFormSelectors } diff --git a/app/reducers/payment.js b/app/reducers/payment.js index 27c52fdc..c07e07ad 100644 --- a/app/reducers/payment.js +++ b/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 diff --git a/app/reducers/peers.js b/app/reducers/peers.js index 873ce93f..58625cfb 100644 --- a/app/reducers/peers.js +++ b/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,8 +146,11 @@ const peersSearchQuerySelector = state => state.peers.searchQuery peersSelectors.peerModalOpen = createSelector(peerSelector, peer => !!peer) -peersSelectors.filteredPeers = createSelector(peersSelector, peersSearchQuerySelector, (peers, query) => - peers.filter(peer => peer.pub_key.includes(query) || peer.address.includes(query)) +peersSelectors.filteredPeers = createSelector( + peersSelector, + peersSearchQuerySelector, + (peers, query) => + peers.filter(peer => peer.pub_key.includes(query) || peer.address.includes(query)) ) export { peersSelectors } diff --git a/app/reducers/requestform.js b/app/reducers/requestform.js index da34c41c..920be7ef 100644 --- a/app/reducers/requestform.js +++ b/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 } diff --git a/app/reducers/ticker.js b/app/reducers/ticker.js index ab63919c..a6a50ca1 100644 --- a/app/reducers/ticker.js +++ b/app/reducers/ticker.js @@ -91,21 +91,27 @@ tickerSelectors.currentTicker = createSelector( (crypto, btcTicker, ltcTicker) => (crypto === 'btc' ? btcTicker : ltcTicker) ) -tickerSelectors.currentCurrencyFilters = createSelector(currencySelector, currencyFiltersSelector, (currency, filters) => - filters.filter(f => f.key !== currency) +tickerSelectors.currentCurrencyFilters = createSelector( + currencySelector, + currencyFiltersSelector, + (currency, filters) => filters.filter(f => f.key !== currency) ) -tickerSelectors.currencyName = createSelector(currencySelector, infoSelectors.networkSelector, (currency, network) => { - let unit = currency - if (currency === 'btc') { - unit = 'BTC' - } - if (currency === 'sats') { - unit = 'satoshis' - } +tickerSelectors.currencyName = createSelector( + currencySelector, + infoSelectors.networkSelector, + (currency, network) => { + let unit = currency + if (currency === 'btc') { + unit = 'BTC' + } + if (currency === 'sats') { + unit = 'satoshis' + } - return `${network.unitPrefix}${unit}` -}) + return `${network.unitPrefix}${unit}` + } +) export { tickerSelectors } diff --git a/app/reducers/transaction.js b/app/reducers/transaction.js index 719a8d95..25141eb3 100644 --- a/app/reducers/transaction.js +++ b/app/reducers/transaction.js @@ -58,7 +58,8 @@ export const fetchTransactions = () => dispatch => { } // Receive IPC event for payments -export const receiveTransactions = (event, { transactions }) => dispatch => dispatch({ type: RECEIVE_TRANSACTIONS, transactions }) +export const receiveTransactions = (event, { transactions }) => dispatch => + dispatch({ type: RECEIVE_TRANSACTIONS, transactions }) export const sendCoins = ({ value, addr, currency }) => dispatch => { // backend needs amount in satoshis no matter what currency we are using @@ -104,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." @@ -122,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 }) => { @@ -134,8 +140,14 @@ const ACTION_HANDLERS = { transactions: [transaction, ...state.transactions] } }, - [SHOW_SUCCESS_TRANSACTION_SCREEN]: (state, { txid }) => ({ ...state, successTransactionScreen: { show: true, txid } }), - [HIDE_SUCCESS_TRANSACTION_SCREEN]: state => ({ ...state, successTransactionScreen: { show: false, txid: '' } }) + [SHOW_SUCCESS_TRANSACTION_SCREEN]: (state, { txid }) => ({ + ...state, + successTransactionScreen: { show: true, txid } + }), + [HIDE_SUCCESS_TRANSACTION_SCREEN]: state => ({ + ...state, + successTransactionScreen: { show: false, txid: '' } + }) } // ------------------------------------ diff --git a/app/routes/activity/components/Activity.js b/app/routes/activity/components/Activity.js index 40733ed0..bcfedc35 100644 --- a/app/routes/activity/components/Activity.js +++ b/app/routes/activity/components/Activity.js @@ -44,7 +44,13 @@ class Activity extends Component { } else if (Object.prototype.hasOwnProperty.call(activity, 'payment_request')) { // activity is an LN invoice return ( - + ) } // activity is an LN payment @@ -85,7 +91,11 @@ class Activity extends Component { {searchActive ? (
    - updateSearchText(event.target.value)} /> + updateSearchText(event.target.value)} + />
    { @@ -103,7 +113,11 @@ class Activity extends Component {
      {filters.map(f => ( -
    • changeFilter(f)}> +
    • changeFilter(f)} + > {f.name}
      @@ -120,7 +134,11 @@ class Activity extends Component { {currentActivity.map((activityBlock, index) => (
    • {activityBlock.title}

      -
        {activityBlock.activity.map((activity, i) =>
      • {this.renderActivity(activity.el)}
      • )}
      +
        + {activityBlock.activity.map((activity, i) => ( +
      • {this.renderActivity(activity.el)}
      • + ))} +
    • ))}
    diff --git a/app/routes/activity/components/components/Invoice/Invoice.js b/app/routes/activity/components/components/Invoice/Invoice.js index e8a9c82c..c93bef1d 100644 --- a/app/routes/activity/components/components/Invoice/Invoice.js +++ b/app/routes/activity/components/components/Invoice/Invoice.js @@ -10,7 +10,10 @@ import checkmarkIcon from 'icons/check_circle.svg' import styles from '../Activity.scss' const Invoice = ({ invoice, ticker, currentTicker, showActivityModal, currencyName }) => ( -
    showActivityModal('INVOICE', { invoice })}> +
    showActivityModal('INVOICE', { invoice })} + > {!invoice.settled && (
    @@ -22,7 +25,9 @@ const Invoice = ({ invoice, ticker, currentTicker, showActivityModal, currencyNa

    {invoice.settled ? 'Received payment' : 'Requested payment'}

    - {invoice.settled ? invoice.settled_date * 1000 : invoice.creation_date * 1000} + + {invoice.settled ? invoice.settled_date * 1000 : invoice.creation_date * 1000} +
    diff --git a/app/routes/activity/components/components/Transaction/Transaction.js b/app/routes/activity/components/components/Transaction/Transaction.js index 6e768bfa..f6ed8339 100644 --- a/app/routes/activity/components/components/Transaction/Transaction.js +++ b/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 }) => ( -
    showActivityModal('TRANSACTION', { transaction })}> +
    showActivityModal('TRANSACTION', { transaction })} + >

    {transaction.amount > 0 ? 'Received' : 'Sent'}

    @@ -17,10 +20,18 @@ const Transaction = ({ transaction, ticker, currentTicker, showActivityModal, cu {transaction.time_stamp * 1000}
    -
    0 ? styles.positive : styles.negative}`}> +
    0 ? styles.positive : styles.negative}`} + > - 0 ? styles.plus : styles.minus}>{transaction.amount > 0 ? '+' : '-'} - + 0 ? styles.plus : styles.minus}> + {transaction.amount > 0 ? '+' : '-'} + + {currencyName} diff --git a/app/routes/app/components/App.js b/app/routes/app/components/App.js index 38c53f79..b48d0e43 100644 --- a/app/routes/app/components/App.js +++ b/app/routes/app/components/App.js @@ -18,7 +18,15 @@ import styles from './App.scss' class App extends Component { componentWillMount() { - const { fetchTicker, fetchInfo, newAddress, fetchChannels, fetchSuggestedNodes, fetchBalance, fetchDescribeNetwork } = this.props + const { + fetchTicker, + fetchInfo, + newAddress, + fetchChannels, + fetchSuggestedNodes, + fetchBalance, + fetchDescribeNetwork + } = this.props // fetch price ticker fetchTicker() @@ -75,7 +83,11 @@ class App extends Component {
    {children}
    - {contactsFormProps.contactsform.isOpen ? : } + {contactsFormProps.contactsform.isOpen ? ( + + ) : ( + + )}
    diff --git a/app/routes/app/containers/AppContainer.js b/app/routes/app/containers/AppContainer.js index c83bf419..7c15c267 100644 --- a/app/routes/app/containers/AppContainer.js +++ b/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 @@ -312,7 +326,9 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => { suggestedNodesProps: { suggestedNodesLoading: stateProps.channels.suggestedNodesLoading, - suggestedNodes: stateProps.info.data.testnet ? stateProps.channels.suggestedNodes.testnet : stateProps.channels.suggestedNodes.mainnet, + suggestedNodes: stateProps.info.data.testnet + ? stateProps.channels.suggestedNodes.testnet + : stateProps.channels.suggestedNodes.mainnet, setNode: dispatchProps.setNode, openSubmitChannelForm: () => dispatchProps.setChannelFormType('SUBMIT_CHANNEL_FORM') @@ -404,7 +420,9 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => { setContactsCurrencyFilters: dispatchProps.setContactsCurrencyFilters, setCurrencyFilters: dispatchProps.setCurrencyFilters, onCurrencyFilterClick: currency => { - dispatchProps.updateContactCapacity(btc.convert(stateProps.ticker.currency, currency, stateProps.contactsform.contactCapacity)) + dispatchProps.updateContactCapacity( + btc.convert(stateProps.ticker.currency, currency, stateProps.contactsform.contactCapacity) + ) dispatchProps.setCurrency(currency) dispatchProps.setContactsCurrencyFilters(false) } diff --git a/app/store/configureStore.dev.js b/app/store/configureStore.dev.js index 7c6883cb..25ae4a43 100644 --- a/app/store/configureStore.dev.js +++ b/app/store/configureStore.dev.js @@ -49,7 +49,8 @@ const configureStore = initialState => { const store = createStore(rootReducer, initialState, enhancer) if (module.hot) { - module.hot.accept('../reducers', () => store.replaceReducer(require('../reducers'))) // eslint-disable-line global-require + // eslint-disable-next-line global-require + module.hot.accept('../reducers', () => store.replaceReducer(require('../reducers'))) } return store diff --git a/app/utils/blockExplorer.js b/app/utils/blockExplorer.js index e7bea0ba..afa075d0 100644 --- a/app/utils/blockExplorer.js +++ b/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) diff --git a/internals/scripts/CheckBuiltsExist.js b/internals/scripts/CheckBuiltsExist.js index ef876c3c..871163a3 100644 --- a/internals/scripts/CheckBuiltsExist.js +++ b/internals/scripts/CheckBuiltsExist.js @@ -9,11 +9,19 @@ function CheckBuildsExist() { const rendererPath = path.join(__dirname, '..', '..', 'app', 'dist', 'renderer.prod.js') 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"')) + throw new Error( + chalk.whiteBright.bgRed.bold( + 'The main process is not built yet. Build it by running "npm run build-main"' + ) + ) } if (!fs.existsSync(rendererPath)) { - throw new Error(chalk.whiteBright.bgRed.bold('The renderer process is not built yet. Build it by running "npm run build-renderer"')) + throw new Error( + chalk.whiteBright.bgRed.bold( + 'The renderer process is not built yet. Build it by running "npm run build-renderer"' + ) + ) } } diff --git a/test/reducers/channels.spec.js b/test/reducers/channels.spec.js index 26120e99..56f43415 100644 --- a/test/reducers/channels.spec.js +++ b/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', () => { @@ -51,7 +53,13 @@ describe('reducers', () => { }) it('should correctly receiveChannel', () => { - expect(channelsReducer(undefined, { type: RECEIVE_CHANNELS, channels: [1, 2], pendingChannels: [3, 4] })).toMatchSnapshot() + expect( + channelsReducer(undefined, { + type: RECEIVE_CHANNELS, + channels: [1, 2], + pendingChannels: [3, 4] + }) + ).toMatchSnapshot() }) it('should correctly openingChannel', () => { diff --git a/test/reducers/invoice.spec.js b/test/reducers/invoice.spec.js index 3e84aba4..7bbbc099 100644 --- a/test/reducers/invoice.spec.js +++ b/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', () => { @@ -74,7 +76,9 @@ describe('reducers', () => { }) it('should correctly receiveFormInvoice', () => { - expect(invoiceReducer(undefined, { type: RECEIVE_FORM_INVOICE, formInvoice: { payreq: 'foo' } })).toMatchSnapshot() + expect( + invoiceReducer(undefined, { type: RECEIVE_FORM_INVOICE, formInvoice: { payreq: 'foo' } }) + ).toMatchSnapshot() }) it('should correctly getInvoices', () => { @@ -82,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', () => { @@ -90,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', () => { diff --git a/test/reducers/payment.spec.js b/test/reducers/payment.spec.js index 743e64e3..3d2fb436 100644 --- a/test/reducers/payment.spec.js +++ b/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() }) }) }) diff --git a/test/reducers/ticker.spec.js b/test/reducers/ticker.spec.js index af032e62..3ac6ab40 100644 --- a/test/reducers/ticker.spec.js +++ b/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', () => { diff --git a/test/runTests.js b/test/runTests.js index 6d65ad27..1c1598fb 100644 --- a/test/runTests.js +++ b/test/runTests.js @@ -2,8 +2,13 @@ const spawn = require('cross-spawn') 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$` +const pattern = + 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) diff --git a/webpack.config.renderer.dev.js b/webpack.config.renderer.dev.js index 192f00a7..71cb522f 100644 --- a/webpack.config.renderer.dev.js +++ b/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') }