Browse Source

notification on sync and new address on tx received

renovate/lint-staged-8.x
Jack Mallers 7 years ago
parent
commit
4755a2b1d9
  1. 7
      app/reducers/lnd.js
  2. 4
      app/reducers/transaction.js

7
app/reducers/lnd.js

@ -3,6 +3,7 @@ import { fetchTicker } from './ticker'
import { fetchBalance } from './balance'
import { fetchInfo } from './info'
import { requestBlockHeight } from '../api'
import { showNotification } from '../notifications'
// ------------------------------------
// Constants
// ------------------------------------
@ -32,6 +33,12 @@ export const lndSynced = () => (dispatch) => {
dispatch(fetchInfo())
dispatch({ type: STOP_SYNCING })
// HTML 5 desktop notification for the new transaction
const notifTitle = 'Lightning Node Synced'
const notifBody = 'Visa who? You\'re your own payment processor now!'
showNotification(notifTitle, notifBody)
}
export const grpcDisconnected = () => (dispatch) => dispatch({ type: GRPC_DISCONNECTED })

4
app/reducers/transaction.js

@ -1,6 +1,7 @@
import { ipcRenderer } from 'electron'
import { showNotification } from '../notifications'
import { btc, usd } from '../utils'
import { newAddress } from './address'
import { fetchBalance } from './balance'
import { setFormType } from './form'
import { resetPayForm } from './payform'
@ -85,6 +86,9 @@ export const newTransaction = (event, { transaction }) => (dispatch) => {
const notifBody = transaction.amount > 0 ? 'Lucky you, you just received a new on-chain transaction. I\'m jealous.' : 'Hate to see \'em go but love to watch \'em leave. Your on-chain transaction successfully sent.' // eslint-disable-line
showNotification(notifTitle, notifBody)
// Generate a new address
dispatch(newAddress('p2pkh'))
}

Loading…
Cancel
Save