diff --git a/cashu/wallet/api/router.py b/cashu/wallet/api/router.py index 0d7a1c72..c495b616 100644 --- a/cashu/wallet/api/router.py +++ b/cashu/wallet/api/router.py @@ -145,7 +145,7 @@ async def create_invoice( response_model=PaymentStatus, ) async def invoice_state( - payment_hash: str = Query(default=None, description="Payment hash of paid invoice"), + payment_request: str = Query(default=None, description="Payment request to check"), mint: str = Query( default=None, description="Mint URL to create an invoice at (None for default mint)", @@ -154,7 +154,7 @@ async def invoice_state( global wallet if mint: wallet = await mint_wallet(mint) - state = await wallet.get_invoice_status(payment_hash) + state = await wallet.get_invoice_status(payment_request) return state diff --git a/tests/test_wallet.py b/tests/test_wallet.py index 9785b478..886ce73f 100644 --- a/tests/test_wallet.py +++ b/tests/test_wallet.py @@ -291,10 +291,8 @@ async def test_melt(wallet1: Wallet): assert wallet1.balance == 128 invoice_payment_request = "" - invoice_payment_hash = "" if is_regtest: invoice_dict = get_real_invoice(64) - invoice_payment_hash = str(invoice_dict["r_hash"]) invoice_payment_request = invoice_dict["payment_request"] if is_fake: diff --git a/tests/test_wallet_api.py b/tests/test_wallet_api.py index 2e391743..d62eb3d6 100644 --- a/tests/test_wallet_api.py +++ b/tests/test_wallet_api.py @@ -33,12 +33,14 @@ async def test_invoice(wallet: Wallet): while state.pending: print("checking invoice state") response2 = client.get( - f"/lightning/invoice_state?payment_hash={invoice_response.checking_id}" + f"/lightning/invoice_state?payment_request={invoice_response.payment_request}" ) state = PaymentStatus.parse_obj(response2.json()) await asyncio.sleep(0.1) print("state:", state) print("paid") + await wallet.load_proofs() + assert wallet.available_balance == 100 @pytest.mark.skipif(is_regtest, reason="regtest") @@ -175,7 +177,7 @@ async def test_flow(wallet: Wallet): while state.pending: print("checking invoice state") response2 = client.get( - f"/lightning/invoice_state?payment_hash={invoice_response.checking_id}" + f"/lightning/invoice_state?payment_request={invoice_response.payment_request}" ) state = PaymentStatus.parse_obj(response2.json()) await asyncio.sleep(0.1)