Core: add internal flag for invoice creation to use FakeWallet (#646)

* add internal flag for invoice creation to use FakeWallet
This commit is contained in:
calle
2022-07-17 14:34:25 +02:00
committed by GitHub
parent d4c30a1091
commit 6646fce549
6 changed files with 45 additions and 12 deletions
+7 -1
View File
@@ -5,6 +5,7 @@ from datetime import datetime
from os import getenv
from typing import AsyncGenerator, Dict, Optional
from environs import Env # type: ignore
from loguru import logger
from lnbits.helpers import urlsafe_short_hash
@@ -18,6 +19,9 @@ from .base import (
Wallet,
)
env = Env()
env.read_env()
class FakeWallet(Wallet):
async def status(self) -> StatusResponse:
@@ -32,7 +36,9 @@ class FakeWallet(Wallet):
memo: Optional[str] = None,
description_hash: Optional[bytes] = None,
) -> InvoiceResponse:
secret = getenv("FAKE_WALLET_SECRET")
# we set a default secret since FakeWallet is used for internal=True invoices
# and the user might not have configured a secret yet
secret = env.str("FAKE_WALLET_SECTRET", default="ToTheMoon1")
data: Dict = {
"out": False,
"amount": amount,