Browse Source
refactor: move helper code to lib directory
renovate/lint-staged-8.x
Tom Kirkpatrick
7 years ago
No known key found for this signature in database
GPG Key ID: 72203A8EC5967EA8
61 changed files with
62 additions and
63 deletions
-
.eslintignore
-
.flowconfig
-
app/components/Activity/InvoiceModal.js
-
app/components/Activity/TransactionModal.js
-
app/components/Contacts/ContactModal.js
-
app/components/Contacts/Network.js
-
app/components/Form/Pay.js
-
app/components/Form/Request.js
-
app/components/Onboarding/Syncing.js
-
app/components/Value/Value.js
-
app/components/Wallet/ReceiveModal.js
-
app/components/Wallet/Wallet.js
-
app/containers/Root.js
-
app/lib/lnd/config.js
-
app/lib/lnd/index.js
-
app/lib/lnd/lightning.js
-
app/lib/lnd/methods/channelController.js
-
app/lib/lnd/methods/index.js
-
app/lib/lnd/methods/invoicesController.js
-
app/lib/lnd/methods/networkController.js
-
app/lib/lnd/methods/paymentsController.js
-
app/lib/lnd/methods/peersController.js
-
app/lib/lnd/methods/walletController.js
-
app/lib/lnd/neutrino.js
-
app/lib/lnd/push/closechannel.js
-
app/lib/lnd/push/openchannel.js
-
app/lib/lnd/push/subscribeinvoice.js
-
app/lib/lnd/subscribe/channelgraph.js
-
app/lib/lnd/subscribe/invoices.js
-
app/lib/lnd/subscribe/transactions.js
-
app/lib/lnd/util.js
-
app/lib/lnd/walletUnlocker.js
-
app/lib/lnd/walletUnlockerMethods/index.js
-
app/lib/utils/api.js
-
app/lib/utils/bech32.js
-
app/lib/utils/blockExplorer.js
-
app/lib/utils/btc.js
-
app/lib/utils/index.js
-
app/lib/utils/log.js
-
app/lib/utils/notifications.js
-
app/lib/utils/usd.js
-
app/lib/zap/controller.js
-
app/lib/zap/menuBuilder.js
-
app/lib/zap/updater.js
-
app/main.dev.js
-
app/reducers/channels.js
-
app/reducers/contactsform.js
-
app/reducers/invoice.js
-
app/reducers/lnd.js
-
app/reducers/network.js
-
app/reducers/payform.js
-
app/reducers/requestform.js
-
app/reducers/ticker.js
-
app/reducers/transaction.js
-
app/routes/activity/components/components/Invoice/Invoice.js
-
app/routes/activity/components/components/Payment/Payment.js
-
app/routes/activity/components/components/Transaction/Transaction.js
-
app/routes/app/containers/AppContainer.js
-
app/utils/.gitkeep
-
test/utils/usd.spec.js
-
webpack.config.renderer.dev.js
|
|
@ -41,9 +41,7 @@ app/main.prod.js |
|
|
|
app/main.prod.js.map |
|
|
|
app/renderer.prod.js |
|
|
|
app/renderer.prod.js.map |
|
|
|
app/style.css |
|
|
|
app/style.css.map |
|
|
|
app/utils/bech32.js |
|
|
|
app/lib/utils/bech32.js |
|
|
|
dist |
|
|
|
dll |
|
|
|
main.js |
|
|
|
|
|
@ -24,5 +24,6 @@ module.name_mapper.extension='styl' -> '<PROJECT_ROOT>/internals/flow/CSSModule. |
|
|
|
module.name_mapper.extension='scss' -> '<PROJECT_ROOT>/internals/flow/CSSModule.js.flow' |
|
|
|
module.name_mapper.extension='png' -> '<PROJECT_ROOT>/internals/flow/WebpackAsset.js.flow' |
|
|
|
module.name_mapper.extension='jpg' -> '<PROJECT_ROOT>/internals/flow/WebpackAsset.js.flow' |
|
|
|
module.system.node.resolve_dirname=app |
|
|
|
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe |
|
|
|
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue |
|
|
|
|
|
@ -5,7 +5,7 @@ import Moment from 'react-moment' |
|
|
|
|
|
|
|
import QRCode from 'qrcode.react' |
|
|
|
import copy from 'copy-to-clipboard' |
|
|
|
import { showNotification } from 'notifications' |
|
|
|
import { showNotification } from 'lib/utils/notifications' |
|
|
|
|
|
|
|
import FaAngleDown from 'react-icons/lib/fa/angle-down' |
|
|
|
|
|
|
|
|
|
@ -9,7 +9,7 @@ import Isvg from 'react-inlinesvg' |
|
|
|
import paperPlane from 'icons/paper_plane.svg' |
|
|
|
import hand from 'icons/hand.svg' |
|
|
|
import link from 'icons/link.svg' |
|
|
|
import { blockExplorer } from 'utils' |
|
|
|
import { blockExplorer } from 'lib/utils' |
|
|
|
|
|
|
|
import Value from 'components/Value' |
|
|
|
|
|
|
|
|
|
@ -4,7 +4,7 @@ import ReactModal from 'react-modal' |
|
|
|
import FaCircle from 'react-icons/lib/fa/circle' |
|
|
|
import MdClose from 'react-icons/lib/md/close' |
|
|
|
|
|
|
|
import { btc } from 'utils' |
|
|
|
import { btc } from 'lib/utils' |
|
|
|
|
|
|
|
import styles from './ContactModal.scss' |
|
|
|
|
|
|
|
|
|
@ -5,7 +5,7 @@ import FaExternalLink from 'react-icons/lib/fa/external-link' |
|
|
|
import FaCircle from 'react-icons/lib/fa/circle' |
|
|
|
import FaRepeat from 'react-icons/lib/fa/repeat' |
|
|
|
import FaAngleDown from 'react-icons/lib/fa/angle-down' |
|
|
|
import { btc, blockExplorer } from 'utils' |
|
|
|
import { btc, blockExplorer } from 'lib/utils' |
|
|
|
import plus from 'icons/plus.svg' |
|
|
|
import search from 'icons/search.svg' |
|
|
|
|
|
|
|
|
|
@ -6,7 +6,7 @@ import paperPlane from 'icons/paper_plane.svg' |
|
|
|
import link from 'icons/link.svg' |
|
|
|
import FaAngleDown from 'react-icons/lib/fa/angle-down' |
|
|
|
|
|
|
|
import { btc } from 'utils' |
|
|
|
import { btc } from 'lib/utils' |
|
|
|
|
|
|
|
import styles from './Pay.scss' |
|
|
|
|
|
|
|
|
|
@ -5,7 +5,7 @@ import Isvg from 'react-inlinesvg' |
|
|
|
import hand from 'icons/hand.svg' |
|
|
|
import FaAngleDown from 'react-icons/lib/fa/angle-down' |
|
|
|
|
|
|
|
import { btc } from 'utils' |
|
|
|
import { btc } from 'lib/utils' |
|
|
|
import styles from './Request.scss' |
|
|
|
|
|
|
|
const Request = ({ |
|
|
|
|
|
@ -5,7 +5,7 @@ import copy from 'copy-to-clipboard' |
|
|
|
import Isvg from 'react-inlinesvg' |
|
|
|
import zapLogo from 'icons/zap_logo.svg' |
|
|
|
import copyIcon from 'icons/copy.svg' |
|
|
|
import { showNotification } from 'notifications' |
|
|
|
import { showNotification } from 'lib/utils/notifications' |
|
|
|
import styles from './Syncing.scss' |
|
|
|
|
|
|
|
class Syncing extends Component { |
|
|
|
|
|
@ -1,6 +1,6 @@ |
|
|
|
import React from 'react' |
|
|
|
import PropTypes from 'prop-types' |
|
|
|
import { btc } from 'utils' |
|
|
|
import { btc } from 'lib/utils' |
|
|
|
|
|
|
|
const Value = ({ value, currency, currentTicker }) => { |
|
|
|
if (currency === 'sats') { |
|
|
|
|
|
@ -6,7 +6,7 @@ import copyIcon from 'icons/copy.svg' |
|
|
|
import Isvg from 'react-inlinesvg' |
|
|
|
|
|
|
|
import x from 'icons/x.svg' |
|
|
|
import { showNotification } from 'notifications' |
|
|
|
import { showNotification } from 'lib/utils/notifications' |
|
|
|
|
|
|
|
import styles from './ReceiveModal.scss' |
|
|
|
|
|
|
|
|
|
@ -3,7 +3,7 @@ import PropTypes from 'prop-types' |
|
|
|
import FaAngleDown from 'react-icons/lib/fa/angle-down' |
|
|
|
import Isvg from 'react-inlinesvg' |
|
|
|
|
|
|
|
import { btc, blockExplorer } from 'utils' |
|
|
|
import { btc, blockExplorer } from 'lib/utils' |
|
|
|
import Value from 'components/Value' |
|
|
|
import AnimatedCheckmark from 'components/AnimatedCheckmark' |
|
|
|
|
|
|
|
|
|
@ -4,9 +4,6 @@ import { Provider, connect } from 'react-redux' |
|
|
|
import { ConnectedRouter } from 'react-router-redux' |
|
|
|
import PropTypes from 'prop-types' |
|
|
|
|
|
|
|
import LoadingBolt from '../components/LoadingBolt' |
|
|
|
import Onboarding from '../components/Onboarding' |
|
|
|
import Syncing from '../components/Onboarding/Syncing' |
|
|
|
import { |
|
|
|
setConnectionType, |
|
|
|
setConnectionString, |
|
|
@ -29,9 +26,12 @@ import { |
|
|
|
updateReEnterSeedInput, |
|
|
|
updateRecoverSeedInput, |
|
|
|
setReEnterSeedIndexes |
|
|
|
} from '../reducers/onboarding' |
|
|
|
import { lndSelectors } from '../reducers/lnd' |
|
|
|
import { walletAddress } from '../reducers/address' |
|
|
|
} from 'reducers/onboarding' |
|
|
|
import { lndSelectors } from 'reducers/lnd' |
|
|
|
import { walletAddress } from 'reducers/address' |
|
|
|
import LoadingBolt from 'components/LoadingBolt' |
|
|
|
import Onboarding from 'components/Onboarding' |
|
|
|
import Syncing from 'components/Onboarding/Syncing' |
|
|
|
import Routes from '../routes' |
|
|
|
|
|
|
|
const mapDispatchToProps = { |
|
|
|
|
|
@ -1,5 +1,5 @@ |
|
|
|
import config from './config' |
|
|
|
import walletUnlocker from './lib/walletUnlocker' |
|
|
|
import walletUnlocker from './walletUnlocker' |
|
|
|
import walletUnlockerMethods from './walletUnlockerMethods' |
|
|
|
// use mainLog because lndLog is reserved for the lnd binary itself
|
|
|
|
import { mainLog } from '../utils/log' |
|
|
@ -1,12 +1,12 @@ |
|
|
|
import grpc from 'grpc' |
|
|
|
import { loadSync } from '@grpc/proto-loader' |
|
|
|
import config from '../config' |
|
|
|
import config from './config' |
|
|
|
import { getDeadline, validateHost, createSslCreds, createMacaroonCreds } from './util' |
|
|
|
import methods from '../methods' |
|
|
|
import { mainLog } from '../../utils/log' |
|
|
|
import subscribeToTransactions from '../subscribe/transactions' |
|
|
|
import subscribeToInvoices from '../subscribe/invoices' |
|
|
|
import subscribeToChannelGraph from '../subscribe/channelgraph' |
|
|
|
import methods from './methods' |
|
|
|
import { mainLog } from '../utils/log' |
|
|
|
import subscribeToTransactions from './subscribe/transactions' |
|
|
|
import subscribeToInvoices from './subscribe/invoices' |
|
|
|
import subscribeToChannelGraph from './subscribe/channelgraph' |
|
|
|
|
|
|
|
/** |
|
|
|
* Creates an LND grpc client lightning service. |
|
|
@ -1,8 +1,8 @@ |
|
|
|
import split2 from 'split2' |
|
|
|
import { spawn } from 'child_process' |
|
|
|
import EventEmitter from 'events' |
|
|
|
import config from '../config' |
|
|
|
import { mainLog, lndLog, lndLogGetLevel } from '../../utils/log' |
|
|
|
import config from './config' |
|
|
|
import { mainLog, lndLog, lndLogGetLevel } from '../utils/log' |
|
|
|
import { fetchBlockHeight } from './util' |
|
|
|
|
|
|
|
// Sync statuses
|
|
|
@ -8,7 +8,7 @@ import grpc from 'grpc' |
|
|
|
import isIP from 'validator/lib/isIP' |
|
|
|
import isPort from 'validator/lib/isPort' |
|
|
|
import get from 'lodash.get' |
|
|
|
import { mainLog } from '../../utils/log' |
|
|
|
import { mainLog } from '../utils/log' |
|
|
|
|
|
|
|
const fsReadFile = promisify(fs.readFile) |
|
|
|
const dnsLookup = promisify(dns.lookup) |
|
|
@ -1,7 +1,7 @@ |
|
|
|
import fs from 'fs' |
|
|
|
import grpc from 'grpc' |
|
|
|
import { loadSync } from '@grpc/proto-loader' |
|
|
|
import config from '../config' |
|
|
|
import config from './config' |
|
|
|
|
|
|
|
const walletUnlocker = (rpcpath, host) => { |
|
|
|
const lndConfig = config.lnd() |
|
|
@ -1,11 +1,11 @@ |
|
|
|
import { app, ipcMain, dialog } from 'electron' |
|
|
|
import Store from 'electron-store' |
|
|
|
import StateMachine from 'javascript-state-machine' |
|
|
|
import lnd from './lnd' |
|
|
|
import Neutrino from './lnd/lib/neutrino' |
|
|
|
import Lightning from './lnd/lib/lightning' |
|
|
|
import { mainLog } from './utils/log' |
|
|
|
import { isLndRunning } from './lnd/lib/util' |
|
|
|
import lnd from '../lnd' |
|
|
|
import Neutrino from '../lnd/neutrino' |
|
|
|
import Lightning from '../lnd/lightning' |
|
|
|
import { mainLog } from '../utils/log' |
|
|
|
import { isLndRunning } from '../lnd/util' |
|
|
|
|
|
|
|
const grpcSslCipherSuites = connectionType => |
|
|
|
(connectionType === 'btcpayserver' |
|
|
@ -1,7 +1,7 @@ |
|
|
|
// @flow
|
|
|
|
import { app, Menu, shell, BrowserWindow } from 'electron' |
|
|
|
|
|
|
|
export default class MenuBuilder { |
|
|
|
export default class ZapMenuBuilder { |
|
|
|
mainWindow: BrowserWindow |
|
|
|
|
|
|
|
constructor(mainWindow: BrowserWindow) { |
|
|
@ -1,6 +1,6 @@ |
|
|
|
import { dialog } from 'electron' |
|
|
|
import { autoUpdater } from 'electron-updater' |
|
|
|
import { updaterLog } from './utils/log' |
|
|
|
import { updaterLog } from '../utils/log' |
|
|
|
|
|
|
|
autoUpdater.logger = updaterLog |
|
|
|
|
|
|
@ -7,10 +7,10 @@ |
|
|
|
* `./app/main.prod.js` using webpack. This gives us some performance wins. |
|
|
|
*/ |
|
|
|
import { app, BrowserWindow, session } from 'electron' |
|
|
|
import { mainLog } from './utils/log' |
|
|
|
import MenuBuilder from './menu' |
|
|
|
import ZapController from './zap' |
|
|
|
import ZapUpdater from './updater' |
|
|
|
import { mainLog } from './lib/utils/log' |
|
|
|
import ZapMenuBuilder from './lib/zap/menuBuilder' |
|
|
|
import ZapController from './lib/zap/controller' |
|
|
|
import ZapUpdater from './lib/zap/updater' |
|
|
|
|
|
|
|
// Set up a couple of timers to track the app startup progress.
|
|
|
|
mainLog.time('Time until app is ready') |
|
|
@ -41,7 +41,7 @@ app.on('ready', () => { |
|
|
|
zap.init() |
|
|
|
|
|
|
|
// Initialise the application menus.
|
|
|
|
const menuBuilder = new MenuBuilder(mainWindow) |
|
|
|
const menuBuilder = new ZapMenuBuilder(mainWindow) |
|
|
|
menuBuilder.buildMenu() |
|
|
|
|
|
|
|
/** |
|
|
|
|
|
@ -1,9 +1,10 @@ |
|
|
|
import { createSelector } from 'reselect' |
|
|
|
import { ipcRenderer } from 'electron' |
|
|
|
import { showNotification } from '../notifications' |
|
|
|
import { btc } from '../utils' |
|
|
|
import { requestSuggestedNodes } from '../api' |
|
|
|
import { btc } from 'lib/utils' |
|
|
|
import { showNotification } from 'lib/utils/notifications' |
|
|
|
import { requestSuggestedNodes } from 'lib/utils/api' |
|
|
|
import { setError } from './error' |
|
|
|
|
|
|
|
// ------------------------------------
|
|
|
|
// Constants
|
|
|
|
// ------------------------------------
|
|
|
|
|
|
@ -1,7 +1,6 @@ |
|
|
|
import { createSelector } from 'reselect' |
|
|
|
|
|
|
|
import { btc } from 'lib/utils' |
|
|
|
import { tickerSelectors } from './ticker' |
|
|
|
import { btc } from '../utils' |
|
|
|
|
|
|
|
// Initial State
|
|
|
|
const initialState = { |
|
|
|
|
|
@ -2,6 +2,9 @@ import { createSelector } from 'reselect' |
|
|
|
import { ipcRenderer } from 'electron' |
|
|
|
import { push } from 'react-router-redux' |
|
|
|
|
|
|
|
import { showNotification } from 'lib/utils/notifications' |
|
|
|
import { btc } from 'lib/utils' |
|
|
|
|
|
|
|
import { showActivityModal } from './activity' |
|
|
|
import { fetchBalance } from './balance' |
|
|
|
import { setFormType } from './form' |
|
|
@ -9,8 +12,6 @@ import { setPayInvoice } from './payform' |
|
|
|
import { resetRequestForm } from './requestform' |
|
|
|
import { setError } from './error' |
|
|
|
|
|
|
|
import { showNotification } from '../notifications' |
|
|
|
import { btc } from '../utils' |
|
|
|
// ------------------------------------
|
|
|
|
// Constants
|
|
|
|
// ------------------------------------
|
|
|
|
|
|
@ -1,9 +1,9 @@ |
|
|
|
import Store from 'electron-store' |
|
|
|
import { createSelector } from 'reselect' |
|
|
|
import { showNotification } from 'lib/utils/notifications' |
|
|
|
import { fetchTicker } from './ticker' |
|
|
|
import { fetchBalance } from './balance' |
|
|
|
import { fetchInfo, setHasSynced } from './info' |
|
|
|
import { showNotification } from '../notifications' |
|
|
|
// ------------------------------------
|
|
|
|
// Constants
|
|
|
|
// ------------------------------------
|
|
|
|
|
|
@ -1,6 +1,6 @@ |
|
|
|
import { createSelector } from 'reselect' |
|
|
|
import { ipcRenderer } from 'electron' |
|
|
|
import { bech32 } from '../utils' |
|
|
|
import { bech32 } from 'lib/utils' |
|
|
|
|
|
|
|
// ------------------------------------
|
|
|
|
// Constants
|
|
|
|
|
|
@ -1,10 +1,9 @@ |
|
|
|
import { createSelector } from 'reselect' |
|
|
|
import bitcoin from 'bitcoinjs-lib' |
|
|
|
|
|
|
|
import { btc, bech32 } from 'lib/utils' |
|
|
|
import { setFormType } from './form' |
|
|
|
import { tickerSelectors } from './ticker' |
|
|
|
import { infoSelectors } from './info' |
|
|
|
import { btc, bech32 } from '../utils' |
|
|
|
|
|
|
|
// Initial State
|
|
|
|
const initialState = { |
|
|
|
|
|
@ -1,5 +1,5 @@ |
|
|
|
import { createSelector } from 'reselect' |
|
|
|
import { btc } from '../utils' |
|
|
|
import { btc } from 'lib/utils' |
|
|
|
import { tickerSelectors } from './ticker' |
|
|
|
|
|
|
|
// Initial State
|
|
|
|
|
|
@ -1,5 +1,5 @@ |
|
|
|
import { createSelector } from 'reselect' |
|
|
|
import { requestTickers } from '../api' |
|
|
|
import { requestTickers } from 'lib/utils/api' |
|
|
|
import { infoSelectors } from './info' |
|
|
|
|
|
|
|
// ------------------------------------
|
|
|
|
|
|
@ -1,6 +1,6 @@ |
|
|
|
import { ipcRenderer } from 'electron' |
|
|
|
import { showNotification } from '../notifications' |
|
|
|
import { btc } from '../utils' |
|
|
|
import { showNotification } from 'lib/utils/notifications' |
|
|
|
import { btc } from 'lib/utils' |
|
|
|
import { newAddress } from './address' |
|
|
|
import { fetchBalance } from './balance' |
|
|
|
import { setFormType } from './form' |
|
|
|
|
|
@ -1,7 +1,7 @@ |
|
|
|
import React from 'react' |
|
|
|
import PropTypes from 'prop-types' |
|
|
|
import Moment from 'react-moment' |
|
|
|
import { btc } from 'utils' |
|
|
|
import { btc } from 'lib/utils' |
|
|
|
|
|
|
|
import Isvg from 'react-inlinesvg' |
|
|
|
import Value from 'components/Value' |
|
|
|
|
|
@ -3,8 +3,8 @@ import PropTypes from 'prop-types' |
|
|
|
import Moment from 'react-moment' |
|
|
|
import Isvg from 'react-inlinesvg' |
|
|
|
import zap from 'icons/zap.svg' |
|
|
|
import { btc } from 'utils' |
|
|
|
|
|
|
|
import { btc } from 'lib/utils' |
|
|
|
import Value from 'components/Value' |
|
|
|
import styles from '../Activity.scss' |
|
|
|
|
|
|
|
|
|
@ -3,8 +3,8 @@ import PropTypes from 'prop-types' |
|
|
|
import Moment from 'react-moment' |
|
|
|
import Isvg from 'react-inlinesvg' |
|
|
|
import link from 'icons/link.svg' |
|
|
|
import { btc } from 'utils' |
|
|
|
|
|
|
|
import { btc } from 'lib/utils' |
|
|
|
import Value from 'components/Value' |
|
|
|
import styles from '../Activity.scss' |
|
|
|
|
|
|
|
|
|
@ -1,7 +1,7 @@ |
|
|
|
import { withRouter } from 'react-router' |
|
|
|
import { connect } from 'react-redux' |
|
|
|
|
|
|
|
import { btc } from 'utils' |
|
|
|
import { btc } from 'lib/utils' |
|
|
|
|
|
|
|
import { fetchTicker, setCurrency, tickerSelectors } from 'reducers/ticker' |
|
|
|
|
|
|
|
|
|
@ -1,4 +1,4 @@ |
|
|
|
import { formatUsd, usdToBtc } from '../../app/utils/usd' |
|
|
|
import { formatUsd, usdToBtc } from 'lib/utils/usd' |
|
|
|
|
|
|
|
describe('usd', () => { |
|
|
|
describe('formatUsd', () => { |
|
|
|
|
|
@ -20,7 +20,7 @@ import HtmlWebpackPlugin from 'html-webpack-plugin' |
|
|
|
import AddAssetHtmlPlugin from 'add-asset-html-webpack-plugin' |
|
|
|
import CspHtmlWebpackPlugin from 'csp-html-webpack-plugin' |
|
|
|
import baseConfig from './webpack.config.base' |
|
|
|
import { mainLog } from './app/utils/log' |
|
|
|
import { mainLog } from './app/lib/utils/log' |
|
|
|
|
|
|
|
const port = process.env.PORT || 1212 |
|
|
|
const publicPath = `http://localhost:${port}/dist` |
|
|
|