diff --git a/moksha-cli/src/main.rs b/moksha-cli/src/main.rs index bb7d232f..f095309f 100644 --- a/moksha-cli/src/main.rs +++ b/moksha-cli/src/main.rs @@ -152,7 +152,7 @@ async fn main() -> anyhow::Result<()> { Command::PayOnchain { address, amount } => { let info = wallet.get_mint_info().await?; - if info.nuts.nut15.map_or(true, |nut15| !nut15.supported) { + if info.nuts.nut18.map_or(true, |nut18| !nut18.supported) { println!("Error: onchain-payments are not supported by this mint"); return Ok(()); } @@ -207,13 +207,13 @@ async fn main() -> anyhow::Result<()> { Command::Mint { amount } => { let info = wallet.get_mint_info().await?; - let payment_method = info.nuts.nut14.as_ref().map_or_else( + let payment_method = info.nuts.nut17.as_ref().map_or_else( || { println!("Only bolt11 minting is supported"); PaymentMethod::Bolt11 }, - |nut14| { - if !nut14.supported { + |nut17| { + if !nut17.supported { println!("Only bolt11 minting is supported"); PaymentMethod::Bolt11 } else { @@ -232,8 +232,8 @@ async fn main() -> anyhow::Result<()> { let quote = match payment_method { PaymentMethod::BtcOnchain => { - let nut14 = info.nuts.nut14.expect("nut14 is None"); - let payment_method = nut14.payment_methods.first().expect("no payment methods"); + let nut17 = info.nuts.nut17.expect("nut17 is None"); + let payment_method = nut17.payment_methods.first().expect("no payment methods"); if amount < payment_method.min_amount { println!( "Amount too low. Minimum amount is {} (sat)", diff --git a/moksha-core/src/primitives.rs b/moksha-core/src/primitives.rs index 96dc4e82..0a7e6158 100644 --- a/moksha-core/src/primitives.rs +++ b/moksha-core/src/primitives.rs @@ -421,14 +421,14 @@ pub struct Nuts { /// DLEQ proofs pub nut12: Nut12, - // TODO remove this if nut-14 and nut-15 are merged - #[serde(rename = "14", skip_serializing_if = "Option::is_none")] + // TODO remove this if nut-17 and nut-18 are merged + #[serde(rename = "17", skip_serializing_if = "Option::is_none")] /// minting tokens onchain - pub nut14: Option, + pub nut17: Option, - #[serde(rename = "15", skip_serializing_if = "Option::is_none")] + #[serde(rename = "18", skip_serializing_if = "Option::is_none")] /// melting tokens onchain - pub nut15: Option, + pub nut18: Option, } #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq, ToSchema)] @@ -510,7 +510,7 @@ pub struct Nut12 { } #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq, ToSchema)] -pub struct Nut14 { +pub struct Nut17 { pub supported: bool, #[serde(rename = "methods")] pub payment_methods: Vec, @@ -534,7 +534,7 @@ pub struct PaymentMethodConfigBtcOnchain { pub max_amount: u64, } -impl Default for Nut14 { +impl Default for Nut17 { fn default() -> Self { Self { supported: true, @@ -549,13 +549,13 @@ impl Default for Nut14 { } #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq, ToSchema)] -pub struct Nut15 { +pub struct Nut18 { pub supported: bool, #[serde(rename = "methods")] pub payment_methods: Vec, } -impl Default for Nut15 { +impl Default for Nut18 { fn default() -> Self { Self { supported: true, diff --git a/moksha-mint/src/config.rs b/moksha-mint/src/config.rs index 15420a3f..68febecb 100644 --- a/moksha-mint/src/config.rs +++ b/moksha-mint/src/config.rs @@ -2,7 +2,7 @@ use std::{env, net::SocketAddr, path::PathBuf, str::FromStr}; use clap::Parser; use moksha_core::primitives::{ - CurrencyUnit, Nut14, Nut15, PaymentMethod, PaymentMethodConfigBtcOnchain, + CurrencyUnit, Nut17, Nut18, PaymentMethod, PaymentMethodConfigBtcOnchain, }; use serde::{Deserialize, Serialize}; @@ -209,7 +209,7 @@ impl FromStr for BtcOnchainTypeVariant { } } -impl From for Nut14 { +impl From for Nut17 { fn from(settings: BtcOnchainConfig) -> Self { Self { supported: true, @@ -223,7 +223,7 @@ impl From for Nut14 { } } -impl From for Nut15 { +impl From for Nut18 { fn from(settings: BtcOnchainConfig) -> Self { Self { supported: true, diff --git a/moksha-mint/src/routes/default.rs b/moksha-mint/src/routes/default.rs index 90711938..666cc7d1 100644 --- a/moksha-mint/src/routes/default.rs +++ b/moksha-mint/src/routes/default.rs @@ -381,8 +381,8 @@ fn get_nuts(cfg: &MintConfig) -> Nuts { let default_config = BtcOnchainConfig::default(); let config = cfg.btconchain_backend.as_ref().unwrap_or(&default_config); Nuts { - nut14: Some(config.to_owned().into()), - nut15: Some(config.to_owned().into()), + nut17: Some(config.to_owned().into()), + nut18: Some(config.to_owned().into()), ..Nuts::default() } } diff --git a/moksha-mint/src/server.rs b/moksha-mint/src/server.rs index 25e9b187..c74b3fc3 100644 --- a/moksha-mint/src/server.rs +++ b/moksha-mint/src/server.rs @@ -28,7 +28,7 @@ use moksha_core::blind::BlindedMessage; use moksha_core::blind::BlindedSignature; use moksha_core::primitives::{ CurrencyUnit, GetMeltOnchainResponse, KeyResponse, KeysResponse, MintInfoResponse, - MintLegacyInfoResponse, Nut10, Nut11, Nut12, Nut14, Nut15, Nut4, Nut5, Nut7, Nut8, Nut9, Nuts, + MintLegacyInfoResponse, Nut10, Nut11, Nut12, Nut17, Nut18, Nut4, Nut5, Nut7, Nut8, Nut9, Nuts, PaymentMethod, PostMeltBolt11Request, PostMeltBolt11Response, PostMeltQuoteBolt11Request, PostMeltQuoteBolt11Response, PostMeltQuoteOnchainRequest, PostMeltQuoteOnchainResponse, PostMintBolt11Request, PostMintBolt11Response, PostMintQuoteBolt11Request, @@ -151,8 +151,8 @@ pub async fn run_server(mint: Mint) -> anyhow::Result<()> { PostSwapRequest, PostSwapResponse, P2SHScript, - Nut14, - Nut15, + Nut17, + Nut18, PostMintQuoteOnchainRequest, PostMintQuoteOnchainResponse, PostMeltQuoteOnchainRequest,