diff --git a/cashu/wallet/cli/cli.py b/cashu/wallet/cli/cli.py index a75ed6c..800f704 100644 --- a/cashu/wallet/cli/cli.py +++ b/cashu/wallet/cli/cli.py @@ -263,6 +263,7 @@ async def pay( await wallet.load_mint() await print_balance(ctx) payment_hash = bolt11.decode(invoice).payment_hash + amount_mpp_msat = None if amount: # we assume `amount` to be in sats amount_mpp_msat = amount * 1000 diff --git a/tests/test_wallet_cli.py b/tests/test_wallet_cli.py index 94cce01..5283ba2 100644 --- a/tests/test_wallet_cli.py +++ b/tests/test_wallet_cli.py @@ -9,7 +9,13 @@ from cashu.core.base import TokenV4 from cashu.core.settings import settings from cashu.wallet.cli.cli import cli from cashu.wallet.wallet import Wallet -from tests.helpers import is_deprecated_api_only, is_fake, is_regtest, pay_if_regtest +from tests.helpers import ( + get_real_invoice, + is_deprecated_api_only, + is_fake, + is_regtest, + pay_if_regtest, +) @pytest.fixture(autouse=True, scope="session") @@ -113,6 +119,20 @@ def test_balance(cli_prefix): assert result.exit_code == 0 +@pytest.mark.skipif(is_fake, reason="only works with FakeWallet") +def test_pay_invoice_regtest(mint, cli_prefix): + invoice_dict = get_real_invoice(10) + invoice_payment_request = invoice_dict["payment_request"] + runner = CliRunner() + result = runner.invoke( + cli, + [*cli_prefix, "pay", invoice_payment_request, "-y"], + ) + assert result.exception is None + print("PAY INVOICE") + print(result.output) + + @pytest.mark.skipif(is_regtest, reason="only works with FakeWallet") def test_invoice(mint, cli_prefix): if settings.debug_mint_only_deprecated: