diff --git a/cashu/wallet/cli/cli.py b/cashu/wallet/cli/cli.py index ccfc14b6..2a39a41f 100644 --- a/cashu/wallet/cli/cli.py +++ b/cashu/wallet/cli/cli.py @@ -754,7 +754,9 @@ async def pending(ctx: Context, legacy, number: int, offset: int): ) print(f"Legacy token: {token_legacy}\n") print("--------------------------\n") - print("To remove all spent tokens use: cashu burn -a") + print("To remove all pending tokens that are already spent use: cashu burn -a") + print("To remove a specific pending token use: cashu burn ") + print("To receive all pending tokens use: cashu receive -a") @cli.command("lock", help="Generate receiving lock.") diff --git a/cashu/wallet/cli/cli_helpers.py b/cashu/wallet/cli/cli_helpers.py index 7d16cd5a..1e146ca3 100644 --- a/cashu/wallet/cli/cli_helpers.py +++ b/cashu/wallet/cli/cli_helpers.py @@ -7,7 +7,7 @@ from click import Context from loguru import logger -from ...core.base import TokenV4, Unit +from ...core.base import Unit from ...core.settings import settings from ...wallet.crud import ( get_keysets, @@ -15,6 +15,7 @@ ) from ...wallet.wallet import Wallet as Wallet from ..helpers import ( + deserialize_token_from_string, receive, ) @@ -193,8 +194,9 @@ async def receive_all_pending(ctx: Context, wallet: Wallet): proofs = list(value) mint_url, unit = await wallet._get_proofs_mint_unit(proofs) mint_wallet = await Wallet.with_db( - mint_url, - os.path.join(settings.cashu_dir, wallet.name), + url=mint_url, + db=os.path.join(settings.cashu_dir, wallet.name), + name=wallet.name, unit=unit.name, ) # verify that we trust the mint of this token @@ -202,14 +204,15 @@ async def receive_all_pending(ctx: Context, wallet: Wallet): await verify_mint(mint_wallet, mint_url) token = await mint_wallet.serialize_proofs(proofs) - token_obj = TokenV4.deserialize(token) + token_obj = deserialize_token_from_string(token) mint_url = token_obj.mint receive_wallet = await receive(mint_wallet, token_obj) ctx.obj["WALLET"] = receive_wallet except Exception as e: if mint_url and token_obj: + unit = Unit[token_obj.unit] print( - f"Could not receive {token_obj.amount} from mint {mint_url}: {str(e)}" + f"Could not receive {unit.str(token_obj.amount)} from mint {mint_url}: {str(e)}" ) else: print(f"Could not receive token: {str(e)}")