diff --git a/Cargo.lock b/Cargo.lock index cbe43cc4..dee93ea4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -47,12 +47,51 @@ dependencies = [ ] [[package]] -name = "ansi_term" -version = "0.12.1" +name = "anstream" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +checksum = "b1f58811cfac344940f1a400b6e6231ce35171f614f26439e80f8c1465c5cc0c" dependencies = [ - "winapi", + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15c4c2c83f81532e5845a733998b6971faca23490340a418e9b72a3ec9de12ea" + +[[package]] +name = "anstyle-parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +dependencies = [ + "windows-sys 0.48.0", +] + +[[package]] +name = "anstyle-wincon" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58f54d10c6dfa51283a066ceab3ec1ab78d13fae00aa49243a45e4571fb79dfd" +dependencies = [ + "anstyle", + "windows-sys 0.48.0", ] [[package]] @@ -110,17 +149,6 @@ dependencies = [ "tungstenite", ] -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi", -] - [[package]] name = "autocfg" version = "0.1.8" @@ -343,19 +371,45 @@ dependencies = [ [[package]] name = "clap" -version = "2.34.0" +version = "4.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" +checksum = "1d5f1946157a96594eb2d2c10eb7ad9a2b27518cb3000209dec700c35df9197d" dependencies = [ - "ansi_term", - "atty", - "bitflags", + "clap_builder", + "clap_derive", + "once_cell", +] + +[[package]] +name = "clap_builder" +version = "4.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78116e32a042dd73c2901f0dc30790d20ff3447f3e3472fad359e8c3d282bcd6" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", "strsim", - "textwrap", - "unicode-width", - "vec_map", ] +[[package]] +name = "clap_derive" +version = "4.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9fd1a5729c4548118d7d70ff234a44868d00489a4b6597b0b020918a0e91a1a" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.9", +] + +[[package]] +name = "clap_lex" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" + [[package]] name = "cloudabi" version = "0.0.3" @@ -402,6 +456,12 @@ dependencies = [ "tracing-error", ] +[[package]] +name = "colorchoice" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" + [[package]] name = "config" version = "0.13.3" @@ -794,6 +854,7 @@ dependencies = [ name = "croncatd" version = "0.3.7" dependencies = [ + "clap", "croncat", "croncat-sdk-agents", "enum-display", @@ -801,7 +862,6 @@ dependencies = [ "reqwest", "serde", "serde_json", - "structopt", ] [[package]] @@ -1476,21 +1536,9 @@ dependencies = [ [[package]] name = "heck" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" -dependencies = [ - "unicode-segmentation", -] - -[[package]] -name = "hermit-abi" -version = "0.1.19" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" @@ -2292,30 +2340,6 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn 1.0.109", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - [[package]] name = "proc-macro2" version = "1.0.53" @@ -3114,33 +3138,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "strsim" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" - -[[package]] -name = "structopt" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10" -dependencies = [ - "clap", - "lazy_static", - "structopt-derive", -] - -[[package]] -name = "structopt-derive" -version = "0.4.18" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" -dependencies = [ - "heck", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 1.0.109", -] +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "subtle" @@ -3413,15 +3413,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "textwrap" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -dependencies = [ - "unicode-width", -] - [[package]] name = "thiserror" version = "1.0.40" @@ -3898,6 +3889,12 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + [[package]] name = "uuid" version = "0.8.2" @@ -3916,12 +3913,6 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - [[package]] name = "version_check" version = "0.9.4" @@ -4112,7 +4103,7 @@ version = "0.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdacb41e6a96a052c6cb63a144f24900236121c6f63f4f8219fef5977ecb0c25" dependencies = [ - "windows-targets", + "windows-targets 0.42.2", ] [[package]] @@ -4121,13 +4112,13 @@ version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", ] [[package]] @@ -4136,7 +4127,16 @@ version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" dependencies = [ - "windows-targets", + "windows-targets 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", ] [[package]] @@ -4145,13 +4145,28 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] @@ -4160,42 +4175,84 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + [[package]] name = "windows_aarch64_msvc" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + [[package]] name = "windows_i686_gnu" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + [[package]] name = "windows_i686_msvc" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + [[package]] name = "windows_x86_64_gnu" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + [[package]] name = "windows_x86_64_gnullvm" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + [[package]] name = "windows_x86_64_msvc" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + [[package]] name = "winreg" version = "0.10.1" diff --git a/config.yaml b/config.yaml index abd1dc9a..d47d8d61 100644 --- a/config.yaml +++ b/config.yaml @@ -9,7 +9,7 @@ chains: "mikedotexe": rpc: https://juno.csli.zone uni-6: - factory: juno1mc4wfy9unvy2mwx7dskjqhh6v7qta3vqsxmkayclg4c2jude76es0jcp38 + factory: juno1qqkhju520klvyj2d4te7nh7xahvq4ulhht3ayvy666lgr0vnpjfqnjayxz gas_prices: 0.075 gas_adjustment: 1.3 threshold: 1000000 diff --git a/croncat/src/modules/tasks.rs b/croncat/src/modules/tasks.rs index 4c54e39c..9e8e40a9 100644 --- a/croncat/src/modules/tasks.rs +++ b/croncat/src/modules/tasks.rs @@ -319,7 +319,7 @@ impl Tasks { from_index += limit; } - // Step 1: Get all the data from ids + // Step 2: Get all the data from ids for id in evented_ids { let mut height_tasks: Vec<(String, TaskInfo)> = Vec::new(); let mut time_tasks: Vec<(String, TaskInfo)> = Vec::new(); diff --git a/croncatd/Cargo.toml b/croncatd/Cargo.toml index 5d602f9e..16720d86 100644 --- a/croncatd/Cargo.toml +++ b/croncatd/Cargo.toml @@ -11,7 +11,7 @@ futures = "0.3" reqwest = { version = "0.11.11", features = ["json"] } serde = { version = "1", features = ["derive"] } serde_json = "1.0" -structopt = "0.3.26" +clap = { version = "4.4.0", features = ["derive", "env"] } [features] debug = [] diff --git a/croncatd/src/cli.rs b/croncatd/src/cli.rs index 9159db01..1c9110d6 100644 --- a/croncatd/src/cli.rs +++ b/croncatd/src/cli.rs @@ -4,7 +4,7 @@ use crate::opts::Opts; use croncat::errors::Report; -use structopt::StructOpt; +use clap::Parser; /// Load the banner ascii art as a `&'static str`. const BANNER_STR: &str = include_str!("../banner.txt"); @@ -20,5 +20,5 @@ pub fn print_banner() { /// Get the command line options. /// pub fn get_opts() -> Result { - Ok(Opts::from_args_safe()?) + Ok(Opts::try_parse()?) } diff --git a/croncatd/src/main.rs b/croncatd/src/main.rs index 8909f3ac..a20a1e52 100644 --- a/croncatd/src/main.rs +++ b/croncatd/src/main.rs @@ -89,12 +89,24 @@ fn main() -> Result<(), Report> { Ok(()) } -async fn run_command(opts: Opts, mut storage: LocalAgentStorage) -> Result<(), Report> { - // Get the key for the agent signing account +async fn run_command(opts: Opts, storage: LocalAgentStorage) -> Result<(), Report> { + // Get the configs for the chains from the config.yaml let config = Config::from_pwd()?; + if opts.cmd.on_chain() { + process_on_chain_command(opts, storage, config).await + } else { + process_off_chain_command(opts, storage, config).await + } +} + +async fn process_on_chain_command( + opts: Opts, + storage: LocalAgentStorage, + config: Config, +) -> Result<(), Report> { // Make sure we have a chain id to run on if opts.chain_id.is_none() { - return Err(eyre!("chain-id is required for go command")); + return Err(eyre!("chain-id is required for on-chain commands")); } let chain_id = opts.chain_id.unwrap(); @@ -312,15 +324,6 @@ async fn run_command(opts: Opts, mut storage: LocalAgentStorage) -> Result<(), R Err(err) => Err(eyre!("Failed to withdraw reward: {}", err))?, } } - opts::Command::ListAccounts => { - println!("Account addresses for agent: {}\n", &opts.agent); - // Get the chain config for the chain we're going to run on - for (chain_id, chain_config) in config.chains { - let account_addr = storage - .get_agent_signing_account_addr(&opts.agent, chain_config.info.bech32_prefix)?; - println!("{chain_id}: {account_addr}"); - } - } opts::Command::Status => { // Print info about the agent let account_addr = account_addr.clone(); @@ -372,12 +375,6 @@ async fn run_command(opts: Opts, mut storage: LocalAgentStorage) -> Result<(), R Err(eyre!("Failed to get agent tasks"))? } } - opts::Command::GenerateMnemonic { new_name, mnemonic } => { - storage.generate_account(new_name.clone(), mnemonic).await?; - println!("Generated agent keys for '{new_name}'"); - println!("Start using it by doing the command: `export CRONCAT_AGENT={new_name}`"); - println!("View the account addresses with command: `cargo run list-accounts`"); - } opts::Command::Update { payable_account_id } => { let res = agent.update(payable_account_id).await; @@ -399,7 +396,6 @@ async fn run_command(opts: Opts, mut storage: LocalAgentStorage) -> Result<(), R ))?, } } - opts::Command::GetAgentKeys { name } => storage.display_account(&name), opts::Command::Go {} => { // Create the global shutdown channel let (shutdown_tx, _shutdown_rx) = create_shutdown_channel(); @@ -426,11 +422,6 @@ async fn run_command(opts: Opts, mut storage: LocalAgentStorage) -> Result<(), R Err(eyre!("Failed to clear local cache"))? } } - opts::Command::SetupService { output } => { - for (chain_id, _) in config.chains { - system::DaemonService::create(output.clone(), &chain_id, opts.no_frills)?; - } - } opts::Command::SendFunds { to, amount, denom } => { let amount = amount.parse::()?; let account_addr = account_addr.clone(); @@ -451,7 +442,40 @@ async fn run_command(opts: Opts, mut storage: LocalAgentStorage) -> Result<(), R Err(err) => Err(err)?, } } + _ => unreachable!(), } Ok(()) } + +async fn process_off_chain_command( + opts: Opts, + mut storage: LocalAgentStorage, + config: Config, +) -> Result<(), Report> { + match opts.cmd { + opts::Command::ListAccounts => { + println!("Account addresses for agent: {}\n", &opts.agent); + // Get the chain config for the chain we're going to run on + for (chain_id, chain_config) in config.chains { + let account_addr = storage + .get_agent_signing_account_addr(&opts.agent, chain_config.info.bech32_prefix)?; + println!("{chain_id}: {account_addr}"); + } + } + opts::Command::GenerateMnemonic { new_name, mnemonic } => { + storage.generate_account(new_name.clone(), mnemonic).await?; + println!("Generated agent keys for '{new_name}'"); + println!("Start using it by doing the command: `export CRONCAT_AGENT={new_name}`"); + println!("View the account addresses with command: `cargo run list-accounts`"); + } + opts::Command::GetAgentKeys { name } => storage.display_account(&name), + opts::Command::SetupService { output } => { + for (chain_id, _) in config.chains { + system::DaemonService::create(output.clone(), &chain_id, opts.no_frills)?; + } + } + _ => unreachable!(), + } + Ok(()) +} diff --git a/croncatd/src/opts.rs b/croncatd/src/opts.rs index cec55893..f7955e60 100644 --- a/croncatd/src/opts.rs +++ b/croncatd/src/opts.rs @@ -2,34 +2,34 @@ //! `croncatd` CLI option builder. //! +use clap::Parser; use croncat::utils::DEFAULT_AGENT_ID; use enum_display::EnumDisplay; -use structopt::StructOpt; -#[derive(Debug, StructOpt, Clone)] -#[structopt(name = "croncatd", about = "The croncat agent daemon.")] +#[derive(Debug, Parser, Clone)] +#[command(name = "croncatd", about = "The croncat agent daemon.")] pub struct Opts { /// Debug mode - #[structopt(short, long)] + #[clap(short, long)] pub debug: bool, /// Whether to print nice little things like the banner and a goodbye - #[structopt(long)] + #[clap(long)] pub no_frills: bool, - #[structopt(subcommand)] // Note that we mark a field as a subcommand + #[clap(subcommand)] // Note that we mark a field as a subcommand pub cmd: Command, /// Chain ID of the chain to connect to - #[structopt(long, global = true, env = "CRONCAT_CHAIN_ID")] + #[clap(long, global = true, env = "CRONCAT_CHAIN_ID")] pub chain_id: Option, /// ID of the agent config to use - #[structopt(long, global = true, default_value = DEFAULT_AGENT_ID, env = "CRONCAT_AGENT")] + #[clap(long, global = true, default_value = DEFAULT_AGENT_ID, env = "CRONCAT_AGENT")] pub agent: String, } -#[derive(Debug, StructOpt, Clone, EnumDisplay)] +#[derive(Debug, Parser, Clone, EnumDisplay)] #[enum_display(case = "Kebab")] pub enum Command { /// Useful for clearing local cached chain tasks @@ -107,3 +107,17 @@ pub enum Command { denom: Option, }, } + +impl Command { + // Determine if this action happens on-chain + pub fn on_chain(&self) -> bool { + // It's reversed, because we have much less off-chain methods + !matches!( + self, + Self::ListAccounts + | Self::GenerateMnemonic { .. } + | Self::GetAgentKeys { .. } + | Self::SetupService { .. } + ) + } +}