Fake wallet working

This commit is contained in:
Ben Arc 2022-01-31 11:07:29 +00:00
parent a147a07bab
commit 7c3b3ac200
2 changed files with 13 additions and 8 deletions

View File

@ -72,3 +72,7 @@ LNTXBOT_KEY=LNTXBOT_ADMIN_KEY
# OpenNodeWallet # OpenNodeWallet
OPENNODE_API_ENDPOINT=https://api.opennode.com/ OPENNODE_API_ENDPOINT=https://api.opennode.com/
OPENNODE_KEY=OPENNODE_ADMIN_KEY OPENNODE_KEY=OPENNODE_ADMIN_KEY
# FakeWallet
FAKE_WALLET_KEY=E9873D79C6D87DC0FB6A5778633389F4453213303DA61F20BD67FC233AA33262
FAKE_WALLET_ADMIN=""

View File

@ -8,7 +8,7 @@ import random
import string import string
from lnbits.helpers import urlsafe_short_hash from lnbits.helpers import urlsafe_short_hash
import hashlib import hashlib
from ..bolt11 import encode from ..bolt11 import encode, decode
from .base import ( from .base import (
StatusResponse, StatusResponse,
InvoiceResponse, InvoiceResponse,
@ -62,19 +62,20 @@ class FakeWallet(Wallet):
async def pay_invoice(self, bolt11: str) -> PaymentResponse: async def pay_invoice(self, bolt11: str) -> PaymentResponse:
invoice = decode(bolt11)
return "" return PaymentResponse(True, invoice.payment_hash, 0)
async def get_invoice_status(self, checking_id: str) -> PaymentStatus: async def get_invoice_status(self, checking_id: str) -> PaymentStatus:
return PaymentStatus(True)
return ""
async def get_payment_status(self, checking_id: str) -> PaymentStatus: async def get_payment_status(self, checking_id: str) -> PaymentStatus:
return PaymentStatus(True)
return ""
async def paid_invoices_stream(self) -> AsyncGenerator[str, None]: async def paid_invoices_stream(self) -> AsyncGenerator[str, None]:
yield "" self.queue = asyncio.Queue(0)
while True:
value = await self.queue.get()
yield value
# invoice = "lnbc" # invoice = "lnbc"