@@ -37,25 +37,26 @@ function ConfirmPayment() {
3737 const paymentRequest = navState . args ?. paymentRequest as string ;
3838 const invoice = lightningPayReq . decode ( paymentRequest ) ;
3939
40+ const amountSat =
41+ invoice . satoshis || Number ( invoice . millisatoshis ) / 1000 || 0 ;
42+
4043 const navigate = useNavigate ( ) ;
4144 const auth = useAccount ( ) ;
4245
43- const [ budget , setBudget ] = useState (
44- ( ( invoice . satoshis || 0 ) * 10 ) . toString ( )
45- ) ;
46+ const [ budget , setBudget ] = useState ( ( amountSat * 10 ) . toString ( ) ) ;
4647 const [ fiatAmount , setFiatAmount ] = useState ( "" ) ;
4748 const [ fiatBudgetAmount , setFiatBudgetAmount ] = useState ( "" ) ;
4849
49- const formattedInvoiceSats = getFormattedSats ( invoice . satoshis || 0 ) ;
50+ const formattedInvoiceSats = getFormattedSats ( amountSat ) ;
5051
5152 useEffect ( ( ) => {
5253 ( async ( ) => {
53- if ( showFiat && invoice . satoshis ) {
54- const res = await getFormattedFiat ( invoice . satoshis ) ;
54+ if ( showFiat && amountSat !== 0 ) {
55+ const res = await getFormattedFiat ( amountSat ) ;
5556 setFiatAmount ( res ) ;
5657 }
5758 } ) ( ) ;
58- } , [ invoice . satoshis , showFiat , getFormattedFiat ] ) ;
59+ } , [ amountSat , showFiat , getFormattedFiat ] ) ;
5960
6061 useEffect ( ( ) => {
6162 ( async ( ) => {
@@ -150,7 +151,7 @@ function ConfirmPayment() {
150151 < div className = "my-4" >
151152 < div className = "mb-4 p-4 shadow bg-white dark:bg-surface-02dp rounded-lg" >
152153 < PaymentSummary
153- amount = { invoice . satoshis || "0" } // TODO: allow entering amount or do not allow zero-amount invoices
154+ amount = { amountSat } // TODO: allow entering amount or do not allow zero-amount invoices
154155 fiatAmount = { fiatAmount }
155156 description = { invoice . tagsObject . description }
156157 />
0 commit comments