Skip to content

Commit

Permalink
chore: add change to melt response
Browse files Browse the repository at this point in the history
  • Loading branch information
ngutech21 committed Dec 4, 2023
1 parent 5fcadcd commit 71e6fdc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions moksha-core/src/primitives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ pub struct PostMeltBolt11Request {
pub struct PostMeltBolt11Response {
pub paid: bool,
pub payment_preimage: String,
pub change: Vec<BlindedSignature>,
}

#[cfg(test)]
Expand Down
6 changes: 4 additions & 2 deletions moksha-mint/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,14 +326,16 @@ async fn post_melt_bolt11(
State(mint): State<Mint>,
Json(melt_request): Json<PostMeltBolt11Request>,
) -> Result<Json<PostMeltBolt11Response>, 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
}))
}

Expand Down

0 comments on commit 71e6fdc

Please sign in to comment.