From 71e6fdcefe1335b714c5bf8c8197de17724c9f7a Mon Sep 17 00:00:00 2001 From: ngutech21 Date: Mon, 4 Dec 2023 20:05:44 +0100 Subject: [PATCH] chore: add change to melt response --- moksha-core/src/primitives.rs | 1 + moksha-mint/src/server.rs | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/moksha-core/src/primitives.rs b/moksha-core/src/primitives.rs index 2b37fd3a..5ffc06a7 100644 --- a/moksha-core/src/primitives.rs +++ b/moksha-core/src/primitives.rs @@ -169,6 +169,7 @@ pub struct PostMeltBolt11Request { pub struct PostMeltBolt11Response { pub paid: bool, pub payment_preimage: String, + pub change: Vec, } #[cfg(test)] diff --git a/moksha-mint/src/server.rs b/moksha-mint/src/server.rs index 88fa1b53..715d8841 100644 --- a/moksha-mint/src/server.rs +++ b/moksha-mint/src/server.rs @@ -326,14 +326,16 @@ async fn post_melt_bolt11( State(mint): State, Json(melt_request): Json, ) -> Result, MokshaMintError> { - // FIXME get quote from db + let quote = mint.db.get_quote(melt_request.quote)?; + let (paid, preimage, _change) = mint - .melt(melt_request.quote, &melt_request.inputs, &[]) + .melt(quote.payment_request, &melt_request.inputs, &[]) .await?; Ok(Json(PostMeltBolt11Response { paid, payment_preimage: preimage, + change: vec![], // FIXME return change })) }