diff --git a/moksha-core/src/primitives.rs b/moksha-core/src/primitives.rs index 53a6e3fd..2b37fd3a 100644 --- a/moksha-core/src/primitives.rs +++ b/moksha-core/src/primitives.rs @@ -130,6 +130,8 @@ pub struct PostMintQuoteBolt11Request { pub struct PostMintQuoteBolt11Response { pub quote: String, pub request: String, + pub paid: bool, + pub expiry: u64, } #[derive(Deserialize, Serialize, Debug, Clone)] @@ -166,8 +168,7 @@ pub struct PostMeltBolt11Request { #[derive(Deserialize, Serialize, Debug, Clone)] pub struct PostMeltBolt11Response { pub paid: bool, - /// payment preimage - pub proof: String, + pub payment_preimage: String, } #[cfg(test)] diff --git a/moksha-mint/src/server.rs b/moksha-mint/src/server.rs index dfeebe4c..88fa1b53 100644 --- a/moksha-mint/src/server.rs +++ b/moksha-mint/src/server.rs @@ -273,6 +273,8 @@ async fn post_mint_quote_bolt11( // FIXME check currency unit let (pr, _hash) = mint.create_invoice(request.amount).await?; + let invoice = mint.lightning.decode_invoice(pr.clone()).await?; + let quote = Quote::new(pr.clone()); let quote_id = quote.quote_id.to_string(); mint.db.add_quote(quote_id.clone(), quote)?; @@ -280,6 +282,8 @@ async fn post_mint_quote_bolt11( Ok(Json(PostMintQuoteBolt11Response { quote: quote_id, request: pr, + paid: false, + expiry: invoice.expiry_time().as_secs(), // FIXME check if this is correct })) }