mirror of
https://github.com/aljazceru/nutshell.git
synced 2025-12-24 03:54:21 +01:00
NUT-04/05: add amount, unit, request to melt and mint quote responses (#719)
* add amount, unit, request to melt and mint responses * make new fields optional to not break compat with old mints * make new flags optional for backwards compat
This commit is contained in:
@@ -667,7 +667,10 @@ class Ledger(LedgerVerification, LedgerSpendingConditions, LedgerTasks, LedgerFe
|
||||
if not payment_quote.checking_id:
|
||||
raise Exception("quote has no checking id")
|
||||
# verify that payment quote amount is as expected
|
||||
if melt_quote.is_mpp and melt_quote.mpp_amount != payment_quote.amount.to(Unit.msat).amount:
|
||||
if (
|
||||
melt_quote.is_mpp
|
||||
and melt_quote.mpp_amount != payment_quote.amount.to(Unit.msat).amount
|
||||
):
|
||||
raise TransactionError("quote amount not as requested")
|
||||
# make sure the backend returned the amount with a correct unit
|
||||
if not payment_quote.amount.unit == unit:
|
||||
@@ -759,6 +762,8 @@ class Ledger(LedgerVerification, LedgerSpendingConditions, LedgerTasks, LedgerFe
|
||||
return PostMeltQuoteResponse(
|
||||
quote=quote.quote,
|
||||
amount=quote.amount,
|
||||
unit=quote.unit,
|
||||
request=quote.request,
|
||||
fee_reserve=quote.fee_reserve,
|
||||
paid=quote.paid, # deprecated
|
||||
state=quote.state.value,
|
||||
|
||||
Reference in New Issue
Block a user