mirror of
https://github.com/aljazceru/nutshell.git
synced 2026-01-04 01:14:21 +01:00
[Wallet] Fix regression bug for mint request (#513)
* fix regression bug for mint request * expiry is absolute time
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user