update_name.rs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. use anyhow::Result;
  2. use clap::Args;
  3. use tonic::transport::Channel;
  4. use tonic::Request;
  5. use crate::cdk_mint_client::CdkMintClient;
  6. use crate::UpdateNameRequest;
  7. /// Command to update the mint's name
  8. ///
  9. /// This command sets a new display name for the mint, which is used to identify
  10. /// the mint in wallet applications and other client interfaces.
  11. #[derive(Args)]
  12. pub struct UpdateNameCommand {
  13. /// The new name for the mint
  14. name: String,
  15. }
  16. /// Executes the update_name command against the mint server
  17. ///
  18. /// This function sends an RPC request to update the mint's display name.
  19. ///
  20. /// # Arguments
  21. /// * `client` - The RPC client used to communicate with the mint
  22. /// * `sub_command_args` - The new name to set for the mint
  23. pub async fn update_name(
  24. client: &mut CdkMintClient<Channel>,
  25. sub_command_args: &UpdateNameCommand,
  26. ) -> Result<()> {
  27. let _response = client
  28. .update_name(Request::new(UpdateNameRequest {
  29. name: sub_command_args.name.clone(),
  30. }))
  31. .await?;
  32. Ok(())
  33. }