[Wallet] Fix regression bug for mint request (#513)

* fix regression bug for mint request

* expiry is absolute time
This commit is contained in:
callebtc
2024-04-16 10:28:07 +02:00
committed by GitHub
parent bb7730694d
commit bd2a14fa43

View File

@@ -17,10 +17,10 @@ from ..core.base import (
GetInfoResponse,
GetInfoResponse_deprecated,
GetMintResponse_deprecated,
Invoice,
KeysetsResponse_deprecated,
PostMeltRequest_deprecated,
PostMeltResponse_deprecated,
PostMintQuoteResponse,
PostMintRequest_deprecated,
PostMintResponse_deprecated,
PostRestoreResponse,
@@ -226,7 +226,7 @@ class LedgerAPIDeprecated(SupportsHttpxClient, SupportsMintURL):
@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 @@ class LedgerAPIDeprecated(SupportsHttpxClient, SupportsMintURL):
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