Skip to content

Commit

Permalink
[Wallet] Fix regression bug for mint request (#513)
Browse files Browse the repository at this point in the history
* fix regression bug for mint request

* expiry is absolute time
  • Loading branch information
callebtc authored Apr 16, 2024
1 parent bb77306 commit bd2a14f
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions cashu/wallet/wallet_deprecated.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
GetInfoResponse,
GetInfoResponse_deprecated,
GetMintResponse_deprecated,
Invoice,
KeysetsResponse_deprecated,
PostMeltRequest_deprecated,
PostMeltResponse_deprecated,
PostMintQuoteResponse,
PostMintRequest_deprecated,
PostMintResponse_deprecated,
PostRestoreResponse,
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit bd2a14f

Please sign in to comment.