Skip to content

Commit

Permalink
Show topup modal when low on funds
Browse files Browse the repository at this point in the history
  • Loading branch information
WRadoslaw committed Mar 14, 2024
1 parent 43aed67 commit 4accc7e
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions packages/atlas/src/providers/transactions/transactions.hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@ type HandleTransactionFn = <T extends ExtrinsicResult>(opts: HandleTransactionOp
const WALLETS_WITH_METADATA = ['talisman', 'polkadot-js', 'subwallet-js']

export const useTransaction = (): HandleTransactionFn => {
const { addBlockAction, addTransaction, updateTransaction, removeTransaction } = useTransactionManagerStore(
(state) => state.actions
)
const { addBlockAction, addTransaction, updateTransaction, removeTransaction, setChangeNowModal } =
useTransactionManagerStore((state) => state.actions)
const navigate = useNavigate()

const [openOngoingTransactionModal, closeOngoingTransactionModal] = useConfirmationModal()
Expand Down Expand Up @@ -115,12 +114,7 @@ export const useTransaction = (): HandleTransactionFn => {
}

if (fee && totalBalance?.lt(fee)) {
displaySnackbar({
title: 'Not enough funds',
description:
"You don't have enough funds to cover blockchain transaction fee for this operation. Please, top up your account balance and try again.",
iconType: 'error',
})
setChangeNowModal('topup')
return false
}

Expand Down Expand Up @@ -365,6 +359,7 @@ export const useTransaction = (): HandleTransactionFn => {
nodeConnectionStatus,
openOngoingTransactionModal,
removeTransaction,
setChangeNowModal,
skipSignerMetadataUpdate,
totalBalance,
updateSignerMetadata,
Expand Down

0 comments on commit 4accc7e

Please sign in to comment.