From 58097d5e38b171567b90f5143f8f29b498e05c29 Mon Sep 17 00:00:00 2001 From: MickWang <1244134672@qq.com> Date: Tue, 9 Apr 2024 20:20:50 +0800 Subject: [PATCH] add exception catch for amount exceeds decimals --- views/transactions/Deposit.vue | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/views/transactions/Deposit.vue b/views/transactions/Deposit.vue index fcf13187e..1805c642c 100644 --- a/views/transactions/Deposit.vue +++ b/views/transactions/Deposit.vue @@ -640,10 +640,14 @@ const mergeSupported = computed(() => { const mergeLimitExceeds = computed(() => { if (!selectedToken.value || !mergeTokenInfo.value || !amount.value) return false; - const amountVal = decimalToBigNumber(amount.value, selectedToken.value.decimals); - const exceeds = amountVal.add(mergeTokenInfo.value?.balance).gt(mergeTokenInfo.value?.depositLimit); - console.log("exceeds: ", exceeds); - return mergeSupported.value && isMerge.value && exceeds; + try { + const amountVal = decimalToBigNumber(amount.value, selectedToken.value.decimals); + const exceeds = amountVal.add(mergeTokenInfo.value?.balance).gt(mergeTokenInfo.value?.depositLimit); + console.log("exceeds: ", exceeds); + return mergeSupported.value && isMerge.value && exceeds; + } catch (e) { // may throw exception when amount exceeds decimals + return false; +} }); const transaction = computed<