mirror of
https://github.com/aljazceru/nutshell.git
synced 2025-12-22 03:24:18 +01:00
[FIX] NUT-15 mpp amount in millisats (#703)
* fix lndrest * fix clnrest * fix clnrest and lndrest * lnd grpc fix * wallet * convert amount to millisats in CLI pay invoice * fix tests * format * fix kw arg in regtest test * fix payment quote validation check * clean comment * avoid overwriting variable * deprecated response with amount --------- Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
This commit is contained in:
@@ -434,16 +434,17 @@ class LedgerAPI(LedgerAPIDeprecated, SupportsAuth):
|
||||
@async_set_httpx_client
|
||||
@async_ensure_mint_loaded
|
||||
async def melt_quote(
|
||||
self, payment_request: str, unit: Unit, amount: Optional[int] = None
|
||||
self, payment_request: str, unit: Unit, amount_msat: Optional[int] = None
|
||||
) -> PostMeltQuoteResponse:
|
||||
"""Checks whether the Lightning payment is internal."""
|
||||
invoice_obj = bolt11.decode(payment_request)
|
||||
assert invoice_obj.amount_msat, "invoice must have amount"
|
||||
|
||||
# add mpp amount for partial melts
|
||||
melt_options = None
|
||||
if amount:
|
||||
if amount_msat:
|
||||
melt_options = PostMeltRequestOptions(
|
||||
mpp=PostMeltRequestOptionMpp(amount=amount)
|
||||
mpp=PostMeltRequestOptionMpp(amount=amount_msat)
|
||||
)
|
||||
|
||||
payload = PostMeltQuoteRequest(
|
||||
@@ -462,9 +463,12 @@ class LedgerAPI(LedgerAPIDeprecated, SupportsAuth):
|
||||
payment_request
|
||||
)
|
||||
quote_id = f"deprecated_{uuid.uuid4()}"
|
||||
amount_sat = (
|
||||
amount_msat // 1000 if amount_msat else invoice_obj.amount_msat // 1000
|
||||
)
|
||||
return PostMeltQuoteResponse(
|
||||
quote=quote_id,
|
||||
amount=amount or invoice_obj.amount_msat // 1000,
|
||||
amount=amount_sat,
|
||||
fee_reserve=ret.fee or 0,
|
||||
paid=False,
|
||||
state=MeltQuoteState.unpaid.value,
|
||||
|
||||
Reference in New Issue
Block a user