From 64fd0d0712ae83d09e5527d7cc9a83e2b08831d7 Mon Sep 17 00:00:00 2001 From: ngutech21 Date: Wed, 6 Dec 2023 16:00:24 +0100 Subject: [PATCH] fix: return amount in quote as sat --- moksha-mint/src/server.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/moksha-mint/src/server.rs b/moksha-mint/src/server.rs index 6c1a8ec1..51f9a032 100644 --- a/moksha-mint/src/server.rs +++ b/moksha-mint/src/server.rs @@ -331,11 +331,12 @@ 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 }; @@ -343,9 +344,9 @@ async fn post_melt_quote_bolt11( // 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 }))