lnbits-legend/lnbits/wallets/__init__.py

41 lines
1.1 KiB
Python
Raw Normal View History

from __future__ import annotations
# flake8: noqa: F401
import importlib
from typing import Optional
from lnbits.settings import settings
from lnbits.wallets.base import Wallet
2022-07-31 23:51:57 +01:00
from .cliche import ClicheWallet
2023-03-08 11:00:57 +01:00
from .cln import CoreLightningWallet
from .cln import CoreLightningWallet as CLightningWallet
2022-04-29 11:39:27 +01:00
from .eclair import EclairWallet
from .fake import FakeWallet
2020-05-04 17:34:53 +02:00
from .lnbits import LNbitsWallet
from .lndgrpc import LndWallet
2020-04-25 22:11:27 +01:00
from .lndrest import LndRestWallet
2022-04-29 11:39:27 +01:00
from .lnpay import LNPayWallet
from .lntips import LnTipsWallet
2022-04-29 11:39:27 +01:00
from .opennode import OpenNodeWallet
2020-08-29 12:23:01 -03:00
from .spark import SparkWallet
2022-04-29 11:39:27 +01:00
from .void import VoidWallet
def set_wallet_class(class_name: Optional[str] = None):
backend_wallet_class = class_name or settings.lnbits_backend_wallet_class
wallet_class = getattr(wallets_module, backend_wallet_class)
global WALLET
WALLET = wallet_class()
def get_wallet_class() -> Wallet:
return WALLET
wallets_module = importlib.import_module("lnbits.wallets")
FAKE_WALLET: Wallet = FakeWallet()
# initialize as fake wallet
WALLET: Wallet = FAKE_WALLET