mirror of
https://github.com/lnbits/lnbits.git
synced 2025-06-28 01:32:38 +02:00
mypy fakewallet, macaroon, bolt11 invoice
This commit is contained in:
parent
8901ff8084
commit
91c5a68ccc
@ -23,6 +23,7 @@ class Route(NamedTuple):
|
||||
|
||||
class Invoice(object):
|
||||
payment_hash: str
|
||||
checking_id: Optional[str] = None
|
||||
amount_msat: int = 0
|
||||
description: Optional[str] = None
|
||||
description_hash: Optional[str] = None
|
||||
|
@ -28,7 +28,7 @@ class FakeWallet(Wallet):
|
||||
logger.info(
|
||||
"FakeWallet funding source is for using LNbits as a centralised, stand-alone payment system with brrrrrr."
|
||||
)
|
||||
return StatusResponse(None, float("inf"))
|
||||
return StatusResponse(None, 1000000000)
|
||||
|
||||
async def create_invoice(
|
||||
self,
|
||||
@ -80,8 +80,12 @@ class FakeWallet(Wallet):
|
||||
|
||||
async def pay_invoice(self, bolt11: str, fee_limit_msat: int) -> PaymentResponse:
|
||||
invoice = decode(bolt11)
|
||||
# TODO: no data here?
|
||||
data: Dict = {
|
||||
"privkey": "missing"
|
||||
}
|
||||
if (
|
||||
hasattr(invoice, "checking_id")
|
||||
invoice.checking_id is not None
|
||||
and invoice.checking_id[6:] == data["privkey"][:6]
|
||||
):
|
||||
return PaymentResponse(True, invoice.payment_hash, 0)
|
||||
@ -97,7 +101,7 @@ class FakeWallet(Wallet):
|
||||
return PaymentStatus(None)
|
||||
|
||||
async def paid_invoices_stream(self) -> AsyncGenerator[str, None]:
|
||||
self.queue = asyncio.Queue(0)
|
||||
self.queue: asyncio.Queue = asyncio.Queue(0)
|
||||
while True:
|
||||
value = await self.queue.get()
|
||||
yield value
|
||||
|
@ -73,7 +73,7 @@ class AESCipher(object):
|
||||
final_key += key
|
||||
return final_key[:output]
|
||||
|
||||
def decrypt(self, encrypted: str) -> str:
|
||||
def decrypt(self, encrypted) -> str:
|
||||
"""Decrypts a string using AES-256-CBC."""
|
||||
passphrase = self.passphrase
|
||||
encrypted = base64.b64decode(encrypted)
|
||||
|
Loading…
x
Reference in New Issue
Block a user