mirror of
https://github.com/believethehype/nostrdvm.git
synced 2025-03-18 05:41:51 +01:00
melt on startup
This commit is contained in:
parent
723159b41f
commit
8ccd902e60
@ -10,6 +10,7 @@ from nostr_dvm.utils.nip88_utils import nip88_announce_tier, fetch_nip88_paramet
|
||||
check_and_set_tiereventid_nip88
|
||||
from nostr_dvm.utils.nip89_utils import nip89_announce_tasks, fetch_nip89_parameters_for_deletion
|
||||
from nostr_dvm.utils.nostr_utils import update_profile
|
||||
from nostr_dvm.utils.nut_wallet_utils import NutZapWallet
|
||||
|
||||
|
||||
class AdminConfig:
|
||||
@ -26,6 +27,7 @@ class AdminConfig:
|
||||
DELETEUSER: bool = False
|
||||
LISTDATABASE: bool = False
|
||||
ClEANDB: bool = False
|
||||
MELT_ON_STARTUP: bool = False
|
||||
POW: bool = False
|
||||
INDEX: str = "1"
|
||||
LUD16: str = ""
|
||||
@ -84,12 +86,23 @@ async def admin_make_database_updates(adminconfig: AdminConfig = None, dvmconfig
|
||||
if adminconfig.DELETEUSER:
|
||||
delete_from_sql_table(db, publickey)
|
||||
|
||||
|
||||
|
||||
if adminconfig.ClEANDB:
|
||||
clean_db(db)
|
||||
|
||||
if adminconfig.LISTDATABASE:
|
||||
list_db(db)
|
||||
|
||||
if adminconfig.MELT_ON_STARTUP:
|
||||
nutzap_wallet = NutZapWallet()
|
||||
keys = Keys.parse(adminconfig.PRIVKEY)
|
||||
nut_wallet = await nutzap_wallet.get_nut_wallet(client, keys)
|
||||
lud16 = adminconfig.LUD16
|
||||
npub = keys.public_key().to_hex()
|
||||
await nutzap_wallet.melt_cashu(nut_wallet, DVMConfig.NUZAP_MINTS[0], nut_wallet.balance, client, keys, lud16, npub)
|
||||
await nutzap_wallet.get_nut_wallet(client, keys)
|
||||
|
||||
if adminconfig.REBROADCAST_NIP89:
|
||||
await nip89_announce_tasks(dvmconfig, client=client)
|
||||
|
||||
|
@ -56,6 +56,8 @@ def build_dalle(name, identifier):
|
||||
aconfig = AdminConfig()
|
||||
aconfig.REBROADCAST_NIP89 = False # We add an optional AdminConfig for this one, and tell the dvm to rebroadcast its NIP89
|
||||
aconfig.LUD16 = dvm_config.LN_ADDRESS
|
||||
aconfig.PRIVKEY = dvm_config.PRIVATE_KEY
|
||||
aconfig.MELT_ON_STARTUP = False # set this to true to melt cashu tokens to our ln address on startup
|
||||
return ImageGenerationDALLE(name=name, dvm_config=dvm_config, nip89config=nip89config, admin_config=aconfig)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user