mirror of
https://github.com/believethehype/nostrdvm.git
synced 2025-10-09 22:52:38 +02:00
melt on startup
This commit is contained in:
@@ -10,6 +10,7 @@ from nostr_dvm.utils.nip88_utils import nip88_announce_tier, fetch_nip88_paramet
|
|||||||
check_and_set_tiereventid_nip88
|
check_and_set_tiereventid_nip88
|
||||||
from nostr_dvm.utils.nip89_utils import nip89_announce_tasks, fetch_nip89_parameters_for_deletion
|
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.nostr_utils import update_profile
|
||||||
|
from nostr_dvm.utils.nut_wallet_utils import NutZapWallet
|
||||||
|
|
||||||
|
|
||||||
class AdminConfig:
|
class AdminConfig:
|
||||||
@@ -26,6 +27,7 @@ class AdminConfig:
|
|||||||
DELETEUSER: bool = False
|
DELETEUSER: bool = False
|
||||||
LISTDATABASE: bool = False
|
LISTDATABASE: bool = False
|
||||||
ClEANDB: bool = False
|
ClEANDB: bool = False
|
||||||
|
MELT_ON_STARTUP: bool = False
|
||||||
POW: bool = False
|
POW: bool = False
|
||||||
INDEX: str = "1"
|
INDEX: str = "1"
|
||||||
LUD16: str = ""
|
LUD16: str = ""
|
||||||
@@ -84,12 +86,23 @@ async def admin_make_database_updates(adminconfig: AdminConfig = None, dvmconfig
|
|||||||
if adminconfig.DELETEUSER:
|
if adminconfig.DELETEUSER:
|
||||||
delete_from_sql_table(db, publickey)
|
delete_from_sql_table(db, publickey)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if adminconfig.ClEANDB:
|
if adminconfig.ClEANDB:
|
||||||
clean_db(db)
|
clean_db(db)
|
||||||
|
|
||||||
if adminconfig.LISTDATABASE:
|
if adminconfig.LISTDATABASE:
|
||||||
list_db(db)
|
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:
|
if adminconfig.REBROADCAST_NIP89:
|
||||||
await nip89_announce_tasks(dvmconfig, client=client)
|
await nip89_announce_tasks(dvmconfig, client=client)
|
||||||
|
|
||||||
|
@@ -56,6 +56,8 @@ def build_dalle(name, identifier):
|
|||||||
aconfig = AdminConfig()
|
aconfig = AdminConfig()
|
||||||
aconfig.REBROADCAST_NIP89 = False # We add an optional AdminConfig for this one, and tell the dvm to rebroadcast its NIP89
|
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.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)
|
return ImageGenerationDALLE(name=name, dvm_config=dvm_config, nip89config=nip89config, admin_config=aconfig)
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user