File tree Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -228,6 +228,17 @@ def deposit(amount: int):
228
228
click .echo (f"\n \n Please pay invoice:\n { cli_quote .invoice } " )
229
229
230
230
click .echo (f"\n \n Please run safebox check invoice check to see if invoice is paid" )
231
+
232
+ @click .command (help = "withdraw funds from wallet via lightning invoice" )
233
+ @click .argument ('invoice' )
234
+
235
+ def withdraw (invoice : str ):
236
+ click .echo (f"invoice: { invoice } " )
237
+ wallet_obj = Wallet (nsec = NSEC , relays = RELAYS ,mints = MINTS ,home_relay = HOME_RELAY )
238
+ cli_out = wallet_obj .withdraw (invoice )
239
+ click .echo (cli_out )
240
+
241
+
231
242
232
243
@click .command (help = "Check for payment" )
233
244
@click .argument ('param' )
@@ -366,6 +377,7 @@ def accept(token):
366
377
367
378
368
379
cli .add_command (deposit )
380
+ cli .add_command (withdraw )
369
381
cli .add_command (proofs )
370
382
cli .add_command (balance )
371
383
cli .add_command (swap )
Original file line number Diff line number Diff line change @@ -867,7 +867,12 @@ def deposit(self, amount:int)->cliQuote:
867
867
868
868
return cliQuote (invoice = invoice , quote = quote )
869
869
# return f"Please pay invoice \n{invoice} \nfor quote: \n{quote}."
870
-
870
+ def withdraw (self , lninvoice :str ):
871
+
872
+ msg_out = self .pay_multi_invoice (lninvoice = lninvoice )
873
+
874
+ return msg_out
875
+
871
876
def add_proofs (self ,text , replicate_relays : List [str ]= None ):
872
877
# make sure have latest kind
873
878
print ("get rid of this function" )
@@ -988,7 +993,7 @@ def _load_proofs(self):
988
993
989
994
990
995
FILTER = [{
991
- 'limit' : 10 ,
996
+ 'limit' : 1024 ,
992
997
'authors' : [self .pubkey_hex ],
993
998
'kinds' : [self .wallet_config .kind_cashu ]
994
999
}]
@@ -1349,7 +1354,10 @@ def pay_multi_invoice( self,
1349
1354
comment : str = "Paid!" ):
1350
1355
1351
1356
# decode amount from invoice
1352
- ln_amount = int (bolt11 .decode (lninvoice ).amount_msat // 1e3 )
1357
+ try :
1358
+ ln_amount = int (bolt11 .decode (lninvoice ).amount_msat // 1e3 )
1359
+ except Exception as e :
1360
+ return f"error { e } "
1353
1361
1354
1362
print ("pay from multiple mints" )
1355
1363
available_amount = 0
You can’t perform that action at this time.
0 commit comments