mirror of
https://github.com/aljazceru/cdk.git
synced 2025-12-23 07:35:03 +01:00
feat(wallet): update mint url
feat(cli): add change mint
This commit is contained in:
@@ -58,6 +58,8 @@ enum Commands {
|
||||
Burn(sub_commands::burn::BurnSubCommand),
|
||||
/// Restore proofs from seed
|
||||
Restore(sub_commands::restore::RestoreSubCommand),
|
||||
/// Update Mint Url
|
||||
UpdateMintUrl(sub_commands::update_mint_url::UpdateMintUrlSubCommand),
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
@@ -145,5 +147,8 @@ async fn main() -> Result<()> {
|
||||
Commands::Restore(sub_command_args) => {
|
||||
sub_commands::restore::restore(wallet, sub_command_args).await
|
||||
}
|
||||
Commands::UpdateMintUrl(sub_command_args) => {
|
||||
sub_commands::update_mint_url::update_mint_url(wallet, sub_command_args).await
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,3 +9,4 @@ pub mod pending_mints;
|
||||
pub mod receive;
|
||||
pub mod restore;
|
||||
pub mod send;
|
||||
pub mod update_mint_url;
|
||||
|
||||
30
crates/cdk-cli/src/sub_commands/update_mint_url.rs
Normal file
30
crates/cdk-cli/src/sub_commands/update_mint_url.rs
Normal file
@@ -0,0 +1,30 @@
|
||||
use anyhow::Result;
|
||||
use cdk::url::UncheckedUrl;
|
||||
use cdk::wallet::Wallet;
|
||||
use clap::Args;
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct UpdateMintUrlSubCommand {
|
||||
/// Old Mint Url
|
||||
old_mint_url: UncheckedUrl,
|
||||
/// New Mint Url
|
||||
new_mint_url: UncheckedUrl,
|
||||
}
|
||||
|
||||
pub async fn update_mint_url(
|
||||
wallet: Wallet,
|
||||
sub_command_args: &UpdateMintUrlSubCommand,
|
||||
) -> Result<()> {
|
||||
let UpdateMintUrlSubCommand {
|
||||
old_mint_url,
|
||||
new_mint_url,
|
||||
} = sub_command_args;
|
||||
|
||||
wallet
|
||||
.update_mint_url(old_mint_url.clone(), new_mint_url.clone())
|
||||
.await?;
|
||||
|
||||
println!("Mint Url changed from {} to {}", old_mint_url, new_mint_url);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user