From 97cdc0dbcd4832152eefd060681ddad24f98a866 Mon Sep 17 00:00:00 2001 From: Shroominic Date: Sun, 17 Aug 2025 16:59:21 -0300 Subject: [PATCH] fix msat balance convertsion --- routstr/wallet.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/routstr/wallet.py b/routstr/wallet.py index 83acbdba..4543ce35 100644 --- a/routstr/wallet.py +++ b/routstr/wallet.py @@ -234,6 +234,8 @@ async def fetch_all_balances( ) proofs = await slow_filter_spend_proofs(proofs, wallet) user_balance = await db.balances_for_mint_and_unit(session, mint_url, unit) + if unit == "sat": + user_balance = user_balance // 1000 proofs_balance = sum(proof.amount for proof in proofs) result: BalanceDetail = { @@ -317,12 +319,14 @@ async def periodic_payout() -> None: user_balance = await db.balances_for_mint_and_unit( session, mint_url, unit ) + if unit == "sat": + user_balance = user_balance // 1000 proofs_balance = sum(proof.amount for proof in proofs) available_balance = proofs_balance - user_balance print(f"Balance: {proofs_balance} {unit}") print(f"User balance: {user_balance} {unit}") print(f"Available balance: {available_balance} {unit}") - min_amount = 5 if unit == "sat" else 5000 + min_amount = 210 if unit == "sat" else 210000 if proofs_balance > min_amount: amount_received = await raw_send_to_lnurl( wallet, proofs, RECEIVE_LN_ADDRESS, unit