This commit is contained in:
Yana
2023-11-08 16:52:55 +00:00
parent 4f58a63cb6
commit 788a67e9f4
@@ -103,7 +103,6 @@ export const DelegateModal: FCWithChildren<{
let newValidatedValue = true;
let errorAmountMessage;
let errorIdentityKeyMessage;
const tokenPool = 'balance';
if (!identityKey) {
newValidatedValue = false;
@@ -124,15 +123,6 @@ export const DelegateModal: FCWithChildren<{
newValidatedValue = false;
}
if (amount) {
const hasEnoughTokens = checkTokenBalance(tokenPool, amount, balance.data || '0');
if (!hasEnoughTokens) {
errorAmountMessage = 'Not enough funds';
newValidatedValue = false;
}
}
// if (!mixId) {
// newValidatedValue = false;
// }
@@ -153,6 +143,12 @@ export const DelegateModal: FCWithChildren<{
const handleConfirm = async ({ mixId: id, value }: { mixId: number; value: DecCoin }) => {
const tokenPool = 'balance';
const hasEnoughTokens = checkTokenBalance(tokenPool, value.amount, balance.data || '0');
if (!hasEnoughTokens) {
setErrorAmount('Not enough funds');
return;
}
if (tokenPool === 'balance') {
getFee(simulateDelegateToMixnode, { mixId: id, amount: value });