mirror of
https://github.com/aljazceru/cdk.git
synced 2026-02-23 05:56:02 +01:00
feat(nut04/nut05): mint and melt settings as objects
This commit is contained in:
@@ -64,9 +64,22 @@ pub struct MintBolt11Response {
|
||||
pub signatures: Vec<BlindedSignature>,
|
||||
}
|
||||
|
||||
/// Mint Method Settings
|
||||
#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct MintMethodSettings {
|
||||
/// Payment Method e.g. bolt11
|
||||
method: PaymentMethod,
|
||||
/// Currency Unit e.g. sat
|
||||
unit: CurrencyUnit,
|
||||
/// Min Amount
|
||||
min_amount: Amount,
|
||||
/// Max Amount
|
||||
max_amount: Amount,
|
||||
}
|
||||
|
||||
/// Mint Settings
|
||||
#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct Settings {
|
||||
methods: Vec<(PaymentMethod, CurrencyUnit)>,
|
||||
methods: Vec<MintMethodSettings>,
|
||||
disabled: bool,
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::CurrencyUnit;
|
||||
use super::{CurrencyUnit, PaymentMethod};
|
||||
use crate::nuts::Proofs;
|
||||
use crate::types::MeltQuote;
|
||||
use crate::{Amount, Bolt11Invoice};
|
||||
@@ -68,8 +68,21 @@ pub struct MeltBolt11Response {
|
||||
pub payment_preimage: Option<String>,
|
||||
}
|
||||
|
||||
/// Melt Method Settings
|
||||
#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct MeltMethodSettings {
|
||||
/// Payment Method e.g. bolt11
|
||||
method: PaymentMethod,
|
||||
/// Currency Unit e.g. sat
|
||||
unit: CurrencyUnit,
|
||||
/// Min Amount
|
||||
min_amount: Amount,
|
||||
/// Max Amount
|
||||
max_amount: Amount,
|
||||
}
|
||||
|
||||
/// Melt Settings
|
||||
#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct Settings {
|
||||
methods: Vec<(String, CurrencyUnit)>,
|
||||
methods: Vec<MeltMethodSettings>,
|
||||
}
|
||||
|
||||
@@ -142,13 +142,23 @@ mod tests {
|
||||
"nuts": {
|
||||
"4": {
|
||||
"methods": [
|
||||
["bolt11", "sat"]
|
||||
{
|
||||
"method": "bolt11",
|
||||
"unit": "sat",
|
||||
"min_amount": 0,
|
||||
"max_amount": 10000
|
||||
}
|
||||
],
|
||||
"disabled": false
|
||||
},
|
||||
"5": {
|
||||
"methods": [
|
||||
["bolt11", "sat"]
|
||||
{
|
||||
"method": "bolt11",
|
||||
"unit": "sat",
|
||||
"min_amount": 0,
|
||||
"max_amount": 10000
|
||||
}
|
||||
]
|
||||
},
|
||||
"7": {"supported": true},
|
||||
|
||||
Reference in New Issue
Block a user