diff --git a/app/lnd/methods/index.js b/app/lnd/methods/index.js
index eca3b570..6f8b9b05 100644
--- a/app/lnd/methods/index.js
+++ b/app/lnd/methods/index.js
@@ -54,6 +54,7 @@ export default function (lnd, event, msg, data) {
walletController.getTransactions(lnd)
.then(transactionsData => event.sender.send('receiveTransactions', transactionsData))
.catch(error => console.log('transactions error: ', error))
+ break
case 'payments':
// Data looks like { payments: [] }
paymentsController.listPayments(lnd)
diff --git a/app/reducers/activity.js b/app/reducers/activity.js
index 60fecadc..77913b68 100644
--- a/app/reducers/activity.js
+++ b/app/reducers/activity.js
@@ -7,11 +7,11 @@ const initialState = {
filterPulldown: false,
filter: { key: 'ALL_ACTIVITY', name: 'Activity' },
filters: [
- { key: 'ALL_ACTIVITY', name: 'All Activity'},
- { key: 'LN_ACTIVITY', name: 'LN Activity'},
- { key: 'PAYMENT_ACTIVITY', name: 'LN Payments'},
- { key: 'INVOICE_ACTIVITY', name: 'LN Invoices'},
- { key: 'TRANSACTION_ACTIVITY', name: 'On-chain Activity'}
+ { key: 'ALL_ACTIVITY', name: 'All Activity' },
+ { key: 'LN_ACTIVITY', name: 'LN Activity' },
+ { key: 'PAYMENT_ACTIVITY', name: 'LN Payments' },
+ { key: 'INVOICE_ACTIVITY', name: 'LN Invoices' },
+ { key: 'TRANSACTION_ACTIVITY', name: 'On-chain Activity' }
],
modal: {
modalType: null,
@@ -64,9 +64,9 @@ export function toggleFilterPulldown() {
// ------------------------------------
const ACTION_HANDLERS = {
[SHOW_ACTIVITY_MODAL]: (state, { modalType, modalProps }) => ({ ...state, modal: { modalType, modalProps } }),
- [HIDE_ACTIVITY_MODAL]: (state) => ({ ...state, modal: { modalType: null, 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 })
+ [TOGGLE_PULLDOWN]: state => ({ ...state, filterPulldown: !state.filterPulldown })
}
// ------------------------------------
@@ -83,27 +83,18 @@ const allActivity = createSelector(
paymentsSelector,
invoicesSelector,
transactionsSelector,
- (payments, invoices, transactions) => {
- return [...payments, ...invoices, ...transactions].sort((a, b) => {
- let aTimestamp = a.hasOwnProperty('time_stamp') ? a.time_stamp : a.creation_date
- let bTimestamp = b.hasOwnProperty('time_stamp') ? b.time_stamp : b.creation_date
+ (payments, invoices, transactions) => [...payments, ...invoices, ...transactions].sort((a, b) => {
+ const aTimestamp = Object.prototype.hasOwnProperty.call(a, 'time_stamp') ? a.time_stamp : a.creation_date
+ const bTimestamp = Object.prototype.hasOwnProperty.call(b, 'time_stamp') ? b.time_stamp : b.creation_date
- return bTimestamp - aTimestamp
- })
- }
+ return bTimestamp - aTimestamp
+ })
)
const lnActivity = createSelector(
paymentsSelector,
invoicesSelector,
- (payments, invoices) => {
- return [...payments, ...invoices].sort((a, b) => {
- let aTimestamp = a.hasOwnProperty('time_stamp') ? a.time_stamp : a.creation_date
- let bTimestamp = b.hasOwnProperty('time_stamp') ? b.time_stamp : b.creation_date
-
- return bTimestamp - aTimestamp
- })
- }
+ (payments, invoices) => [...payments, ...invoices].sort((a, b) => b.creation_date - a.creation_date)
)
const paymentActivity = createSelector(
@@ -121,6 +112,14 @@ const transactionActivity = createSelector(
transactions => transactions
)
+const FILTERS = {
+ ALL_ACTIVITY: allActivity,
+ LN_ACTIVITY: lnActivity,
+ PAYMENT_ACTIVITY: paymentActivity,
+ INVOICE_ACTIVITY: invoiceActivity,
+ TRANSACTION_ACTIVITY: transactionActivity
+}
+
activitySelectors.currentActivity = createSelector(
filterSelector,
filter => FILTERS[filter.key]
@@ -132,13 +131,6 @@ activitySelectors.nonActiveFilters = createSelector(
(filters, filter) => filters.filter(f => f.key !== filter.key)
)
-const FILTERS = {
- ALL_ACTIVITY: allActivity,
- LN_ACTIVITY: lnActivity,
- PAYMENT_ACTIVITY: paymentActivity,
- INVOICE_ACTIVITY: invoiceActivity,
- TRANSACTION_ACTIVITY: transactionActivity
-}
export { activitySelectors }
diff --git a/app/reducers/payment.js b/app/reducers/payment.js
index b8dbc445..d8e44775 100644
--- a/app/reducers/payment.js
+++ b/app/reducers/payment.js
@@ -1,8 +1,6 @@
import { createSelector } from 'reselect'
import { ipcRenderer } from 'electron'
-import { btc, usd } from '../utils'
import { setForm, resetForm } from './form'
-import { showModal } from './modal'
// ------------------------------------
// Constants
@@ -68,7 +66,7 @@ export const payInvoice = paymentRequest => (dispatch) => {
// Receive IPC event for successful payment
// TODO: Add payment to state, not a total re-fetch
-export const paymentSuccessful = () => dispatch => {
+export const paymentSuccessful = () => (dispatch) => {
// Close the form modal once the payment was succesful
dispatch(setForm({ modalOpen: false }))
diff --git a/app/reducers/transaction.js b/app/reducers/transaction.js
index c551ff24..f3dc7ca5 100644
--- a/app/reducers/transaction.js
+++ b/app/reducers/transaction.js
@@ -1,4 +1,3 @@
-import { createSelector } from 'reselect'
import { ipcRenderer } from 'electron'
import { btc, usd } from '../utils'
import { setForm, resetForm } from './form'
@@ -62,7 +61,7 @@ export const transactionSuccessful = (event, { amount, addr, txid }) => (dispatc
}
export const transactionError = () => (dispatch) => {
- dispatch({ type: PAYMENT_FAILED })
+ dispatch({ type: TRANSACTION_FAILED })
}
diff --git a/app/routes/activity/components/Activity.js b/app/routes/activity/components/Activity.js
index 896d18e4..e1651291 100644
--- a/app/routes/activity/components/Activity.js
+++ b/app/routes/activity/components/Activity.js
@@ -1,7 +1,7 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { MdSearch } from 'react-icons/lib/md'
-import { FaChain, FaBolt, FaAngleDown } from 'react-icons/lib/fa'
+import { FaAngleDown } from 'react-icons/lib/fa'
import Invoice from './components/Invoice'
import Payment from './components/Payment'
@@ -14,10 +14,6 @@ import styles from './Activity.scss'
class Activity extends Component {
constructor(props, context) {
super(props, context)
- this.state = {
- pulldown: false
- }
-
this.renderActivity = this.renderActivity.bind(this)
}
@@ -32,29 +28,23 @@ class Activity extends Component {
renderActivity(activity) {
const { ticker, currentTicker, showActivityModal } = this.props
- if (activity.hasOwnProperty('block_hash')) {
+ if (Object.prototype.hasOwnProperty.call(activity, 'block_hash')) {
// activity is an on-chain tx
return
- } else if (activity.hasOwnProperty('payment_request')) {
+ } else if (Object.prototype.hasOwnProperty.call(activity, 'payment_request')) {
// activity is an LN invoice
return
- } else {
- // activity is an LN payment
- return
}
+ // activity is an LN payment
+ return
}
render() {
const {
ticker,
searchInvoices,
- invoices,
- invoice: { invoicesSearchText, invoice, invoiceLoading },
- payment: { payment, payments, paymentLoading },
- setPayment,
- setInvoice,
- paymentModalOpen,
- invoiceModalOpen,
+ invoice: { invoicesSearchText, invoiceLoading },
+ payment: { paymentLoading },
currentTicker,
activity: { modal, filter, filterPulldown },
hideActivityModal,
@@ -64,8 +54,6 @@ class Activity extends Component {
nonActiveFilters
} = this.props
- const { pulldown } = this.state
-
if (invoiceLoading || paymentLoading) { return
Loading...
}
return (
@@ -77,7 +65,7 @@ class Activity extends Component {
ticker={ticker}
currentTicker={currentTicker}
/>
-
+
@@ -129,16 +115,19 @@ class Activity extends Component {
Activity.propTypes = {
fetchPayments: PropTypes.func.isRequired,
fetchInvoices: PropTypes.func.isRequired,
+ fetchTransactions: PropTypes.func.isRequired,
ticker: PropTypes.object.isRequired,
searchInvoices: PropTypes.func.isRequired,
- invoices: PropTypes.array.isRequired,
invoice: PropTypes.object.isRequired,
payment: PropTypes.object.isRequired,
- setPayment: PropTypes.func.isRequired,
- setInvoice: PropTypes.func.isRequired,
- paymentModalOpen: PropTypes.bool.isRequired,
- invoiceModalOpen: PropTypes.bool.isRequired,
- currentTicker: PropTypes.object.isRequired
+ currentTicker: PropTypes.object.isRequired,
+ showActivityModal: PropTypes.func.isRequired,
+ hideActivityModal: PropTypes.func.isRequired,
+ changeFilter: PropTypes.func.isRequired,
+ toggleFilterPulldown: PropTypes.func.isRequired,
+ activity: PropTypes.object.isRequired,
+ currentActivity: PropTypes.array.isRequired,
+ nonActiveFilters: PropTypes.array.isRequired
}
export default Activity
diff --git a/app/routes/activity/components/components/Invoice/Invoice.js b/app/routes/activity/components/components/Invoice/Invoice.js
index 9fedc08b..bdf617bf 100644
--- a/app/routes/activity/components/components/Invoice/Invoice.js
+++ b/app/routes/activity/components/components/Invoice/Invoice.js
@@ -4,7 +4,6 @@ import Moment from 'react-moment'
import 'moment-timezone'
import { FaBolt, FaClockO } from 'react-icons/lib/fa'
import { btc } from '../../../../../utils'
-import CurrencyIcon from '../../../../../components/CurrencyIcon'
import styles from '../Activity.scss'
const Invoice = ({ invoice, ticker, currentTicker, showActivityModal }) => (
@@ -45,7 +44,7 @@ const Invoice = ({ invoice, ticker, currentTicker, showActivityModal }) => (
- +
+ +
{
ticker.currency === 'usd' ?
btc.satoshisToUsd(invoice.value, currentTicker.price_usd)
@@ -66,7 +65,10 @@ const Invoice = ({ invoice, ticker, currentTicker, showActivityModal }) => (
)
Invoice.propTypes = {
-
+ invoice: PropTypes.object.isRequired,
+ ticker: PropTypes.object.isRequired,
+ currentTicker: PropTypes.object.isRequired,
+ showActivityModal: PropTypes.func.isRequired
}
export default Invoice
diff --git a/app/routes/activity/components/components/Invoice/index.js b/app/routes/activity/components/components/Invoice/index.js
index a72db95c..31b99355 100644
--- a/app/routes/activity/components/components/Invoice/index.js
+++ b/app/routes/activity/components/components/Invoice/index.js
@@ -1,3 +1,3 @@
import Invoice from './Invoice'
-export default Invoice
\ No newline at end of file
+export default Invoice
diff --git a/app/routes/activity/components/components/Modal/Invoice/Invoice.js b/app/routes/activity/components/components/Modal/Invoice/Invoice.js
index a1ea8c86..7e605377 100644
--- a/app/routes/activity/components/components/Modal/Invoice/Invoice.js
+++ b/app/routes/activity/components/components/Modal/Invoice/Invoice.js
@@ -53,6 +53,9 @@ const Invoice = ({ invoice, ticker, currentTicker }) => (
)
Invoice.propTypes = {
+ invoice: PropTypes.object.isRequired,
+ ticker: PropTypes.object.isRequired,
+ currentTicker: PropTypes.object.isRequired
}
export default Invoice
diff --git a/app/routes/activity/components/components/Modal/Invoice/index.js b/app/routes/activity/components/components/Modal/Invoice/index.js
index a72db95c..31b99355 100644
--- a/app/routes/activity/components/components/Modal/Invoice/index.js
+++ b/app/routes/activity/components/components/Modal/Invoice/index.js
@@ -1,3 +1,3 @@
import Invoice from './Invoice'
-export default Invoice
\ No newline at end of file
+export default Invoice
diff --git a/app/routes/activity/components/components/Modal/Modal.js b/app/routes/activity/components/components/Modal/Modal.js
index 244a6307..58722e21 100644
--- a/app/routes/activity/components/components/Modal/Modal.js
+++ b/app/routes/activity/components/components/Modal/Modal.js
@@ -11,7 +11,7 @@ const Modal = ({ modalType, modalProps, hideActivityModal, ticker, currentTicker
TRANSACTION: Transaction,
PAYMENT: Payment,
INVOICE: Invoice
-
+
}
const customStyles = {
overlay: {
@@ -26,7 +26,7 @@ const Modal = ({ modalType, modalProps, hideActivityModal, ticker, currentTicker
margin: '50px auto'
}
}
-
+
if (!modalType) { return null }
const SpecificModal = MODAL_COMPONENTS[modalType]
@@ -47,7 +47,11 @@ const Modal = ({ modalType, modalProps, hideActivityModal, ticker, currentTicker
}
Modal.propTypes = {
- modalType: PropTypes.string
+ modalType: PropTypes.string,
+ modalProps: PropTypes.object.isRequired,
+ hideActivityModal: PropTypes.func.isRequired,
+ ticker: PropTypes.object.isRequired,
+ currentTicker: PropTypes.object.isRequired
}
export default Modal
diff --git a/app/routes/activity/components/components/Modal/Payment/Payment.js b/app/routes/activity/components/components/Modal/Payment/Payment.js
index d9515da8..fec8218d 100644
--- a/app/routes/activity/components/components/Modal/Payment/Payment.js
+++ b/app/routes/activity/components/components/Modal/Payment/Payment.js
@@ -4,10 +4,6 @@ import PropTypes from 'prop-types'
import Moment from 'react-moment'
import 'moment-timezone'
-import QRCode from 'qrcode.react'
-
-import { MdCheck } from 'react-icons/lib/md'
-
import CurrencyIcon from '../../../../../../components/CurrencyIcon'
import { btc } from '../../../../../../utils'
@@ -40,6 +36,9 @@ const Payment = ({ payment, ticker, currentTicker }) => (
)
Payment.propTypes = {
+ payment: PropTypes.object.isRequired,
+ ticker: PropTypes.object.isRequired,
+ currentTicker: PropTypes.object.isRequired
}
export default Payment
diff --git a/app/routes/activity/components/components/Modal/Payment/index.js b/app/routes/activity/components/components/Modal/Payment/index.js
index ba6d6e16..3f7e6951 100644
--- a/app/routes/activity/components/components/Modal/Payment/index.js
+++ b/app/routes/activity/components/components/Modal/Payment/index.js
@@ -1,3 +1,3 @@
import Payment from './Payment'
-export default Payment
\ No newline at end of file
+export default Payment
diff --git a/app/routes/activity/components/components/Modal/Transaction/Transaction.js b/app/routes/activity/components/components/Modal/Transaction/Transaction.js
index a886d8ff..9b38dc96 100644
--- a/app/routes/activity/components/components/Modal/Transaction/Transaction.js
+++ b/app/routes/activity/components/components/Modal/Transaction/Transaction.js
@@ -4,10 +4,6 @@ import PropTypes from 'prop-types'
import Moment from 'react-moment'
import 'moment-timezone'
-import QRCode from 'qrcode.react'
-
-import { MdCheck } from 'react-icons/lib/md'
-
import CurrencyIcon from '../../../../../../components/CurrencyIcon'
import { btc } from '../../../../../../utils'
@@ -50,6 +46,9 @@ const Transaction = ({ transaction, ticker, currentTicker }) => (
)
Transaction.propTypes = {
+ transaction: PropTypes.object.isRequired,
+ ticker: PropTypes.object.isRequired,
+ currentTicker: PropTypes.object.isRequired
}
export default Transaction
diff --git a/app/routes/activity/components/components/Modal/Transaction/index.js b/app/routes/activity/components/components/Modal/Transaction/index.js
index a5e79192..7fc5e311 100644
--- a/app/routes/activity/components/components/Modal/Transaction/index.js
+++ b/app/routes/activity/components/components/Modal/Transaction/index.js
@@ -1,3 +1,3 @@
import Transaction from './Transaction'
-export default Transaction
\ No newline at end of file
+export default Transaction
diff --git a/app/routes/activity/components/components/Modal/index.js b/app/routes/activity/components/components/Modal/index.js
index 1e9e3808..498702f4 100644
--- a/app/routes/activity/components/components/Modal/index.js
+++ b/app/routes/activity/components/components/Modal/index.js
@@ -1,3 +1,3 @@
import Modal from './Modal'
-export default Modal
\ No newline at end of file
+export default Modal
diff --git a/app/routes/activity/components/components/Payment/Payment.js b/app/routes/activity/components/components/Payment/Payment.js
index d7948ef6..4b855678 100644
--- a/app/routes/activity/components/components/Payment/Payment.js
+++ b/app/routes/activity/components/components/Payment/Payment.js
@@ -4,7 +4,6 @@ import Moment from 'react-moment'
import 'moment-timezone'
import { FaBolt } from 'react-icons/lib/fa'
import { btc } from '../../../../../utils'
-import CurrencyIcon from '../../../../../components/CurrencyIcon'
import styles from '../Activity.scss'
const Payment = ({ payment, ticker, currentTicker, showActivityModal }) => (
@@ -35,7 +34,7 @@ const Payment = ({ payment, ticker, currentTicker, showActivityModal }) => (
- -
+ -
{
ticker.currency === 'usd' ?
btc.satoshisToUsd(payment.value, currentTicker.price_usd)
@@ -56,7 +55,10 @@ const Payment = ({ payment, ticker, currentTicker, showActivityModal }) => (
)
Payment.propTypes = {
-
+ payment: PropTypes.object.isRequired,
+ ticker: PropTypes.object.isRequired,
+ currentTicker: PropTypes.object.isRequired,
+ showActivityModal: PropTypes.func.isRequired
}
export default Payment
diff --git a/app/routes/activity/components/components/Transaction/Transaction.js b/app/routes/activity/components/components/Transaction/Transaction.js
index 924a8b73..eba080f5 100644
--- a/app/routes/activity/components/components/Transaction/Transaction.js
+++ b/app/routes/activity/components/components/Transaction/Transaction.js
@@ -4,7 +4,6 @@ import Moment from 'react-moment'
import 'moment-timezone'
import { FaChain } from 'react-icons/lib/fa'
import { btc } from '../../../../../utils'
-import CurrencyIcon from '../../../../../components/CurrencyIcon'
import styles from '../Activity.scss'
const Transaction = ({ transaction, ticker, currentTicker, showActivityModal }) => (
@@ -56,7 +55,10 @@ const Transaction = ({ transaction, ticker, currentTicker, showActivityModal })
)
Transaction.propTypes = {
-
+ transaction: PropTypes.object.isRequired,
+ ticker: PropTypes.object.isRequired,
+ currentTicker: PropTypes.object.isRequired,
+ showActivityModal: PropTypes.func.isRequired
}
export default Transaction
diff --git a/app/routes/app/components/App.js b/app/routes/app/components/App.js
index d2a01579..a46f155a 100644
--- a/app/routes/app/components/App.js
+++ b/app/routes/app/components/App.js
@@ -27,7 +27,6 @@ class App extends Component {
setMessage,
setPubkey,
setPaymentRequest,
- payment,
transaction: { sendingTransaction },
peers,
setCurrency,
@@ -61,7 +60,6 @@ class App extends Component {
setMessage={setMessage}
setPubkey={setPubkey}
setPaymentRequest={setPaymentRequest}
- payment={payment}
peers={peers}
ticker={ticker}
form={form}
@@ -104,7 +102,6 @@ App.propTypes = {
setMessage: PropTypes.func.isRequired,
setPubkey: PropTypes.func.isRequired,
setPaymentRequest: PropTypes.func.isRequired,
- payment: PropTypes.object.isRequired,
transaction: PropTypes.object.isRequired,
peers: PropTypes.array,
setCurrency: PropTypes.func.isRequired,
diff --git a/app/routes/app/components/components/Form/Form.js b/app/routes/app/components/components/Form/Form.js
index e753d61a..0126daeb 100644
--- a/app/routes/app/components/components/Form/Form.js
+++ b/app/routes/app/components/components/Form/Form.js
@@ -7,7 +7,6 @@ import styles from './Form.scss'
const Form = ({
form: { formType, amount, onchainAmount, message, payment_request },
- payment: { sendingPayment },
setAmount,
setOnchainAmount,
setMessage,
@@ -72,7 +71,6 @@ const Form = ({
)
Form.propTypes = {
- payment: PropTypes.object.isRequired,
form: PropTypes.object.isRequired,
ticker: PropTypes.object.isRequired,
setAmount: PropTypes.func.isRequired,