mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-02-25 07:07:48 +01:00
* initial scaffolding, methods for getalby wallet
* Add getAlby to docs and i18n
* update alby wallet methods
* change names from GetAlbyWallet to AlbyWallet
* remove unused variables in AlbyFundingSource in settings.py
* rename getalby.py to alby.py
* fix method auth and status
* resolve rolznz commented issues
* rename ALBY_API_KEY to ALBY_ACCESS_TOKEN
* fix desc hash in create_invoice
---------
Co-authored-by: Pavol Rusnak <pavol@rusnak.io>
Co-authored-by: dni ⚡ <office@dnilabs.com>
47 lines
1.4 KiB
Python
47 lines
1.4 KiB
Python
from __future__ import annotations
|
|
|
|
import importlib
|
|
from typing import Optional
|
|
|
|
from lnbits.nodes import set_node_class
|
|
from lnbits.settings import settings
|
|
from lnbits.wallets.base import Wallet
|
|
|
|
from .alby import AlbyWallet
|
|
from .cliche import ClicheWallet
|
|
from .corelightning import CoreLightningWallet
|
|
|
|
# The following import is intentional to keep backwards compatibility
|
|
# for old configs that called it CLightningWallet. Do not remove.
|
|
from .corelightning import CoreLightningWallet as CLightningWallet
|
|
from .corelightningrest import CoreLightningRestWallet
|
|
from .eclair import EclairWallet
|
|
from .fake import FakeWallet
|
|
from .lnbits import LNbitsWallet
|
|
from .lndgrpc import LndWallet
|
|
from .lndrest import LndRestWallet
|
|
from .lnpay import LNPayWallet
|
|
from .lntips import LnTipsWallet
|
|
from .opennode import OpenNodeWallet
|
|
from .spark import SparkWallet
|
|
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()
|
|
if WALLET.__node_cls__:
|
|
set_node_class(WALLET.__node_cls__(WALLET))
|
|
|
|
|
|
def get_wallet_class() -> Wallet:
|
|
return WALLET
|
|
|
|
|
|
wallets_module = importlib.import_module("lnbits.wallets")
|
|
FAKE_WALLET = FakeWallet()
|
|
|
|
# initialize as fake wallet
|
|
WALLET: Wallet = FAKE_WALLET
|