diff --git a/packages/react-signer/src/PaymentInfo.tsx b/packages/react-signer/src/PaymentInfo.tsx index 92bac4e51f..ae341b67ea 100644 --- a/packages/react-signer/src/PaymentInfo.tsx +++ b/packages/react-signer/src/PaymentInfo.tsx @@ -16,7 +16,7 @@ import { formatBalance, isFunction } from '@polkadot/util'; import { useTranslation } from './translate'; interface Props { - accountId?: string | null; + accountId: string | null; className?: string; extrinsic?: SubmittableExtrinsic | null; isSendable: boolean; @@ -49,6 +49,11 @@ function PaymentInfo ({ accountId, className = '', extrinsic }: Props): React.Re return null; } + const isFeeError = api.consts.balances && !api.tx.balances?.transfer.is(extrinsic) && balances?.accountId.eq(accountId) && ( + balances.availableBalance.lte(dispatchInfo.partialFee) || + balances.freeBalance.sub(dispatchInfo.partialFee).lte(api.consts.balances.existentialDeposit) + ); + return ( <> } /> - {api.consts.balances && !api.tx.balances?.transfer.is(extrinsic) && balances?.accountId.eq(accountId) && balances.availableBalance.sub(dispatchInfo.partialFee).lte(api.consts.balances.existentialDeposit) && ( + {isFeeError && ( ('The account does not have enough free funds (excluding locked/bonded/reserved) available to cover the transaction fees without dropping the balance below the account existential amount.')} /> )} diff --git a/packages/react-signer/src/Transaction.tsx b/packages/react-signer/src/Transaction.tsx index 58203e033f..774eeccbde 100644 --- a/packages/react-signer/src/Transaction.tsx +++ b/packages/react-signer/src/Transaction.tsx @@ -13,6 +13,7 @@ import PaymentInfo from './PaymentInfo'; import { useTranslation } from './translate'; interface Props { + accountId: string | null; className?: string; currentItem: QueueTx; isSendable: boolean; @@ -20,7 +21,7 @@ interface Props { tip?: BN; } -function Transaction ({ className, currentItem: { accountId, extrinsic, isUnsigned, payload }, isSendable, onError, tip }: Props): React.ReactElement | null { +function Transaction ({ accountId, className, currentItem: { extrinsic, isUnsigned, payload }, isSendable, onError, tip }: Props): React.ReactElement | null { const { t } = useTranslation(); if (!extrinsic) { diff --git a/packages/react-signer/src/TxSigned.tsx b/packages/react-signer/src/TxSigned.tsx index f2cbfe91df..7039a3af50 100644 --- a/packages/react-signer/src/TxSigned.tsx +++ b/packages/react-signer/src/TxSigned.tsx @@ -361,6 +361,7 @@ function TxSigned ({ className, currentItem, requestAddress }: Props): React.Rea : ( <>