mirror of
https://github.com/aljazceru/cdk.git
synced 2026-01-04 21:45:24 +01:00
Merge pull request #539 from thesimplekid/multiple_limts
fix: extra mint/melt info limits
This commit is contained in:
@@ -211,7 +211,7 @@ pub struct MintMethodSettings {
|
||||
}
|
||||
|
||||
/// Mint Settings
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "swagger", derive(utoipa::ToSchema), schema(as = nut04::Settings))]
|
||||
pub struct Settings {
|
||||
/// Methods to mint
|
||||
@@ -241,20 +241,3 @@ impl Settings {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Settings {
|
||||
fn default() -> Self {
|
||||
let bolt11_mint = MintMethodSettings {
|
||||
method: PaymentMethod::Bolt11,
|
||||
unit: CurrencyUnit::Sat,
|
||||
min_amount: Some(Amount::from(1)),
|
||||
max_amount: Some(Amount::from(1000000)),
|
||||
description: true,
|
||||
};
|
||||
|
||||
Settings {
|
||||
methods: vec![bolt11_mint],
|
||||
disabled: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -402,7 +402,7 @@ impl Settings {
|
||||
}
|
||||
|
||||
/// Melt Settings
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "swagger", derive(utoipa::ToSchema), schema(as = nut05::Settings))]
|
||||
pub struct Settings {
|
||||
/// Methods to melt
|
||||
@@ -410,19 +410,3 @@ pub struct Settings {
|
||||
/// Minting disabled
|
||||
pub disabled: bool,
|
||||
}
|
||||
|
||||
impl Default for Settings {
|
||||
fn default() -> Self {
|
||||
let bolt11_mint = MeltMethodSettings {
|
||||
method: PaymentMethod::Bolt11,
|
||||
unit: CurrencyUnit::Sat,
|
||||
min_amount: Some(Amount::from(1)),
|
||||
max_amount: Some(Amount::from(1000000)),
|
||||
};
|
||||
|
||||
Settings {
|
||||
methods: vec![bolt11_mint],
|
||||
disabled: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ where
|
||||
mint_builder = mint_builder.add_ln_backend(
|
||||
CurrencyUnit::Sat,
|
||||
PaymentMethod::Bolt11,
|
||||
MintMeltLimits::default(),
|
||||
MintMeltLimits::new(1, 5_000),
|
||||
Arc::new(fake_wallet),
|
||||
);
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ where
|
||||
mint_builder = mint_builder.add_ln_backend(
|
||||
CurrencyUnit::Sat,
|
||||
PaymentMethod::Bolt11,
|
||||
MintMeltLimits::default(),
|
||||
MintMeltLimits::new(1, 5_000),
|
||||
Arc::new(cln_backend),
|
||||
);
|
||||
|
||||
|
||||
@@ -254,3 +254,15 @@ pub struct MintMeltLimits {
|
||||
/// Max melt amount
|
||||
pub melt_max: Amount,
|
||||
}
|
||||
|
||||
impl MintMeltLimits {
|
||||
/// Create new [`MintMeltLimits`]
|
||||
pub fn new(min: u64, max: u64) -> Self {
|
||||
Self {
|
||||
mint_min: min.into(),
|
||||
mint_max: max.into(),
|
||||
melt_min: min.into(),
|
||||
melt_max: max.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user