NUT-04 Mint Quote Description (#337)

This commit is contained in:
lollerfirst
2024-09-12 13:27:52 +02:00
committed by GitHub
parent ce7729538c
commit 7e860c71f2
22 changed files with 193 additions and 126 deletions

View File

@@ -11,9 +11,10 @@ use cdk::wallet::multi_mint_wallet::WalletKey;
use cdk::wallet::{MultiMintWallet, Wallet};
use cdk::Amount;
use clap::Args;
use serde::{Deserialize, Serialize};
use tokio::time::sleep;
#[derive(Args)]
#[derive(Args, Serialize, Deserialize)]
pub struct MintSubCommand {
/// Mint url
mint_url: MintUrl,
@@ -22,6 +23,9 @@ pub struct MintSubCommand {
/// Currency unit e.g. sat
#[arg(default_value = "sat")]
unit: String,
/// Quote description
#[serde(skip_serializing_if = "Option::is_none")]
description: Option<String>,
}
pub async fn mint(
@@ -32,6 +36,7 @@ pub async fn mint(
) -> Result<()> {
let mint_url = sub_command_args.mint_url.clone();
let unit = CurrencyUnit::from_str(&sub_command_args.unit)?;
let description: Option<String> = sub_command_args.description.clone();
let wallet = match multi_mint_wallet
.get_wallet(&WalletKey::new(mint_url.clone(), CurrencyUnit::Sat))
@@ -47,7 +52,7 @@ pub async fn mint(
};
let quote = wallet
.mint_quote(Amount::from(sub_command_args.amount))
.mint_quote(Amount::from(sub_command_args.amount), description)
.await?;
println!("Quote: {:#?}", quote);