use anyhow::{Context as _, Result}; use clap::Subcommand; use itertools::Itertools as _; use key_protocol::key_management::{KeyChain, key_tree::chain_index::ChainIndex}; use lee::{Account, PublicKey, program::Program}; use lee_core::Identifier; use token_core::{TokenDefinition, TokenHolding}; use crate::{ WalletCore, account::{AccountIdWithPrivacy, HumanReadableAccount, Label}, cli::{CliAccountMention, SubcommandReturnValue, WalletSubcommand}, }; /// Represents generic chain CLI subcommand. #[derive(Subcommand, Debug, Clone)] pub enum AccountSubcommand { /// Get account data. Get { /// Flag to get raw account data. #[arg(short, long)] raw: bool, /// Display keys (pk for public accounts, npk/vpk for private accounts). #[arg(short, long)] keys: bool, /// Either 32 byte base58 account id string with privacy prefix or a label. #[arg(short, long)] account_id: CliAccountMention, }, /// Produce new public or private account. #[command(subcommand)] New(NewSubcommand), /// Sync private accounts. SyncPrivate, /// List all accounts owned by the wallet. #[command(visible_alias = "ls")] List { /// Show detailed account information (like `account get`). #[arg(short, long)] long: bool, }, /// Set a label for an account. Label { /// Either 32 byte base58 account id string with privacy prefix or a label. #[arg(short, long)] account_id: CliAccountMention, /// The label to assign to the account. #[arg(short, long)] label: Label, }, /// Import external account. #[command(subcommand)] Import(ImportSubcommand), } /// Represents generic register CLI subcommand. #[derive(Subcommand, Debug, Clone)] pub enum NewSubcommand { /// Register new public account. Public { #[arg(long)] /// Chain index of a parent node. cci: Option, #[arg(short, long)] /// Label to assign to the new account. label: Option