diff --git a/app/lnd/methods/index.js b/app/lnd/methods/index.js index 7c1b634a..964803b2 100644 --- a/app/lnd/methods/index.js +++ b/app/lnd/methods/index.js @@ -97,10 +97,7 @@ export default function (lnd, event, msg, data) { // Transaction looks like { txid: String } // { amount, addr } = data walletController.sendCoins(lnd, data) - .then(({ txid }) => { - console.log('transactionId: ', transactionId) - event.sender.send('sendSuccessful', { amount: data.amount, addr: data.addr, txid }) - }) + .then(({ txid }) => event.sender.send('sendSuccessful', { amount: data.amount, addr: data.addr, txid })) .catch(error => console.log('sendcoins error: ', error)) break case 'openChannel': diff --git a/app/reducers/payment.js b/app/reducers/payment.js index 849cae8d..a8b94c2f 100644 --- a/app/reducers/payment.js +++ b/app/reducers/payment.js @@ -11,6 +11,7 @@ export const GET_PAYMENTS = 'GET_PAYMENTS' export const RECEIVE_PAYMENTS = 'RECEIVE_PAYMENTS' export const SEND_PAYMENT = 'SEND_PAYMENT' + export const PAYMENT_SUCCESSFULL = 'PAYMENT_SUCCESSFULL' export const PAYMENT_FAILED = 'PAYMENT_FAILED' @@ -77,6 +78,8 @@ export const sendSuccessful = (event, { amount, addr, txid }) => dispatch => { console.log('amount: ', amount) console.log('addr: ', addr) console.log('txid: ', txid) + // TODO: Add successful on-chain payment to payments list once payments list supports on-chain and LN + // dispatch({ type: PAYMENT_SUCCESSFULL, payment: { amount, addr, txid, pending: true } }) } @@ -86,9 +89,10 @@ export const sendSuccessful = (event, { amount, addr, txid }) => dispatch => { const ACTION_HANDLERS = { [SET_PAYMENT]: (state, { payment }) => ({ ...state, payment }), [GET_PAYMENTS]: state => ({ ...state, paymentLoading: true }), + [SEND_PAYMENT]: state => ({ ...state, sendingPayment: true }), [RECEIVE_PAYMENTS]: (state, { payments }) => ({ ...state, paymentLoading: false, payments }), [PAYMENT_SUCCESSFULL]: (state, { payment }) => ( - { ...state, paymentLoading: false, payments: [payment, ...state.payments] } + { ...state, sendingPayment: false, payments: [payment, ...state.payments] } ) } @@ -106,6 +110,7 @@ export { paymentSelectors } // Reducer // ------------------------------------ const initialState = { + sendingPayment: false, paymentLoading: false, payments: [], payment: null diff --git a/app/routes/app/components/components/Form/components/Pay/Pay.js b/app/routes/app/components/components/Form/components/Pay/Pay.js index 0aab1153..a19a701c 100644 --- a/app/routes/app/components/components/Form/components/Pay/Pay.js +++ b/app/routes/app/components/components/Form/components/Pay/Pay.js @@ -70,11 +70,11 @@ class Pay extends Component { {(() => { if (isOnchain) { return ( - {`You're about to send ${onchainAmount} on-chain which should take around 10 minutes`} + {`You're about to send ${onchainAmount} ${currency.toUpperCase()} on-chain which should take around 10 minutes`} ) } else if (isLn) { return ( - {`You're about to send ${calculateAmount(invoiceAmount)} over the Lightning Network which will be instant`} + {`You're about to send ${calculateAmount(invoiceAmount)} ${currency.toUpperCase()} over the Lightning Network which will be instant`} ) } else { return null