From bd2a14fa43a720b98f0c0d3904977073aedb5022 Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Tue, 16 Apr 2024 10:28:07 +0200 Subject: [PATCH] [Wallet] Fix regression bug for mint request (#513) * fix regression bug for mint request * expiry is absolute time --- cashu/wallet/wallet_deprecated.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/cashu/wallet/wallet_deprecated.py b/cashu/wallet/wallet_deprecated.py index 34375a10..568538da 100644 --- a/cashu/wallet/wallet_deprecated.py +++ b/cashu/wallet/wallet_deprecated.py @@ -17,10 +17,10 @@ GetInfoResponse, GetInfoResponse_deprecated, GetMintResponse_deprecated, - Invoice, KeysetsResponse_deprecated, PostMeltRequest_deprecated, PostMeltResponse_deprecated, + PostMintQuoteResponse, PostMintRequest_deprecated, PostMintResponse_deprecated, PostRestoreResponse, @@ -226,7 +226,7 @@ async def _get_keyset_ids_deprecated(self, url: str) -> List[str]: @async_set_httpx_client @async_ensure_mint_loaded_deprecated - async def request_mint_deprecated(self, amount) -> Invoice: + async def request_mint_deprecated(self, amount) -> PostMintQuoteResponse: """Requests a mint from the server and returns Lightning invoice. Args: @@ -244,12 +244,11 @@ async def request_mint_deprecated(self, amount) -> Invoice: return_dict = resp.json() mint_response = GetMintResponse_deprecated.parse_obj(return_dict) decoded_invoice = bolt11.decode(mint_response.pr) - return Invoice( - amount=amount, - bolt11=mint_response.pr, - id=mint_response.hash, - payment_hash=decoded_invoice.payment_hash, - out=False, + return PostMintQuoteResponse( + quote=mint_response.hash, + request=mint_response.pr, + paid=False, + expiry=decoded_invoice.date + (decoded_invoice.expiry or 0), ) @async_set_httpx_client