NUT-04 and NUT-05: Add state field to quotes (#560)

* wip adding states, tests failing

* add state field to quotes

* responses from quotes

* store correct state

* cleaner test

* fix swap check

* oops
This commit is contained in:
callebtc
2024-06-26 03:06:01 +02:00
committed by GitHub
parent e846acf946
commit 6b38ef6c29
26 changed files with 330 additions and 84 deletions

View File

@@ -2,7 +2,7 @@ import pytest
import respx
from httpx import Response
from cashu.core.base import Amount, MeltQuote, Unit
from cashu.core.base import Amount, MeltQuote, MeltQuoteState, Unit
from cashu.core.models import PostMeltQuoteRequest
from cashu.core.settings import settings
from cashu.lightning.blink import MINIMUM_FEE_MSAT, BlinkWallet # type: ignore
@@ -99,6 +99,7 @@ async def test_blink_pay_invoice():
amount=100,
fee_reserve=12,
paid=False,
state=MeltQuoteState.unpaid,
)
payment = await blink.pay_invoice(quote, 1000)
assert payment.ok
@@ -131,6 +132,7 @@ async def test_blink_pay_invoice_failure():
amount=100,
fee_reserve=12,
paid=False,
state=MeltQuoteState.unpaid,
)
payment = await blink.pay_invoice(quote, 1000)
assert not payment.ok