feat: add unit to PayInvoiceResponse

This commit is contained in:
thesimplekid
2024-09-14 11:25:58 +01:00
parent eae57eae02
commit fba609f28a
8 changed files with 11 additions and 3 deletions

View File

@@ -375,7 +375,7 @@ pub async fn post_melt_bolt11(
}
};
let amount_spent = to_unit(pre.total_spent, &ln.get_settings().unit, &quote.unit)
let amount_spent = to_unit(pre.total_spent, &pre.unit, &quote.unit)
.map_err(|_| into_response(Error::UnitUnsupported))?;
(pre.payment_preimage, amount_spent)

View File

@@ -226,6 +226,7 @@ impl MintLightning for Cln {
&CurrencyUnit::Msat,
&melt_quote.unit,
)?,
unit: melt_quote.unit,
}
}
_ => {

View File

@@ -129,6 +129,7 @@ impl MintLightning for FakeWallet {
payment_hash: "".to_string(),
status: MeltQuoteState::Paid,
total_spent: melt_quote.amount,
unit: melt_quote.unit,
})
}

View File

@@ -193,6 +193,7 @@ impl MintLightning for LNbits {
payment_preimage: Some(invoice_info.payment_hash),
status,
total_spent,
unit: CurrencyUnit::Sat,
})
}

View File

@@ -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,
})
}

View File

@@ -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,
})
}

View File

@@ -178,6 +178,7 @@ impl MintLightning for Strike {
payment_preimage: None,
status: state,
total_spent,
unit: melt_quote.unit,
})
}

View File

@@ -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