Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
yanok87 committed Nov 8, 2023
1 parent 4f58a63 commit 788a67e
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions explorer/src/components/Delegations/components/DelegateModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ export const DelegateModal: FCWithChildren<{
let newValidatedValue = true;
let errorAmountMessage;
let errorIdentityKeyMessage;
const tokenPool = 'balance';

if (!identityKey) {
newValidatedValue = false;
Expand All @@ -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;
// }
Expand All @@ -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 });
Expand Down

0 comments on commit 788a67e

Please sign in to comment.