From 5e811fe5cdccc3e786a25fefec96121b479a2a8e Mon Sep 17 00:00:00 2001 From: reyraa Date: Wed, 16 Dec 2020 13:36:03 +0100 Subject: [PATCH 1/3] Recalculate fee when the username changes --- src/components/screens/send/form/useTransactionFeeCalculation.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/screens/send/form/useTransactionFeeCalculation.js b/src/components/screens/send/form/useTransactionFeeCalculation.js index beb1ca05c7..5cd2e75f06 100644 --- a/src/components/screens/send/form/useTransactionFeeCalculation.js +++ b/src/components/screens/send/form/useTransactionFeeCalculation.js @@ -66,6 +66,7 @@ const useTransactionFeeCalculation = ({ txData.amount, txData.data, txData.recipient, + txData.username, selectedPriority.selectedIndex, selectedPriority.value, ]); From e5e349d0e9086d9ee0790602e1797d9af24d1267 Mon Sep 17 00:00:00 2001 From: reyraa Date: Wed, 16 Dec 2020 13:38:38 +0100 Subject: [PATCH 2/3] Pass nickname to and recall hasUserEnoughFunds when nickname changed --- .../registerDelegate/selectNameAndFee/selectNameAndFee.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/screens/registerDelegate/selectNameAndFee/selectNameAndFee.js b/src/components/screens/registerDelegate/selectNameAndFee/selectNameAndFee.js index 4d081e8ed1..3e757f7dab 100644 --- a/src/components/screens/registerDelegate/selectNameAndFee/selectNameAndFee.js +++ b/src/components/screens/registerDelegate/selectNameAndFee/selectNameAndFee.js @@ -47,6 +47,7 @@ const SelectNameAndFee = ({ account, ...props }) => { txType, nonce: account.nonce, senderPublicKey: account.publicKey, + username: state.nickname, }, }); @@ -133,9 +134,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; From 2a35c7a925bacdc4e920d78e19b82e416adf42f2 Mon Sep 17 00:00:00 2001 From: reyraa Date: Wed, 16 Dec 2020 13:39:17 +0100 Subject: [PATCH 3/3] Fix balance sufficientcy check --- .../registerDelegate/selectNameAndFee/selectNameAndFee.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/screens/registerDelegate/selectNameAndFee/selectNameAndFee.js b/src/components/screens/registerDelegate/selectNameAndFee/selectNameAndFee.js index 3e757f7dab..f5c2cd81ad 100644 --- a/src/components/screens/registerDelegate/selectNameAndFee/selectNameAndFee.js +++ b/src/components/screens/registerDelegate/selectNameAndFee/selectNameAndFee.js @@ -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'; @@ -75,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({