mirror of
https://github.com/aljazceru/cdk.git
synced 2025-12-21 14:44:46 +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))?;
|
.map_err(|_| into_response(Error::UnitUnsupported))?;
|
||||||
|
|
||||||
(pre.payment_preimage, amount_spent)
|
(pre.payment_preimage, amount_spent)
|
||||||
|
|||||||
@@ -226,6 +226,7 @@ impl MintLightning for Cln {
|
|||||||
&CurrencyUnit::Msat,
|
&CurrencyUnit::Msat,
|
||||||
&melt_quote.unit,
|
&melt_quote.unit,
|
||||||
)?,
|
)?,
|
||||||
|
unit: melt_quote.unit,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ impl MintLightning for FakeWallet {
|
|||||||
payment_hash: "".to_string(),
|
payment_hash: "".to_string(),
|
||||||
status: MeltQuoteState::Paid,
|
status: MeltQuoteState::Paid,
|
||||||
total_spent: melt_quote.amount,
|
total_spent: melt_quote.amount,
|
||||||
|
unit: melt_quote.unit,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -193,6 +193,7 @@ impl MintLightning for LNbits {
|
|||||||
payment_preimage: Some(invoice_info.payment_hash),
|
payment_preimage: Some(invoice_info.payment_hash),
|
||||||
status,
|
status,
|
||||||
total_spent,
|
total_spent,
|
||||||
|
unit: CurrencyUnit::Sat,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -200,8 +200,9 @@ impl MintLightning for Lnd {
|
|||||||
Ok(PayInvoiceResponse {
|
Ok(PayInvoiceResponse {
|
||||||
payment_hash: hex::encode(payment_response.payment_hash),
|
payment_hash: hex::encode(payment_response.payment_hash),
|
||||||
payment_preimage: Some(hex::encode(payment_response.payment_preimage)),
|
payment_preimage: Some(hex::encode(payment_response.payment_preimage)),
|
||||||
status: MeltQuoteState::Pending,
|
status: MeltQuoteState::Paid,
|
||||||
total_spent: total_spent.into(),
|
total_spent: total_spent.into(),
|
||||||
|
unit: CurrencyUnit::Sat,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -193,6 +193,7 @@ impl MintLightning for Phoenixd {
|
|||||||
payment_preimage: Some(pay_response.payment_preimage),
|
payment_preimage: Some(pay_response.payment_preimage),
|
||||||
status: MeltQuoteState::Paid,
|
status: MeltQuoteState::Paid,
|
||||||
total_spent: total_spent_sats,
|
total_spent: total_spent_sats,
|
||||||
|
unit: CurrencyUnit::Sat,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -178,6 +178,7 @@ impl MintLightning for Strike {
|
|||||||
payment_preimage: None,
|
payment_preimage: None,
|
||||||
status: state,
|
status: state,
|
||||||
total_spent,
|
total_spent,
|
||||||
|
unit: melt_quote.unit,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -106,8 +106,10 @@ pub struct PayInvoiceResponse {
|
|||||||
pub payment_preimage: Option<String>,
|
pub payment_preimage: Option<String>,
|
||||||
/// Status
|
/// Status
|
||||||
pub status: MeltQuoteState,
|
pub status: MeltQuoteState,
|
||||||
/// Totoal Amount Spent
|
/// Total Amount Spent
|
||||||
pub total_spent: Amount,
|
pub total_spent: Amount,
|
||||||
|
/// Unit of total spent
|
||||||
|
pub unit: CurrencyUnit,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Payment quote response
|
/// Payment quote response
|
||||||
|
|||||||
Reference in New Issue
Block a user