soroban_cli/commands/contract/
asset.rs

1use crate::{commands::global, print::Print, utils::deprecate_message};
2
3use super::{deploy, id};
4
5#[derive(Debug, clap::Subcommand)]
6pub enum Cmd {
7    /// Get Id of builtin Soroban Asset Contract. Deprecated, use `stellar contract id asset` instead
8    Id(id::asset::Cmd),
9    /// Deploy builtin Soroban Asset Contract
10    Deploy(deploy::asset::Cmd),
11}
12
13#[derive(thiserror::Error, Debug)]
14pub enum Error {
15    #[error(transparent)]
16    Id(#[from] id::asset::Error),
17    #[error(transparent)]
18    Deploy(#[from] deploy::asset::Error),
19}
20
21impl Cmd {
22    pub async fn run(&self, global_args: &global::Args) -> Result<(), Error> {
23        let print = Print::new(global_args.quiet);
24
25        match &self {
26            Cmd::Id(id) => {
27                deprecate_message(
28                    print,
29                    "stellar contract asset id",
30                    "Use `stellar contract id asset` instead.",
31                );
32                id.run()?;
33            }
34            Cmd::Deploy(asset) => asset.run(global_args).await?,
35        }
36        Ok(())
37    }
38}