Skip to content

Commit

Permalink
Merge pull request #3236 from LiskHQ/3234-fix-delegate-reg
Browse files Browse the repository at this point in the history
Delegate registration fails when trying to register with long usernames - Closes #3234
  • Loading branch information
reyraa authored Dec 16, 2020
2 parents 73372cd + 2a35c7a commit 76a3674
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import BoxContent from '../../../toolbox/box/content';
import BoxFooter from '../../../toolbox/box/footer';
import { Input } from '../../../toolbox/inputs';
import { PrimaryButton } from '../../../toolbox/buttons';
import { fromRawLsk } from '../../../../utils/lsk';
import { getAPIClient } from '../../../../utils/api/lsk/network';
import regex from '../../../../utils/regex';
import Tooltip from '../../../toolbox/tooltip/tooltip';
Expand Down Expand Up @@ -47,6 +46,7 @@ const SelectNameAndFee = ({ account, ...props }) => {
txType,
nonce: account.nonce,
senderPublicKey: account.publicKey,
username: state.nickname,
},
});

Expand Down Expand Up @@ -74,7 +74,7 @@ const SelectNameAndFee = ({ account, ...props }) => {

const hasUserEnoughFunds = () => {
const hasFunds = account
&& fromRawLsk(account.balance) * 1 >= 25 * 1;
&& account.balance >= fee.value;

if (!hasFunds) {
setState({
Expand Down Expand Up @@ -133,9 +133,12 @@ const SelectNameAndFee = ({ account, ...props }) => {
useEffect(() => {
getNicknameFromPrevState();
checkIfUserIsDelegate();
hasUserEnoughFunds();
}, []);

useEffect(() => {
hasUserEnoughFunds();
}, [fee]);

const isBtnDisabled = () => {
if (state.customFee && state.customFee.error) return true;
return !!state.error || state.nickname.length === 0 || state.loading;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ const useTransactionFeeCalculation = ({
txData.amount,
txData.data,
txData.recipient,
txData.username,
selectedPriority.selectedIndex,
selectedPriority.value,
]);
Expand Down

0 comments on commit 76a3674

Please sign in to comment.