From ce24fd728be692b5c33ce26a7fdb5abd349fa6b5 Mon Sep 17 00:00:00 2001 From: 9qeklajc <9qeklajc> Date: Mon, 30 Jun 2025 15:27:09 +0200 Subject: [PATCH] add currency env var --- .env.example | 1 + router/cashu.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index cb0da3d7..f56007ee 100644 --- a/.env.example +++ b/.env.example @@ -47,3 +47,4 @@ ONION_URL="XXX.onion" RELAYS="wss://relay.damus.io,wss://relay.primal.net,wss://relay.snort.social,wss://relay.nostr.band" CASHU_MINTS="https://mint.minibits.cash/Bitcoin,https://mint.cubabitcoin.org" +CURRENCY = "" diff --git a/router/cashu.py b/router/cashu.py index ce4d9d1c..2b4842c4 100644 --- a/router/cashu.py +++ b/router/cashu.py @@ -1,8 +1,10 @@ import asyncio import os import time +from typing import cast from sixty_nuts import Wallet +from sixty_nuts.mint import CurrencyUnit from sqlmodel import col, func, select, update from .db import ApiKey, AsyncSession, get_session @@ -15,13 +17,14 @@ PAYOUT_INTERVAL = int(os.environ.get("PAYOUT_INTERVAL", 300)) # Default 5 minut DEV_LN_ADDRESS = "routstr@minibits.cash" DEVS_DONATION_RATE = float(os.environ.get("DEVS_DONATION_RATE", 0.021)) # 2.1% NSEC = os.environ["NSEC"] # Nostr private key for the wallet +CURRENCY = cast(CurrencyUnit, os.environ.get("CURRENCY", "sat")) WALLET: Wallet | None = None async def init_wallet() -> None: global WALLET - WALLET = await Wallet.create(nsec=NSEC, mint_urls=[MINT], currency="msat") + WALLET = await Wallet.create(nsec=NSEC, mint_urls=[MINT], currency=CURRENCY) def wallet() -> Wallet: