-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmanual_wallet.py
31 lines (25 loc) · 1.05 KB
/
manual_wallet.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import requests
import json
class LightningWallet:
def __init__(self):
try:
with open('./internal_data/wallet.json') as json_file:
data = json.load(json_file)
self.balance = data["balance"]
except:
with open('./internal_data/wallet.json',"w") as json_file:
balance = int(input("Your balance in sats: "))
self.balance = balance
print("Thanks! You can update your balance in the file 'wallet.json' later.")
json.dump({"balance":balance}, json_file)
def get_balance(self) -> int:
return self.balance
def pay(self,payment_request):
print("Please pay this payment request.")
print(payment_request)
user_input = ""
while user_input != "y":
user_input = input("Payment made successfully (y/n): ")
def create_invoice(self,amount):
invoice = input("Please input a invoice with a amount of {} sats: ".format(amount))
return invoice