@@ -3,11 +3,13 @@ import {
33 createPayRequestUrl ,
44 createWithdrawCallbackUrl ,
55 lnurlAuth as lnAuth ,
6+ } from '@synonymdev/react-native-lnurl' ;
7+ import {
68 LNURLAuthParams ,
79 LNURLChannelParams ,
810 LNURLPayParams ,
911 LNURLWithdrawParams ,
10- } from '@synonymdev/react-native -lnurl' ;
12+ } from 'js -lnurl' ;
1113import { err , ok , Result } from '@synonymdev/result' ;
1214
1315import {
@@ -273,7 +275,7 @@ export const handleLnurlWithdraw = async ({
273275 selectedNetwork = getSelectedNetwork ( ) ;
274276 }
275277
276- const amountSats = params . maxWithdrawable / 1000 ; //Convert msats to sats.
278+ const amountSats = Math . floor ( params . maxWithdrawable / 1000 ) ; //Convert msats to sats.
277279 const description = params . defaultDescription ;
278280
279281 // Determine if we have enough receiving capacity before proceeding.
@@ -328,6 +330,15 @@ export const handleLnurlWithdraw = async ({
328330 return err ( 'Unable to connect to LNURL withdraw server.' ) ;
329331 }
330332
333+ const jsonRes = await channelStatusRes . json ( ) ;
334+ if ( jsonRes . status === 'ERROR' ) {
335+ showErrorNotification ( {
336+ title : i18n . t ( 'other:lnurl_withdr_error' ) ,
337+ message : jsonRes . reason ,
338+ } ) ;
339+ return err ( jsonRes . reason ) ;
340+ }
341+
331342 showSuccessNotification ( {
332343 title : i18n . t ( 'other:lnurl_withdr_success_title' ) ,
333344 message : i18n . t ( 'other:lnurl_withdr_success_msg' ) ,
0 commit comments