Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
fix(pay): allow sending without route info
Browse files Browse the repository at this point in the history
Do not disable the pay form submit button if we were unable to find a
route. This is a hack to work around the fact that queryroutes doesn't
currently support private channels yet we do want to allow sending
along private channels.

Fix #1048
  • Loading branch information
mrfelton committed Dec 15, 2018
1 parent 44fa70c commit 9807dec
Show file tree
Hide file tree
Showing 36 changed files with 2 additions and 54 deletions.
21 changes: 2 additions & 19 deletions app/components/Pay/Pay.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'
import { Box, Flex } from 'rebass'
import { animated, Keyframes, Transition } from 'react-spring'
import { FormattedMessage, injectIntl } from 'react-intl'
import { decodePayReq, getMinFee, getMaxFee, getFeeRange, isOnchain, isLn } from 'lib/utils/crypto'
import { decodePayReq, getMinFee, getMaxFee, isOnchain, isLn } from 'lib/utils/crypto'
import { convert } from 'lib/utils/btc'
import {
Bar,
Expand Down Expand Up @@ -624,15 +624,6 @@ class Pay extends React.Component {
const showBack = currentStep !== 'address'
const showSubmit = currentStep !== 'address' || (isOnchain || isLn)

// Determine wether we have a route to the sender.
let hasRoute = true
if (isLn && currentStep === 'summary') {
const { min, max } = getFeeRange(routes || [])
if (min === null || max === null) {
hasRoute = false
}
}

// Determine wether we have enough funds available.
let hasEnoughFunds = true
if (isLn && invoice) {
Expand Down Expand Up @@ -682,14 +673,6 @@ class Pay extends React.Component {
<ShowHideButtons state={showBack || showSubmit ? 'show' : 'show'}>
{styles => (
<Box style={styles}>
{currentStep === 'summary' &&
!isQueryingRoutes &&
!hasRoute && (
<Message variant="error" justifyContent="center" mb={2}>
<FormattedMessage {...messages.error_no_route} />
</Message>
)}

{currentStep === 'summary' &&
!hasEnoughFunds && (
<Message variant="error" justifyContent="center" mb={2}>
Expand All @@ -702,7 +685,7 @@ class Pay extends React.Component {
formState.pristine ||
formState.invalid ||
isProcessing ||
(currentStep === 'summary' && (!hasRoute || !hasEnoughFunds))
(currentStep === 'summary' && !hasEnoughFunds)
}
nextButtonText={nextButtonText}
processing={isProcessing}
Expand Down
1 change: 0 additions & 1 deletion app/components/Pay/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { defineMessages } from 'react-intl'
export default defineMessages({
calculating: 'calculating',
current_balance: 'Your current balance',
error_no_route: 'We were unable to find a route to your destination. Please try again later.',
error_not_enough_funds: 'You do not have enough funds available to make this payment.',
request_label_combined: 'Payment Request or Address',
request_label_offchain: 'Payment Request',
Expand Down
1 change: 0 additions & 1 deletion app/translations/af-ZA.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
"components.Pay.calculating": "",
"components.Pay.current_balance": "",
"components.Pay.description": "",
"components.Pay.error_no_route": "",
"components.Pay.error_not_enough_funds": "",
"components.Pay.fee": "",
"components.Pay.fee_less_than_1": "",
Expand Down
1 change: 0 additions & 1 deletion app/translations/ar-SA.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
"components.Pay.calculating": "",
"components.Pay.current_balance": "",
"components.Pay.description": "",
"components.Pay.error_no_route": "",
"components.Pay.error_not_enough_funds": "",
"components.Pay.fee": "",
"components.Pay.fee_less_than_1": "",
Expand Down
1 change: 0 additions & 1 deletion app/translations/bg-BG.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
"components.Pay.calculating": "",
"components.Pay.current_balance": "",
"components.Pay.description": "",
"components.Pay.error_no_route": "",
"components.Pay.error_not_enough_funds": "",
"components.Pay.fee": "",
"components.Pay.fee_less_than_1": "",
Expand Down
1 change: 0 additions & 1 deletion app/translations/ca-ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
"components.Pay.calculating": "",
"components.Pay.current_balance": "",
"components.Pay.description": "",
"components.Pay.error_no_route": "",
"components.Pay.error_not_enough_funds": "",
"components.Pay.fee": "",
"components.Pay.fee_less_than_1": "",
Expand Down
1 change: 0 additions & 1 deletion app/translations/cs-CZ.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
"components.Pay.calculating": "",
"components.Pay.current_balance": "",
"components.Pay.description": "",
"components.Pay.error_no_route": "",
"components.Pay.error_not_enough_funds": "",
"components.Pay.fee": "",
"components.Pay.fee_less_than_1": "",
Expand Down
1 change: 0 additions & 1 deletion app/translations/da-DK.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
"components.Pay.calculating": "",
"components.Pay.current_balance": "",
"components.Pay.description": "",
"components.Pay.error_no_route": "",
"components.Pay.error_not_enough_funds": "",
"components.Pay.fee": "",
"components.Pay.fee_less_than_1": "",
Expand Down
1 change: 0 additions & 1 deletion app/translations/de-DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
"components.Pay.calculating": "",
"components.Pay.current_balance": "",
"components.Pay.description": "",
"components.Pay.error_no_route": "",
"components.Pay.error_not_enough_funds": "",
"components.Pay.fee": "",
"components.Pay.fee_less_than_1": "",
Expand Down
1 change: 0 additions & 1 deletion app/translations/el-GR.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
"components.Pay.calculating": "",
"components.Pay.current_balance": "",
"components.Pay.description": "",
"components.Pay.error_no_route": "",
"components.Pay.error_not_enough_funds": "",
"components.Pay.fee": "",
"components.Pay.fee_less_than_1": "",
Expand Down
1 change: 0 additions & 1 deletion app/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
"components.Pay.calculating": "calculating",
"components.Pay.current_balance": "Your current balance",
"components.Pay.description": "You can send Bitcoin (BTC) through the Lightning Network or make a On-Chain Transaction. Just paste your Lightning Payment Request or the Bitcoin Address in the field below. Zap will guide you to the process.",
"components.Pay.error_no_route": "We were unable to find a route to your destination. Please try again later.",
"components.Pay.error_not_enough_funds": "You do not have enough funds available to make this payment.",
"components.Pay.fee": "Fee",
"components.Pay.fee_less_than_1": "less than 1 satoshi",
Expand Down
1 change: 0 additions & 1 deletion app/translations/es-ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
"components.Pay.calculating": "",
"components.Pay.current_balance": "",
"components.Pay.description": "",
"components.Pay.error_no_route": "",
"components.Pay.error_not_enough_funds": "",
"components.Pay.fee": "",
"components.Pay.fee_less_than_1": "",
Expand Down
1 change: 0 additions & 1 deletion app/translations/fi-FI.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
"components.Pay.calculating": "",
"components.Pay.current_balance": "",
"components.Pay.description": "",
"components.Pay.error_no_route": "",
"components.Pay.error_not_enough_funds": "",
"components.Pay.fee": "",
"components.Pay.fee_less_than_1": "",
Expand Down
1 change: 0 additions & 1 deletion app/translations/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
"components.Pay.calculating": "",
"components.Pay.current_balance": "",
"components.Pay.description": "",
"components.Pay.error_no_route": "",
"components.Pay.error_not_enough_funds": "",
"components.Pay.fee": "",
"components.Pay.fee_less_than_1": "",
Expand Down
1 change: 0 additions & 1 deletion app/translations/ga-IE.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
"components.Pay.calculating": "",
"components.Pay.current_balance": "",
"components.Pay.description": "",
"components.Pay.error_no_route": "",
"components.Pay.error_not_enough_funds": "",
"components.Pay.fee": "",
"components.Pay.fee_less_than_1": "",
Expand Down
1 change: 0 additions & 1 deletion app/translations/he-IL.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
"components.Pay.calculating": "",
"components.Pay.current_balance": "",
"components.Pay.description": "",
"components.Pay.error_no_route": "",
"components.Pay.error_not_enough_funds": "",
"components.Pay.fee": "",
"components.Pay.fee_less_than_1": "",
Expand Down
1 change: 0 additions & 1 deletion app/translations/hi-IN.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
"components.Pay.calculating": "",
"components.Pay.current_balance": "",
"components.Pay.description": "",
"components.Pay.error_no_route": "",
"components.Pay.error_not_enough_funds": "",
"components.Pay.fee": "",
"components.Pay.fee_less_than_1": "",
Expand Down
1 change: 0 additions & 1 deletion app/translations/hr-HR.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
"components.Pay.calculating": "",
"components.Pay.current_balance": "",
"components.Pay.description": "",
"components.Pay.error_no_route": "",
"components.Pay.error_not_enough_funds": "",
"components.Pay.fee": "",
"components.Pay.fee_less_than_1": "",
Expand Down
1 change: 0 additions & 1 deletion app/translations/hu-HU.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
"components.Pay.calculating": "",
"components.Pay.current_balance": "",
"components.Pay.description": "",
"components.Pay.error_no_route": "",
"components.Pay.error_not_enough_funds": "",
"components.Pay.fee": "",
"components.Pay.fee_less_than_1": "",
Expand Down
1 change: 0 additions & 1 deletion app/translations/it-IT.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
"components.Pay.calculating": "",
"components.Pay.current_balance": "",
"components.Pay.description": "",
"components.Pay.error_no_route": "",
"components.Pay.error_not_enough_funds": "",
"components.Pay.fee": "",
"components.Pay.fee_less_than_1": "",
Expand Down
1 change: 0 additions & 1 deletion app/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
"components.Pay.calculating": "",
"components.Pay.current_balance": "",
"components.Pay.description": "",
"components.Pay.error_no_route": "",
"components.Pay.error_not_enough_funds": "",
"components.Pay.fee": "",
"components.Pay.fee_less_than_1": "",
Expand Down
1 change: 0 additions & 1 deletion app/translations/ko-KR.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
"components.Pay.calculating": "",
"components.Pay.current_balance": "",
"components.Pay.description": "",
"components.Pay.error_no_route": "",
"components.Pay.error_not_enough_funds": "",
"components.Pay.fee": "",
"components.Pay.fee_less_than_1": "",
Expand Down
1 change: 0 additions & 1 deletion app/translations/nl-NL.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
"components.Pay.calculating": "",
"components.Pay.current_balance": "",
"components.Pay.description": "",
"components.Pay.error_no_route": "",
"components.Pay.error_not_enough_funds": "",
"components.Pay.fee": "",
"components.Pay.fee_less_than_1": "",
Expand Down
1 change: 0 additions & 1 deletion app/translations/no-NO.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
"components.Pay.calculating": "",
"components.Pay.current_balance": "",
"components.Pay.description": "",
"components.Pay.error_no_route": "",
"components.Pay.error_not_enough_funds": "",
"components.Pay.fee": "",
"components.Pay.fee_less_than_1": "",
Expand Down
1 change: 0 additions & 1 deletion app/translations/pl-PL.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
"components.Pay.calculating": "",
"components.Pay.current_balance": "",
"components.Pay.description": "",
"components.Pay.error_no_route": "",
"components.Pay.error_not_enough_funds": "",
"components.Pay.fee": "",
"components.Pay.fee_less_than_1": "",
Expand Down
1 change: 0 additions & 1 deletion app/translations/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
"components.Pay.calculating": "",
"components.Pay.current_balance": "",
"components.Pay.description": "",
"components.Pay.error_no_route": "",
"components.Pay.error_not_enough_funds": "",
"components.Pay.fee": "",
"components.Pay.fee_less_than_1": "",
Expand Down
1 change: 0 additions & 1 deletion app/translations/pt-PT.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
"components.Pay.calculating": "",
"components.Pay.current_balance": "",
"components.Pay.description": "",
"components.Pay.error_no_route": "",
"components.Pay.error_not_enough_funds": "",
"components.Pay.fee": "",
"components.Pay.fee_less_than_1": "",
Expand Down
1 change: 0 additions & 1 deletion app/translations/ro-RO.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
"components.Pay.calculating": "",
"components.Pay.current_balance": "",
"components.Pay.description": "",
"components.Pay.error_no_route": "",
"components.Pay.error_not_enough_funds": "",
"components.Pay.fee": "",
"components.Pay.fee_less_than_1": "",
Expand Down
1 change: 0 additions & 1 deletion app/translations/ru-RU.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
"components.Pay.calculating": "",
"components.Pay.current_balance": "",
"components.Pay.description": "",
"components.Pay.error_no_route": "",
"components.Pay.error_not_enough_funds": "",
"components.Pay.fee": "",
"components.Pay.fee_less_than_1": "",
Expand Down
1 change: 0 additions & 1 deletion app/translations/sr-SP.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
"components.Pay.calculating": "",
"components.Pay.current_balance": "",
"components.Pay.description": "",
"components.Pay.error_no_route": "",
"components.Pay.error_not_enough_funds": "",
"components.Pay.fee": "",
"components.Pay.fee_less_than_1": "",
Expand Down
1 change: 0 additions & 1 deletion app/translations/sv-SE.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
"components.Pay.calculating": "",
"components.Pay.current_balance": "",
"components.Pay.description": "",
"components.Pay.error_no_route": "",
"components.Pay.error_not_enough_funds": "",
"components.Pay.fee": "",
"components.Pay.fee_less_than_1": "",
Expand Down
1 change: 0 additions & 1 deletion app/translations/tr-TR.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
"components.Pay.calculating": "",
"components.Pay.current_balance": "",
"components.Pay.description": "",
"components.Pay.error_no_route": "",
"components.Pay.error_not_enough_funds": "",
"components.Pay.fee": "",
"components.Pay.fee_less_than_1": "",
Expand Down
1 change: 0 additions & 1 deletion app/translations/uk-UA.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
"components.Pay.calculating": "",
"components.Pay.current_balance": "",
"components.Pay.description": "",
"components.Pay.error_no_route": "",
"components.Pay.error_not_enough_funds": "",
"components.Pay.fee": "",
"components.Pay.fee_less_than_1": "",
Expand Down
1 change: 0 additions & 1 deletion app/translations/vi-VN.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
"components.Pay.calculating": "",
"components.Pay.current_balance": "",
"components.Pay.description": "",
"components.Pay.error_no_route": "",
"components.Pay.error_not_enough_funds": "",
"components.Pay.fee": "",
"components.Pay.fee_less_than_1": "",
Expand Down
1 change: 0 additions & 1 deletion app/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
"components.Pay.calculating": "",
"components.Pay.current_balance": "",
"components.Pay.description": "",
"components.Pay.error_no_route": "",
"components.Pay.error_not_enough_funds": "",
"components.Pay.fee": "",
"components.Pay.fee_less_than_1": "",
Expand Down
1 change: 0 additions & 1 deletion app/translations/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
"components.Pay.calculating": "",
"components.Pay.current_balance": "",
"components.Pay.description": "",
"components.Pay.error_no_route": "",
"components.Pay.error_not_enough_funds": "",
"components.Pay.fee": "",
"components.Pay.fee_less_than_1": "",
Expand Down

0 comments on commit 9807dec

Please sign in to comment.