From 0d6d8b276ab64c5380c1fff239e296fda97c6dc6 Mon Sep 17 00:00:00 2001 From: Victor Kirov Date: Tue, 13 Feb 2024 13:21:44 +0200 Subject: [PATCH] Fix insufficient amount on load --- src/app/screens/sendBtc/index.tsx | 4 ++-- src/app/screens/sendBtc/stepDisplay.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/screens/sendBtc/index.tsx b/src/app/screens/sendBtc/index.tsx index 6f43eb583..b43dc73fa 100644 --- a/src/app/screens/sendBtc/index.tsx +++ b/src/app/screens/sendBtc/index.tsx @@ -52,7 +52,7 @@ function SendBtcScreen() { }, [btcFeeRate, feeRatesLoading]); const generateTransactionAndSummary = async (feeRateOverride?: number) => { - const amountBigInt = BigInt(amountSats); + const amountBigInt = Number.isNaN(Number(amountSats)) ? 0n : BigInt(amountSats); const transactionDetails = sendMax && currentStep !== Step.Confirm ? await generateSendMaxTransaction( @@ -70,7 +70,7 @@ function SendBtcScreen() { }; useEffect(() => { - if (!recipientAddress || !(amountSats || sendMax) || !feeRate) { + if (!recipientAddress || !feeRate) { setTransaction(undefined); setSummary(undefined); return; diff --git a/src/app/screens/sendBtc/stepDisplay.tsx b/src/app/screens/sendBtc/stepDisplay.tsx index 446104c7c..bf7747055 100644 --- a/src/app/screens/sendBtc/stepDisplay.tsx +++ b/src/app/screens/sendBtc/stepDisplay.tsx @@ -109,7 +109,7 @@ function StepDisplay({ getFeeForFeeRate={getFeeForFeeRate} dustFiltered={summary?.dustFiltered ?? false} onNext={() => setCurrentStep(getNextStep(Step.SelectAmount, amountEditable))} - hasSufficientFunds={!amountSats || !!summary || isLoading} + hasSufficientFunds={!!summary || isLoading} isLoading={isLoading} />