Adjust fee calc for signer (#5103)
This commit is contained in:
parent
cc3738c881
commit
7476bbbd4a
@ -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 (
|
||||
<>
|
||||
<Expander
|
||||
@ -59,7 +64,7 @@ function PaymentInfo ({ accountId, className = '', extrinsic }: Props): React.Re
|
||||
</Trans>
|
||||
}
|
||||
/>
|
||||
{api.consts.balances && !api.tx.balances?.transfer.is(extrinsic) && balances?.accountId.eq(accountId) && balances.availableBalance.sub(dispatchInfo.partialFee).lte(api.consts.balances.existentialDeposit) && (
|
||||
{isFeeError && (
|
||||
<MarkWarning content={t<string>('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.')} />
|
||||
)}
|
||||
</>
|
||||
|
||||
@ -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<Props> | null {
|
||||
function Transaction ({ accountId, className, currentItem: { extrinsic, isUnsigned, payload }, isSendable, onError, tip }: Props): React.ReactElement<Props> | null {
|
||||
const { t } = useTranslation();
|
||||
|
||||
if (!extrinsic) {
|
||||
|
||||
@ -361,6 +361,7 @@ function TxSigned ({ className, currentItem, requestAddress }: Props): React.Rea
|
||||
: (
|
||||
<>
|
||||
<Transaction
|
||||
accountId={senderInfo.signAddress}
|
||||
currentItem={currentItem}
|
||||
onError={toggleRenderError}
|
||||
/>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user