From 2a18749cb9b08726dedf0cfb63971305e50a910a Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 25 Jan 2023 10:27:04 -0800 Subject: cap numpad amount --- src/components/Numpad.svelte | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/components') diff --git a/src/components/Numpad.svelte b/src/components/Numpad.svelte index e688cc6e..74844b71 100644 --- a/src/components/Numpad.svelte +++ b/src/components/Numpad.svelte @@ -119,7 +119,12 @@ let prev = ''; let input = (e) => { - if (html.length > 12) return (html = prev); + if (amount > sats) { + if (fiat) amountFiat = (Math.round(sats * ($selectedRate / sats))).toString(); + else amountSats = sats; + return warning($t('user.receive.lessThan1BTCWarning')); + } + if (prev === '0' && html.length === 2) { prev = ''; html = html.replace('0', ''); @@ -130,7 +135,6 @@ if (!fiat) amountSats = parseInt(html.replace(/,/g, '')); if (!amountSats) amountSats = null; - if (amountSats > sats) amountSats = sats; setTimeout(() => { let p = prev.split(',')[0].length; -- cgit v1.2.3