@@ -112,7 +112,9 @@ export function SupportPanel({
112112 const parsedAmt = parseFloat ( amount ) ;
113113 const validAmount = ! isNaN ( parsedAmt ) && parsedAmt > 0 ;
114114 const parsedBal = balance ? parseFloat ( balance ) : 0 ;
115- const overBalance = validAmount && parsedAmt + FEE_IN_XLM > parsedBal ;
115+ const overBalance = isXlmPayment
116+ ? validAmount && parsedAmt + FEE_IN_XLM > parsedBal
117+ : validAmount && parsedAmt > parsedBal ;
116118 if ( ! visitorAddress || ! validAmount || overBalance || sending ) return ;
117119
118120 const walletId = (
@@ -273,6 +275,13 @@ export function SupportPanel({
273275 const isValidAmount = hasValidAmount ;
274276 const recipientAsset = { code : "XLM" } ;
275277
278+ const isXlmPayment = paymentAsset . code === "XLM" ;
279+ const xlmBalance = parseFloat (
280+ visitorBalances . find ( ( b ) => b . asset_type === "native" ) ?. balance ?? "0"
281+ ) ;
282+ const insufficientXlmForFee =
283+ ! isXlmPayment && hasValidAmount && xlmBalance < FEE_IN_XLM ;
284+
276285 if ( ! visitorAddress ) {
277286 return (
278287 < section className = "rounded-[2rem] border border-gold/25 bg-gold/10 p-7 text-center" >
@@ -659,10 +668,19 @@ export function SupportPanel({
659668 </ div >
660669 ) }
661670
671+ { insufficientXlmForFee && (
672+ < div className = "mt-4 rounded-2xl border border-red-500/20 bg-red-500/5 p-3" >
673+ < p className = "text-xs text-red-400" >
674+ Insufficient XLM balance. You need at least { FEE_IN_XLM . toFixed ( 7 ) } { " " }
675+ XLM in your wallet to pay the Stellar network fee.
676+ </ p >
677+ </ div >
678+ ) }
679+
662680 < button
663681 type = "button"
664682 onClick = { handleSend }
665- disabled = { ! hasValidAmount || insufficientBalance || sending }
683+ disabled = { ! hasValidAmount || insufficientBalance || insufficientXlmForFee || sending }
666684 className = "mt-6 w-full rounded-lg bg-mint px-4 py-3 text-sm font-semibold text-black hover:bg-mint/90 transition-colors disabled:opacity-30 disabled:cursor-not-allowed"
667685 >
668686 { sending ? "Sending…" : "Send Support" }
0 commit comments