diff --git a/cashu/wallet/cli.py b/cashu/wallet/cli.py index 62f6ee1..f6beff8 100755 --- a/cashu/wallet/cli.py +++ b/cashu/wallet/cli.py @@ -160,9 +160,17 @@ async def pay(ctx, invoice: str, yes: bool): @cli.command("balance", help="Balance.") +@click.option( + "--verbose", + "-v", + default=False, + is_flag=True, + help="Show pending tokens as well.", + type=bool, +) @click.pass_context @coro -async def balance(ctx): +async def balance(ctx, verbose): wallet: Wallet = ctx.obj["WALLET"] keyset_balances = wallet.balance_per_keyset() if len(keyset_balances) > 1: @@ -173,9 +181,12 @@ async def balance(ctx): f"Keyset: {k or 'undefined'} Balance: {v['balance']} sat (available: {v['available']} sat)" ) print("") - print( - f"Balance: {wallet.balance} sat (available: {wallet.available_balance} sat in {len([p for p in wallet.proofs if not p.reserved])} tokens)" - ) + if verbose: + print( + f"Balance: {wallet.balance} sat (available: {wallet.available_balance} sat in {len([p for p in wallet.proofs if not p.reserved])} tokens)" + ) + else: + print(f"Balance: {wallet.available_balance} sat") @cli.command("send", help="Send coins.") diff --git a/cashu/wallet/wallet.py b/cashu/wallet/wallet.py index fd92d9c..c01869f 100644 --- a/cashu/wallet/wallet.py +++ b/cashu/wallet/wallet.py @@ -552,9 +552,10 @@ class Wallet(LedgerAPI): return sum_proofs([p for p in self.proofs if not p.reserved]) def status(self): - print( - f"Balance: {self.balance} sat (available: {self.available_balance} sat in {len([p for p in self.proofs if not p.reserved])} tokens)" - ) + # print( + # f"Balance: {self.balance} sat (available: {self.available_balance} sat in {len([p for p in self.proofs if not p.reserved])} tokens)" + # ) + print(f"Balance: {self.available_balance} sat") def balance_per_keyset(self): return {