Skip to content
Permalink
Browse files

fix(ui): incorrect fee in pay summary

fix #1900
  • Loading branch information...
korhaliv committed Mar 26, 2019
1 parent ceb48cf commit 1af53a65b4bf08c5123a95773fb9c7b57a6e2f55
Showing with 22 additions and 11 deletions.
  1. +11 −3 renderer/components/Pay/Pay.js
  2. +11 −8 renderer/components/Pay/PaySummaryOnChain.js
@@ -513,26 +513,34 @@ class Pay extends React.Component {
const { routes } = this.props

const formState = this.formApi.getState()
const { speed, payReq } = formState.values
let minFee, maxFee
if (routes.length) {
minFee = getMinFee(routes)
maxFee = getMaxFee(routes)
}

const render = () => {
// convert entered amount to satoshis
const amount = this.amountInSats()

if (isOnchain) {
return <PaySummaryOnChain address={formState.values.payReq} amount={amount} mt={-3} />
return (
<PaySummaryOnChain
address={payReq}
amount={amount}
fee={this.getFee()}
mt={-3}
speed={speed}
/>
)
} else if (isLn) {
return (
<PaySummaryLightning
amount={amount}
maxFee={maxFee}
minFee={minFee}
mt={-3}
payReq={formState.values.payReq}
payReq={payReq}
/>
)
}
@@ -2,7 +2,6 @@ import React from 'react'
import PropTypes from 'prop-types'
import { Box, Flex } from 'rebass'
import { FormattedMessage } from 'react-intl'
import get from 'lodash.get'
import BigArrowRight from 'components/Icon/BigArrowRight'
import { Bar, DataRow, Spinner, Text } from 'components/UI'
import { CryptoSelector, CryptoValue, FiatValue } from 'containers/UI'
@@ -11,23 +10,26 @@ import messages from './messages'

class PaySummaryOnChain extends React.Component {
static propTypes = {
/** Amount to send (in satoshis). */
address: PropTypes.string.isRequired,
/** Onchain address of recipient. */
address: PropTypes.string.isRequired,
/** Amount to send (in satoshis). */
amount: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
/** Ticker symbol of the currently selected cryptocurrency. */
cryptoCurrencyTicker: PropTypes.string.isRequired,
/** Current fee information as provided by bitcoinfees.earn.com */
isQueryingFees: PropTypes.bool,
/** Fee in sats per byte */
fee: PropTypes.number,
/** Boolean indicating wether routing information is currently being fetched. */
isQueryingFees: PropTypes.bool,
/** Current fee information as provided by bitcoinfees.earn.com */
onchainFees: PropTypes.shape({
fastestFee: PropTypes.number,
halfHourFee: PropTypes.number,
hourFee: PropTypes.number,
}),

/** Method to fetch fee information for onchain transactions. */
queryFees: PropTypes.func.isRequired,
/** Confirmation speed */
speed: PropTypes.string,
}

static defaultProps = {
@@ -47,10 +49,11 @@ class PaySummaryOnChain extends React.Component {
cryptoCurrencyTicker,
onchainFees,
isQueryingFees,
fee,
speed,
...rest
} = this.props

const fee = get(onchainFees, 'fastestFee', null)
return (
<Box {...rest}>
<Box py={3}>
@@ -101,7 +104,7 @@ class PaySummaryOnChain extends React.Component {
{fee} satoshis <FormattedMessage {...messages.fee_per_byte} />
</Text>
<Text fontSize="s">
(<FormattedMessage {...messages.next_block_confirmation} />)
<FormattedMessage {...messages[speed.toLowerCase() + '_description']} />
</Text>
</React.Fragment>
) : (

0 comments on commit 1af53a6

Please sign in to comment.
You can’t perform that action at this time.