mirror of
https://github.com/aljazceru/nutshell.git
synced 2025-12-20 18:44:20 +01:00
nostr relay setting
This commit is contained in:
@@ -7,9 +7,10 @@ from environs import Env # type: ignore
|
|||||||
|
|
||||||
env = Env()
|
env = Env()
|
||||||
|
|
||||||
ENV_FILE = os.path.join(str(Path.home()), ".cashu", ".env")
|
# env file: default to current dir, else home dir
|
||||||
|
ENV_FILE = os.path.join(os.getcwd(), ".env")
|
||||||
if not os.path.isfile(ENV_FILE):
|
if not os.path.isfile(ENV_FILE):
|
||||||
ENV_FILE = os.path.join(os.getcwd(), ".env")
|
ENV_FILE = os.path.join(str(Path.home()), ".cashu", ".env")
|
||||||
if os.path.isfile(ENV_FILE):
|
if os.path.isfile(ENV_FILE):
|
||||||
env.read_env(ENV_FILE)
|
env.read_env(ENV_FILE)
|
||||||
else:
|
else:
|
||||||
@@ -53,6 +54,7 @@ LNBITS_ENDPOINT = env.str("LNBITS_ENDPOINT", default=None)
|
|||||||
LNBITS_KEY = env.str("LNBITS_KEY", default=None)
|
LNBITS_KEY = env.str("LNBITS_KEY", default=None)
|
||||||
|
|
||||||
NOSTR_PRIVATE_KEY = env.str("NOSTR_PRIVATE_KEY", default=None)
|
NOSTR_PRIVATE_KEY = env.str("NOSTR_PRIVATE_KEY", default=None)
|
||||||
|
NOSTR_RELAYS = env.list("NOSTR_RELAYS", default=["wss://nostr-pub.wellorder.net"])
|
||||||
|
|
||||||
MAX_ORDER = 64
|
MAX_ORDER = 64
|
||||||
VERSION = "0.7.0"
|
VERSION = "0.7.0"
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ from cashu.core.settings import (
|
|||||||
LIGHTNING,
|
LIGHTNING,
|
||||||
MINT_URL,
|
MINT_URL,
|
||||||
NOSTR_PRIVATE_KEY,
|
NOSTR_PRIVATE_KEY,
|
||||||
|
NOSTR_RELAYS,
|
||||||
SOCKS_HOST,
|
SOCKS_HOST,
|
||||||
SOCKS_PORT,
|
SOCKS_PORT,
|
||||||
TOR,
|
TOR,
|
||||||
@@ -551,7 +552,7 @@ async def nsend(ctx, amount: int, pubkey: str, verbose: bool, yes: bool):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# we only use ephemeral private keys for sending
|
# we only use ephemeral private keys for sending
|
||||||
client = NostrClient()
|
client = NostrClient(relays=NOSTR_RELAYS)
|
||||||
if verbose:
|
if verbose:
|
||||||
print(f"Your ephemeral nostr private key: {client.private_key.hex()}")
|
print(f"Your ephemeral nostr private key: {client.private_key.hex()}")
|
||||||
await asyncio.sleep(1)
|
await asyncio.sleep(1)
|
||||||
@@ -577,7 +578,7 @@ async def nreceive(ctx, verbose: bool):
|
|||||||
"Warning: No nostr private key set! You don't have NOSTR_PRIVATE_KEY set in your .env file. I will create a random private key for this session but I will not remember it."
|
"Warning: No nostr private key set! You don't have NOSTR_PRIVATE_KEY set in your .env file. I will create a random private key for this session but I will not remember it."
|
||||||
)
|
)
|
||||||
print("")
|
print("")
|
||||||
client = NostrClient(privatekey_hex=NOSTR_PRIVATE_KEY)
|
client = NostrClient(privatekey_hex=NOSTR_PRIVATE_KEY, relays=NOSTR_RELAYS)
|
||||||
print(f"Your nostr public key: {client.public_key.hex()}")
|
print(f"Your nostr public key: {client.public_key.hex()}")
|
||||||
if verbose:
|
if verbose:
|
||||||
print(f"Your nostr private key (do not share!): {client.private_key.hex()}")
|
print(f"Your nostr private key (do not share!): {client.private_key.hex()}")
|
||||||
@@ -646,6 +647,7 @@ async def info(ctx):
|
|||||||
if NOSTR_PRIVATE_KEY:
|
if NOSTR_PRIVATE_KEY:
|
||||||
client = NostrClient(privatekey_hex=NOSTR_PRIVATE_KEY, connect=False)
|
client = NostrClient(privatekey_hex=NOSTR_PRIVATE_KEY, connect=False)
|
||||||
print(f"Nostr public key: {client.public_key.hex()}")
|
print(f"Nostr public key: {client.public_key.hex()}")
|
||||||
|
print(f"Nostr relays: {NOSTR_RELAYS}")
|
||||||
if SOCKS_HOST:
|
if SOCKS_HOST:
|
||||||
print(f"Socks proxy: {SOCKS_HOST}:{SOCKS_PORT}")
|
print(f"Socks proxy: {SOCKS_HOST}:{SOCKS_PORT}")
|
||||||
print(f"Mint URL: {ctx.obj['HOST']}")
|
print(f"Mint URL: {ctx.obj['HOST']}")
|
||||||
|
|||||||
BIN
cashu/wallet/wallet_live/.DS_Store
vendored
BIN
cashu/wallet/wallet_live/.DS_Store
vendored
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user