diff --git a/cashu/wallet/cli.py b/cashu/wallet/cli.py index 29aa9e5..9f586a6 100644 --- a/cashu/wallet/cli.py +++ b/cashu/wallet/cli.py @@ -73,7 +73,7 @@ class NaturalOrderGroup(click.Group): @click.pass_context def cli(ctx, host: str, walletname: str): if TOR and not TorProxy().check_platform(): - error_str = "Your settings say TOR=true but the built-in Tor bundle is not supported on your system. Please install Tor manually and set TOR=false and SOCKS_HOST=localhost and SOCKS_PORT=9050 in your Cashu config (recommended) or turn off Tor by setting TOR=false (not recommended). Cashu will not work until you edit your config file accordingly." + error_str = "Your settings say TOR=true but the built-in Tor bundle is not supported on your system. You have two options: Either install Tor manually and set TOR=FALSE and SOCKS_HOST=localhost and SOCKS_PORT=9050 in your Cashu config (recommended). Or turn off Tor by setting TOR=false (not recommended). Cashu will not work until you edit your config file accordingly." error_str += "\n\n" if ENV_FILE: error_str += f"Edit your Cashu config file here: {ENV_FILE}" @@ -83,7 +83,7 @@ def cli(ctx, host: str, walletname: str): f"Ceate a new Cashu config file here: {os.path.join(CASHU_DIR, '.env')}" ) env_path = os.path.join(CASHU_DIR, ".env") - error_str += f'\n\nYou can turn off Tor with this command: echo "TOR=false" >> {env_path}' + error_str += f'\n\nYou can turn off Tor with this command: echo "TOR=FALSE" >> {env_path}' raise Exception(error_str) # configure logger @@ -203,13 +203,14 @@ async def balance(ctx, verbose): print("") for k, v in keyset_balances.items(): print( - f"Keyset: {k or 'undefined'} - Balance: {v['available']} sat (with pending: {v['balance']} sat)" + f"Keyset: {k} - Balance: {v['available']} sat (pending: {v['balance']-v['available']} sat)" ) print("") + # get balances per mint mint_balances = await wallet.balance_per_minturl() - # if we have a balance on a non-default mint + # if we have a balance on a non-default mint, we show its URL show_mints = False keysets = [k for k, v in wallet.balance_per_keyset().items()] for k in keysets: @@ -224,13 +225,13 @@ async def balance(ctx, verbose): print("") for k, v in mint_balances.items(): print( - f"Mint: {k or 'undefined'} - Balance: {v['available']} sat (with pending: {v['balance']} sat)" + f"Mint: {k} - Balance: {v['available']} sat (pending: {v['balance']-v['available']} sat)" ) print("") 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)" + f"Balance: {wallet.available_balance} sat (pending: {wallet.balance-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") diff --git a/cashu/wallet/cli_helpers.py b/cashu/wallet/cli_helpers.py index 37dec55..0fe3a8a 100644 --- a/cashu/wallet/cli_helpers.py +++ b/cashu/wallet/cli_helpers.py @@ -15,7 +15,7 @@ async def verify_mints(ctx, dtoken): keyset_wallet = Wallet( mint_url, os.path.join(CASHU_DIR, ctx.obj["WALLET_NAME"]) ) - # make sure that this mint indeed supports this keyset + # make sure that this mint supports this keyset mint_keysets = await keyset_wallet._get_keysets(mint_url) assert keyset in mint_keysets["keysets"], "mint does not have this keyset." @@ -23,19 +23,21 @@ async def verify_mints(ctx, dtoken): mint_keyset = await keyset_wallet._get_keyset(mint_url, keyset) assert keyset == mint_keyset.id, Exception("keyset not valid.") - # we check the db whether we know this keyset already and ask the user - mint_keysets = await get_keyset(id=keyset, db=keyset_wallet.db) + # we check the db whether we know this mint already and ask the user if not + mint_keysets = await get_keyset(mint_url=mint_url, db=keyset_wallet.db) if mint_keysets is None: # we encountered a new mint and ask for a user confirmation trust_token_mints = False print("") - print("Warning: Tokens are from a mint or keyset you don't know yet.") + print( + "Warning: Tokens are from a mint you don't know yet. Make sure that you know this mint." + ) print("\n") print(f"Mint URL: {mint_url}") print(f"Mint keyset: {keyset}") print("\n") click.confirm( - f"Do you want to trust this mint and receive the tokens?", + f"Do you trust this mint and want to receive the tokens?", abort=True, default=True, ) diff --git a/cashu/wallet/wallet.py b/cashu/wallet/wallet.py index a207f9e..055cbd8 100644 --- a/cashu/wallet/wallet.py +++ b/cashu/wallet/wallet.py @@ -66,8 +66,8 @@ class LedgerAPI: def _set_requests(self): s = requests.Session() s.headers.update({"Client-version": VERSION}) - if DEBUG: - s.verify = False + # if DEBUG: + # s.verify = False socks_host, socks_port = None, None if TOR and TorProxy().check_platform(): self.tor = TorProxy(timeout=True)