diff --git a/packages/extension/src/providers/bitcoin/ui/send-transaction/index.vue b/packages/extension/src/providers/bitcoin/ui/send-transaction/index.vue index 476e459be..0019b36de 100644 --- a/packages/extension/src/providers/bitcoin/ui/send-transaction/index.vue +++ b/packages/extension/src/providers/bitcoin/ui/send-transaction/index.vue @@ -305,7 +305,10 @@ const isInputsValid = computed(() => { isSendToken.value ) return false; - if (new BigNumber(sendAmount.value).gt(assetMaxValue.value)) return false; + + const sendAmountBigNumber = new BigNumber(sendAmount.value) + if (sendAmountBigNumber.isNaN()) return false + if (sendAmountBigNumber.gt(assetMaxValue.value)) return false; return true; }); diff --git a/packages/extension/src/providers/common/ui/send-transaction/send-input-amount.vue b/packages/extension/src/providers/common/ui/send-transaction/send-input-amount.vue index 206a5fafd..d444b943a 100644 --- a/packages/extension/src/providers/common/ui/send-transaction/send-input-amount.vue +++ b/packages/extension/src/providers/common/ui/send-transaction/send-input-amount.vue @@ -73,9 +73,16 @@ const amount = computed({ const onlyNumber = ($event: KeyboardEvent) => { const keyCode = $event.keyCode ? $event.keyCode : $event.which; - if ((keyCode < 48 || keyCode > 57) && keyCode !== 46) { - $event.preventDefault(); + // Numeric + if (keyCode >= /* 0 */ 48 && keyCode <= /* 9 */ 57) { + return; } + // Only allow a single period + if (keyCode === /* '.' */ 46 && amount.value.indexOf('.') === -1) { + return; + } + // Alphabetical (/non-numeric) or mulitple periods. Don't propagate change + $event.preventDefault(); }; const changeFocus = () => { isFocus.value = !isFocus.value; diff --git a/packages/extension/src/providers/ethereum/ui/send-transaction/index.vue b/packages/extension/src/providers/ethereum/ui/send-transaction/index.vue index d042451b8..74929b82e 100644 --- a/packages/extension/src/providers/ethereum/ui/send-transaction/index.vue +++ b/packages/extension/src/providers/ethereum/ui/send-transaction/index.vue @@ -486,7 +486,9 @@ const isInputsValid = computed(() => { if (!isSendToken.value && !selectedNft.value.id) { return false; } - if (new BigNumber(sendAmount.value).gt(assetMaxValue.value)) return false; + const sendAmountBigNumber = new BigNumber(sendAmount.value) + if (sendAmountBigNumber.isNaN()) return false + if (sendAmountBigNumber.gt(assetMaxValue.value)) return false; if (gasCostValues.value.REGULAR.nativeValue === '0') return false; return true; }); diff --git a/packages/extension/src/providers/solana/ui/send-transaction/index.vue b/packages/extension/src/providers/solana/ui/send-transaction/index.vue index 12b74be95..55eaedd24 100644 --- a/packages/extension/src/providers/solana/ui/send-transaction/index.vue +++ b/packages/extension/src/providers/solana/ui/send-transaction/index.vue @@ -399,7 +399,9 @@ const isInputsValid = computed(() => { if (!isSendToken.value && !selectedNft.value.id) { return false; } - if (new BigNumber(sendAmount.value).gt(assetMaxValue.value)) return false; + const sendAmountBigNumber = new BigNumber(sendAmount.value); + if (sendAmountBigNumber.isNaN()) return false; + if (sendAmountBigNumber.gt(assetMaxValue.value)) return false; return true; });