Skip to content

Commit

Permalink
feat: add kind_str for Output
Browse files Browse the repository at this point in the history
  • Loading branch information
qrayven committed Jul 28, 2023
1 parent 30f830e commit b5c5920
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
7 changes: 1 addition & 6 deletions cli/src/command/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -632,12 +632,7 @@ pub async fn outputs_command(account: &Account) -> Result<(), Error> {
println_log_info!("No outputs found");
} else {
for (i, output_data) in outputs.into_iter().enumerate() {
println_log_info!(
"{}\t{}\t{}",
i,
&output_data.output_id,
get_output_type_str(&output_data.output),
);
println_log_info!("{}\t{}\t{}", i, &output_data.output_id, output_data.output.kind_str());
}
}
Ok(())
Expand Down
1 change: 1 addition & 0 deletions cli/src/command/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ pub async fn new_account_command(
pub async fn node_info_command(storage_path: &Path) -> Result<Wallet, Error> {
let wallet = unlock_wallet(storage_path, None, None).await?;
let node_info = wallet.client().get_info().await?;
println_log_info!("{:?}", wallet.get_account_aliases().await.unwrap());

println_log_info!("Current node info: {}", serde_json::to_string_pretty(&node_info)?);

Expand Down
10 changes: 0 additions & 10 deletions cli/src/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,13 +268,3 @@ pub async fn check_file_exists(path: &Path) -> Result<(), Error> {
}
Ok(())
}

pub fn get_output_type_str(output: &Output) -> &str {
match output {
Output::Alias(_) => "Alias",
Output::Basic(_) => "Basic",
Output::Foundry(_) => "Foundry",
Output::Nft(_) => "Nft",
Output::Treasury(_) => "Treasury",
}
}
11 changes: 11 additions & 0 deletions sdk/src/types/block/output/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,17 @@ impl Output {

Ok(())
}

/// Return the output kind string of an [`Output`].
pub fn kind_str(&self) -> &str {
match self {
Output::Alias(_) => "Alias",
Output::Basic(_) => "Basic",
Output::Foundry(_) => "Foundry",
Output::Nft(_) => "Nft",
Output::Treasury(_) => "Treasury",
}
}
}

impl Packable for Output {
Expand Down

0 comments on commit b5c5920

Please sign in to comment.