feat(wallet): update mint url

feat(cli): add change mint
This commit is contained in:
thesimplekid
2024-06-25 08:31:16 +01:00
parent e358401ec8
commit 54c50c3724
9 changed files with 302 additions and 0 deletions

View File

@@ -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
}
}
}

View File

@@ -9,3 +9,4 @@ pub mod pending_mints;
pub mod receive;
pub mod restore;
pub mod send;
pub mod update_mint_url;

View 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(())
}