mirror of
https://github.com/aljazceru/cdk.git
synced 2025-12-21 06:34:59 +01:00
feat: add unit to PayInvoiceResponse
This commit is contained in:
@@ -375,7 +375,7 @@ pub async fn post_melt_bolt11(
|
||||
}
|
||||
};
|
||||
|
||||
let amount_spent = to_unit(pre.total_spent, &ln.get_settings().unit, "e.unit)
|
||||
let amount_spent = to_unit(pre.total_spent, &pre.unit, "e.unit)
|
||||
.map_err(|_| into_response(Error::UnitUnsupported))?;
|
||||
|
||||
(pre.payment_preimage, amount_spent)
|
||||
|
||||
@@ -226,6 +226,7 @@ impl MintLightning for Cln {
|
||||
&CurrencyUnit::Msat,
|
||||
&melt_quote.unit,
|
||||
)?,
|
||||
unit: melt_quote.unit,
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
|
||||
@@ -129,6 +129,7 @@ impl MintLightning for FakeWallet {
|
||||
payment_hash: "".to_string(),
|
||||
status: MeltQuoteState::Paid,
|
||||
total_spent: melt_quote.amount,
|
||||
unit: melt_quote.unit,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -193,6 +193,7 @@ impl MintLightning for LNbits {
|
||||
payment_preimage: Some(invoice_info.payment_hash),
|
||||
status,
|
||||
total_spent,
|
||||
unit: CurrencyUnit::Sat,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -200,8 +200,9 @@ impl MintLightning for Lnd {
|
||||
Ok(PayInvoiceResponse {
|
||||
payment_hash: hex::encode(payment_response.payment_hash),
|
||||
payment_preimage: Some(hex::encode(payment_response.payment_preimage)),
|
||||
status: MeltQuoteState::Pending,
|
||||
status: MeltQuoteState::Paid,
|
||||
total_spent: total_spent.into(),
|
||||
unit: CurrencyUnit::Sat,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -193,6 +193,7 @@ impl MintLightning for Phoenixd {
|
||||
payment_preimage: Some(pay_response.payment_preimage),
|
||||
status: MeltQuoteState::Paid,
|
||||
total_spent: total_spent_sats,
|
||||
unit: CurrencyUnit::Sat,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -178,6 +178,7 @@ impl MintLightning for Strike {
|
||||
payment_preimage: None,
|
||||
status: state,
|
||||
total_spent,
|
||||
unit: melt_quote.unit,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -106,8 +106,10 @@ pub struct PayInvoiceResponse {
|
||||
pub payment_preimage: Option<String>,
|
||||
/// Status
|
||||
pub status: MeltQuoteState,
|
||||
/// Totoal Amount Spent
|
||||
/// Total Amount Spent
|
||||
pub total_spent: Amount,
|
||||
/// Unit of total spent
|
||||
pub unit: CurrencyUnit,
|
||||
}
|
||||
|
||||
/// Payment quote response
|
||||
|
||||
Reference in New Issue
Block a user