Skip to content

Commit

Permalink
Block sending money until balance is fetched (#1666)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcinbodnar committed May 18, 2021
1 parent bd63a4b commit 7ff775b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/components/send/SendContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import TransferMoneyIcon from '../svg/TransferMoneyIcon'
import { onKeyDown } from '../../hooks/eventListeners'
import classNames from '../../utils/classNames'
import { Mixpanel } from '../../mixpanel/index'
import { actionsPending } from '../../utils/alerts'

const {
parseNearAmount, formatNearAmount
Expand Down Expand Up @@ -57,7 +58,13 @@ export function SendContainer({ match, location }) {
const sufficientBalance = balance?.available
? !new BN(parseNearAmount(amount)).isZero() && (new BN(parseNearAmount(amount)).lte(amountAvailableToSend) || useMax) && isDecimalString(amount)
: undefined
const sendAllowed = ((localAlert && localAlert.success !== false) || id.length === 64) && sufficientBalance && amount && !mainLoader && !success

const sendAllowed = ((localAlert && localAlert.success !== false) || id.length === 64)
&& sufficientBalance
&& amount
&& !mainLoader
&& !success
&& !actionsPending('GET_BALANCE')

useEffect(() => {
if (success) {
Expand Down

0 comments on commit 7ff775b

Please sign in to comment.