Skip to content

Commit

Permalink
fix: return amount in quote as sat
Browse files Browse the repository at this point in the history
  • Loading branch information
ngutech21 committed Dec 6, 2023
1 parent e3c9475 commit 64fd0d0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions moksha-mint/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,21 +331,22 @@ async fn post_melt_quote_bolt11(
.ok_or_else(|| crate::error::MokshaMintError::InvalidAmount)?;
let fee_reserve = mint.fee_reserve(amount);

let amount_sat = amount / 1_000;
// Store quote in db
let key = Uuid::new_v4();
let quote = Quote::Bolt11Melt {
quote_id: key,
amount,
amount: amount_sat,
fee_reserve,
expiry: invoice.expiry_time().as_secs(), // FIXME check if this is correct
};
mint.db.add_quote(key.to_string(), quote)?;

// TODO implement into for Quote
Ok(Json(PostMeltQuoteBolt11Response {
amount,
amount: amount_sat,
fee_reserve,
quote: melt_request.request.clone(), // FIXME use uuid as quote
quote: key.to_string(),
paid: false,
expiry: invoice.expiry_time().as_secs(), // FIXME check if this is correct
}))
Expand Down

0 comments on commit 64fd0d0

Please sign in to comment.