diff --git a/app/components/Pay/Pay.js b/app/components/Pay/Pay.js index aaae22fe..e3f84fcc 100644 --- a/app/components/Pay/Pay.js +++ b/app/components/Pay/Pay.js @@ -131,6 +131,7 @@ class Pay extends React.Component { isQueryingFees: false, isQueryingRoutes: false, nodes: [], + onchainFees: {}, routes: [] } @@ -186,13 +187,14 @@ class Pay extends React.Component { */ onSubmit = values => { const { currentStep, isOnchain } = this.state - const { cryptoCurrency, payInvoice, sendCoins } = this.props + const { cryptoCurrency, onchainFees, payInvoice, sendCoins } = this.props if (currentStep === 'summary') { return isOnchain ? sendCoins({ value: values.amountCrypto, addr: values.payReq, - currency: cryptoCurrency + currency: cryptoCurrency, + satPerByte: onchainFees.fastestFee }) : payInvoice(values.payReq) } else { diff --git a/app/components/Pay/PaySummaryOnChain.js b/app/components/Pay/PaySummaryOnChain.js index 3b87fba8..9799f320 100644 --- a/app/components/Pay/PaySummaryOnChain.js +++ b/app/components/Pay/PaySummaryOnChain.js @@ -51,7 +51,7 @@ class PaySummaryOnChain extends React.Component { onchainFees: {} } - componenDidMount() { + componentDidMount() { const { queryFees } = this.props queryFees() } diff --git a/app/lib/lnd/methods/walletController.js b/app/lib/lnd/methods/walletController.js index d9bc2fbe..5c69a426 100644 --- a/app/lib/lnd/methods/walletController.js +++ b/app/lib/lnd/methods/walletController.js @@ -74,9 +74,9 @@ export function getTransactions(lnd) { * @param {[type]} amount [description] * @return {[type]} [description] */ -export function sendCoins(lnd, { addr, amount }) { +export function sendCoins(lnd, { addr, amount, target_conf, sat_per_byte }) { return new Promise((resolve, reject) => { - lnd.sendCoins({ addr, amount }, (err, data) => { + lnd.sendCoins({ addr, amount, target_conf, sat_per_byte }, (err, data) => { if (err) { return reject(err) } diff --git a/app/reducers/transaction.js b/app/reducers/transaction.js index 4f587e92..fcd19397 100644 --- a/app/reducers/transaction.js +++ b/app/reducers/transaction.js @@ -86,13 +86,16 @@ export const receiveTransactions = (event, { transactions }) => (dispatch, getSt dispatch(fetchBalance()) } -export const sendCoins = ({ value, addr, currency }) => dispatch => { +export const sendCoins = ({ value, addr, currency, targetConf, satPerByte }) => dispatch => { // backend needs amount in satoshis no matter what currency we are using const amount = btc.convert(currency, 'sats', value) // submit the transaction to LND dispatch(sendTransaction()) - ipcRenderer.send('lnd', { msg: 'sendCoins', data: { amount, addr } }) + ipcRenderer.send('lnd', { + msg: 'sendCoins', + data: { amount, addr, currency, target_conf: targetConf, sat_per_byte: satPerByte } + }) // Close the form modal once the payment was sent to LND // we will do the loading/success UX on the main page