feat: toggle holdinvoice depending on fundingsource Feature (#3262)
This commit is contained in:
parent
f91c933919
commit
5e9919c5c5
7 changed files with 9 additions and 2 deletions
|
|
@ -662,6 +662,7 @@
|
||||||
></q-input>
|
></q-input>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<q-input
|
<q-input
|
||||||
|
v-if="has_holdinvoice"
|
||||||
filled
|
filled
|
||||||
dense
|
dense
|
||||||
v-model="receive.data.payment_hash"
|
v-model="receive.data.payment_hash"
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,7 @@ def template_renderer(additional_folders: Optional[list] = None) -> Jinja2Templa
|
||||||
if settings.lnbits_denomination == "FakeWallet"
|
if settings.lnbits_denomination == "FakeWallet"
|
||||||
else "sats"
|
else "sats"
|
||||||
),
|
),
|
||||||
|
"has_holdinvoice": settings.has_holdinvoice,
|
||||||
}
|
}
|
||||||
|
|
||||||
t.env.globals["WINDOW_SETTINGS"] = window_settings
|
t.env.globals["WINDOW_SETTINGS"] = window_settings
|
||||||
|
|
|
||||||
|
|
@ -987,6 +987,7 @@ class TransientSettings(InstalledExtensionsSettings, ExchangeHistorySettings):
|
||||||
|
|
||||||
server_startup_time: int = Field(default=time())
|
server_startup_time: int = Field(default=time())
|
||||||
|
|
||||||
|
has_holdinvoice: bool = Field(default=False)
|
||||||
has_nodemanager: bool = Field(default=False)
|
has_nodemanager: bool = Field(default=False)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ def set_funding_source(class_name: str | None = None) -> None:
|
||||||
global funding_source
|
global funding_source
|
||||||
funding_source = funding_source_constructor()
|
funding_source = funding_source_constructor()
|
||||||
settings.has_nodemanager = funding_source.has_feature(Feature.nodemanager)
|
settings.has_nodemanager = funding_source.has_feature(Feature.nodemanager)
|
||||||
|
settings.has_holdinvoice = funding_source.has_feature(Feature.holdinvoice)
|
||||||
|
|
||||||
|
|
||||||
def get_funding_source() -> Wallet:
|
def get_funding_source() -> Wallet:
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ if TYPE_CHECKING:
|
||||||
|
|
||||||
class Feature(Enum):
|
class Feature(Enum):
|
||||||
nodemanager = "nodemanager"
|
nodemanager = "nodemanager"
|
||||||
# hold = "hold"
|
holdinvoice = "holdinvoice"
|
||||||
# bolt12 = "bolt12"
|
# bolt12 = "bolt12"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ from lnbits.utils.crypto import random_secret_and_hash
|
||||||
from lnbits.wallets.lnd_grpc_files.router_pb2_grpc import RouterStub
|
from lnbits.wallets.lnd_grpc_files.router_pb2_grpc import RouterStub
|
||||||
|
|
||||||
from .base import (
|
from .base import (
|
||||||
|
Feature,
|
||||||
InvoiceResponse,
|
InvoiceResponse,
|
||||||
PaymentFailedStatus,
|
PaymentFailedStatus,
|
||||||
PaymentPendingStatus,
|
PaymentPendingStatus,
|
||||||
|
|
@ -64,6 +65,8 @@ environ["GRPC_SSL_CIPHER_SUITES"] = "HIGH+ECDSA"
|
||||||
|
|
||||||
|
|
||||||
class LndWallet(Wallet):
|
class LndWallet(Wallet):
|
||||||
|
features = [Feature.holdinvoice]
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
if not settings.lnd_grpc_endpoint:
|
if not settings.lnd_grpc_endpoint:
|
||||||
raise ValueError("cannot initialize LndWallet: missing lnd_grpc_endpoint")
|
raise ValueError("cannot initialize LndWallet: missing lnd_grpc_endpoint")
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ class LndRestWallet(Wallet):
|
||||||
"""https://api.lightning.community/#lnd-rest-api-reference"""
|
"""https://api.lightning.community/#lnd-rest-api-reference"""
|
||||||
|
|
||||||
__node_cls__ = LndRestNode
|
__node_cls__ = LndRestNode
|
||||||
features = [Feature.nodemanager]
|
features = [Feature.nodemanager, Feature.holdinvoice]
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
if not settings.lnd_rest_endpoint:
|
if not settings.lnd_rest_endpoint:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue