diff --git a/src/components/SendFundsForm.vue b/src/components/SendFundsForm.vue index bd624e61e..53ecdbedb 100644 --- a/src/components/SendFundsForm.vue +++ b/src/components/SendFundsForm.vue @@ -198,6 +198,8 @@ import QrcodeCapture from '@/components/QrcodeCapture.vue' import QrcodeScannerDialog from '@/components/QrcodeScannerDialog.vue' import get from 'lodash/get' import { BigNumber } from 'bignumber.js' +import * as transactions from '@klayr/transactions' +import { KLY_DECIMALS } from '@/lib/klayr/klayr-constants' import { INCREASE_FEE_MULTIPLIER, @@ -227,6 +229,8 @@ import { isStringEqualCI } from '@/lib/textHelpers' import { formatSendTxError } from '@/lib/txVerify' import { AllCryptos } from '@/lib/constants/cryptos' +import { MAX_UINT64 } from '@klayr/validator' + /** * @returns {string | boolean} */ @@ -527,7 +531,15 @@ export default { () => isErc20(this.currency) ? this.ethBalance >= this.transferFee || this.$t('transfer.error_not_enough_eth_fee') - : true + : true, + (v) => { + const isKlyTransfer = this.currency === Cryptos.KLY + if (!isKlyTransfer) return true + const isKlyTransferAllowed = + this.transferFee && + transactions.convertklyToBeddows(v.toFixed(KLY_DECIMALS)) < MAX_UINT64 + return isKlyTransferAllowed || this.$t('transfer.error_incorrect_amount') + } ] } }, diff --git a/src/store/modules/kly/kly-getters.js b/src/store/modules/kly/kly-getters.js index 036de8b9e..68dc65022 100644 --- a/src/store/modules/kly/kly-getters.js +++ b/src/store/modules/kly/kly-getters.js @@ -5,12 +5,16 @@ export default { ...baseGetters, fee: (state) => (amount, recipientAddress, data, isNewAccount) => { - return estimateFee({ - amount, - data, - isNewAccount, - nonce: state.nonce - }) + try { + return estimateFee({ + amount, + data, + isNewAccount, + nonce: state.nonce + }) + } catch { + return 0 + } }, height(state) {