Fix: Nut 05 mint response model (#564)

* change response model of NUT-05 to include payment_preimage and change (NUT-08)

* fix tests

* crud: same expiry as timestamp

* fix expiry handling

* add api tests to check new models
This commit is contained in:
callebtc
2024-06-27 14:35:03 +02:00
committed by GitHub
parent 8af1b61b30
commit 1d8b5cd5ca
12 changed files with 151 additions and 49 deletions

View File

@@ -183,6 +183,8 @@ class PostMeltQuoteResponse(BaseModel):
paid: bool # whether the request has been paid # DEPRECATED as per NUT PR #136
state: str # state of the quote
expiry: Optional[int] # expiry of the quote
payment_preimage: Optional[str] = None # payment preimage
change: Union[List[BlindedSignature], None] = None
@classmethod
def from_melt_quote(self, melt_quote: MeltQuote) -> "PostMeltQuoteResponse":
@@ -203,9 +205,9 @@ class PostMeltRequest(BaseModel):
)
class PostMeltResponse(BaseModel):
class PostMeltResponse_deprecated(BaseModel):
paid: Union[bool, None]
payment_preimage: Union[str, None]
preimage: Union[str, None]
change: Union[List[BlindedSignature], None] = None
@@ -217,12 +219,6 @@ class PostMeltRequest_deprecated(BaseModel):
)
class PostMeltResponse_deprecated(BaseModel):
paid: Union[bool, None]
preimage: Union[str, None]
change: Union[List[BlindedSignature], None] = None
# ------- API: SPLIT -------