Merge branch 'auto-lnurlp-acct' into dev-pm
This commit is contained in:
commit
b5806533e6
1 changed files with 10 additions and 7 deletions
|
|
@ -50,7 +50,6 @@ async def create_user_account_no_ckeck(
|
|||
wallet_name: Optional[str] = None,
|
||||
default_exts: Optional[list[str]] = None,
|
||||
) -> User:
|
||||
|
||||
if account:
|
||||
account.validate_fields()
|
||||
if account.username and await get_account_by_username(account.username):
|
||||
|
|
@ -85,7 +84,9 @@ async def create_user_account_no_ckeck(
|
|||
await _create_default_pay_link(account, wallet)
|
||||
logger.info(f"Created default pay link for user {account.username}")
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to create default pay link for user {account.username}: {e}")
|
||||
logger.error(
|
||||
f"Failed to create default pay link for user {account.username}: {e}"
|
||||
)
|
||||
|
||||
user = await get_user_from_account(account)
|
||||
assert user, "Cannot find user for account."
|
||||
|
|
@ -200,23 +201,25 @@ async def _create_default_pay_link(account: Account, wallet) -> None:
|
|||
# Import here to avoid circular imports
|
||||
from lnbits.extensions.lnurlp.crud import create_pay_link
|
||||
from lnbits.extensions.lnurlp.models import CreatePayLinkData
|
||||
|
||||
|
||||
pay_link_data = CreatePayLinkData(
|
||||
description="Bitcoinmat Receiving Address",
|
||||
wallet=wallet.id,
|
||||
# Note default `currency` is satoshis when set as NULL in db
|
||||
min=1, # minimum 1 sat
|
||||
max=500000, # maximum 500,000 sats
|
||||
comment_chars=0,
|
||||
currency="sat", # use default satoshis
|
||||
username=account.username, # use the username as lightning address
|
||||
zaps=True,
|
||||
disposable=False,
|
||||
)
|
||||
|
||||
|
||||
await create_pay_link(pay_link_data)
|
||||
|
||||
|
||||
except ImportError as e:
|
||||
logger.warning(f"lnurlp extension not available for creating default pay link: {e}")
|
||||
logger.warning(
|
||||
f"lnurlp extension not available for creating default pay link: {e}"
|
||||
)
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to create default pay link: {e}")
|
||||
raise
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue