@@ -73,8 +73,9 @@ const SpendingAmount = ({
7373 const availableAmount = onchainBalance - transaction . fee ;
7474 const { defaultLspBalance : maxLspBalance } = useTransfer ( availableAmount ) ;
7575 const { fee : maxLspFee } = useTransferFee ( maxLspBalance , availableAmount ) ;
76- const feeMaximum = Math . floor ( availableAmount - maxLspFee ) ;
76+ const feeMaximum = Math . max ( 0 , Math . floor ( availableAmount - maxLspFee ) ) ;
7777 const maximum = Math . min ( maxClientBalance , feeMaximum ) ;
78+ const fee = transaction . fee + maxLspFee ;
7879
7980 useFocusEffect (
8081 // biome-ignore lint/correctness/useExhaustiveDependencies: onMount
@@ -116,7 +117,30 @@ const SpendingAmount = ({
116117 setTextFieldValue ( result ) ;
117118 } ;
118119
120+ const checkFeeMinimum = ( ) : boolean => {
121+ if ( fee > availableAmount ) {
122+ const roundedFee = Math . ceil ( fee / 1000 ) * 1000 ;
123+ const dv = getDisplayValues ( { satoshis : roundedFee } ) ;
124+ const description = t ( 'spending_amount.error_min.description' , {
125+ amount : dv . bitcoinFormatted ,
126+ } ) ;
127+
128+ showToast ( {
129+ type : 'warning' ,
130+ title : t ( 'spending_amount.error_min.title' ) ,
131+ description,
132+ } ) ;
133+
134+ return true ;
135+ }
136+ return false ;
137+ } ;
138+
119139 const onNumberPadError = ( ) : void => {
140+ if ( checkFeeMinimum ( ) ) {
141+ return ;
142+ }
143+
120144 const dv = getDisplayValues ( { satoshis : maximum } ) ;
121145 let description = t ( 'spending_amount.error_max.description' , {
122146 amount : dv . bitcoinFormatted ,
@@ -134,6 +158,10 @@ const SpendingAmount = ({
134158 } ;
135159
136160 const onContinue = async ( ) : Promise < void > => {
161+ if ( checkFeeMinimum ( ) ) {
162+ return ;
163+ }
164+
137165 setLoading ( true ) ;
138166
139167 const lspBalance = Math . max ( defaultLspBalance , minLspBalance ) ;
0 commit comments