mirror of
https://github.com/aljazceru/cdk.git
synced 2026-02-05 05:06:14 +01:00
feat: mint and melt quote into response
This commit is contained in:
@@ -443,7 +443,6 @@ impl Mint {
|
||||
witness: None,
|
||||
})
|
||||
}
|
||||
|
||||
Ok(CheckStateResponse { states })
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! Request mint
|
||||
//! Swap
|
||||
// https://github.com/cashubtc/nuts/blob/main/03.md
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
//! Mint Tokens
|
||||
//! Mint Tokens via Bolt11
|
||||
// https://github.com/cashubtc/nuts/blob/main/04.md
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::{BlindedMessage, BlindedSignature, CurrencyUnit, PaymentMethod};
|
||||
use crate::types::MintQuote;
|
||||
use crate::Amount;
|
||||
|
||||
/// Mint quote request [NUT-04]
|
||||
@@ -27,6 +28,17 @@ pub struct MintQuoteBolt11Response {
|
||||
pub expiry: u64,
|
||||
}
|
||||
|
||||
impl From<MintQuote> for MintQuoteBolt11Response {
|
||||
fn from(mint_quote: MintQuote) -> MintQuoteBolt11Response {
|
||||
MintQuoteBolt11Response {
|
||||
quote: mint_quote.id,
|
||||
request: mint_quote.request,
|
||||
paid: mint_quote.paid,
|
||||
expiry: mint_quote.expiry,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Mint request [NUT-04]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct MintBolt11Request {
|
||||
|
||||
@@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::CurrencyUnit;
|
||||
use crate::nuts::Proofs;
|
||||
use crate::types::MeltQuote;
|
||||
use crate::{Amount, Bolt11Invoice};
|
||||
|
||||
/// Melt quote request [NUT-05]
|
||||
@@ -31,6 +32,18 @@ pub struct MeltQuoteBolt11Response {
|
||||
pub expiry: u64,
|
||||
}
|
||||
|
||||
impl From<MeltQuote> for MeltQuoteBolt11Response {
|
||||
fn from(melt_quote: MeltQuote) -> MeltQuoteBolt11Response {
|
||||
MeltQuoteBolt11Response {
|
||||
quote: melt_quote.id,
|
||||
amount: u64::from(melt_quote.amount),
|
||||
fee_reserve: u64::from(melt_quote.fee_reserve),
|
||||
paid: melt_quote.paid,
|
||||
expiry: melt_quote.expiry,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Melt Bolt11 Request [NUT-05]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct MeltBolt11Request {
|
||||
|
||||
Reference in New Issue
Block a user