From 8b7028d728f70e2f26db3d0cd39af882680a6ee0 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Thu, 3 Sep 2020 21:43:32 -0300 Subject: [PATCH] add VoidWallet and make it the default. --- lnbits/settings.py | 2 +- lnbits/wallets/__init__.py | 1 + lnbits/wallets/void.py | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 lnbits/wallets/void.py diff --git a/lnbits/settings.py b/lnbits/settings.py index 219934365..419549a78 100644 --- a/lnbits/settings.py +++ b/lnbits/settings.py @@ -3,7 +3,7 @@ import os wallets_module = importlib.import_module("lnbits.wallets") -wallet_class = getattr(wallets_module, os.getenv("LNBITS_BACKEND_WALLET_CLASS", "LntxbotWallet")) +wallet_class = getattr(wallets_module, os.getenv("LNBITS_BACKEND_WALLET_CLASS", "VoidWallet")) LNBITS_PATH = os.path.dirname(os.path.realpath(__file__)) LNBITS_DATA_FOLDER = os.getenv("LNBITS_DATA_FOLDER", os.path.join(LNBITS_PATH, "data")) diff --git a/lnbits/wallets/__init__.py b/lnbits/wallets/__init__.py index 263f5e03b..10a17c6fd 100644 --- a/lnbits/wallets/__init__.py +++ b/lnbits/wallets/__init__.py @@ -1,5 +1,6 @@ # flake8: noqa +from .void import VoidWallet from .clightning import CLightningWallet from .lndgrpc import LndWallet from .lntxbot import LntxbotWallet diff --git a/lnbits/wallets/void.py b/lnbits/wallets/void.py new file mode 100644 index 000000000..49f1eaee0 --- /dev/null +++ b/lnbits/wallets/void.py @@ -0,0 +1,19 @@ +from typing import Optional + +from .base import InvoiceResponse, PaymentResponse, PaymentStatus, Wallet, Unsupported + + +class VoidWallet(Wallet): + def create_invoice( + self, amount: int, memo: Optional[str] = None, description_hash: Optional[bytes] = None + ) -> InvoiceResponse: + raise Unsupported("") + + def pay_invoice(self, bolt11: str) -> PaymentResponse: + raise Unsupported("") + + def get_invoice_status(self, checking_id: str) -> PaymentStatus: + raise Unsupported("") + + def get_payment_status(self, checking_id: str) -> PaymentStatus: + raise Unsupported("")