diff --git a/crates/astria-cli/src/sequencer/account.rs b/crates/astria-cli/src/sequencer/account.rs index 3d76e1fabf..ba08428453 100644 --- a/crates/astria-cli/src/sequencer/account.rs +++ b/crates/astria-cli/src/sequencer/account.rs @@ -14,35 +14,35 @@ use color_eyre::eyre::{ use rand::rngs::OsRng; #[derive(Debug, clap::Args)] -pub(super) struct Args { +pub(super) struct Command { #[command(subcommand)] - command: Command, + command: SubCommand, } -impl Args { +impl Command { pub(super) async fn run(self) -> eyre::Result<()> { match self.command { - Command::Create(create) => create.run(), - Command::Balance(balance) => balance.run().await, - Command::Nonce(nonce) => nonce.run().await, + SubCommand::Create(create) => create.run(), + SubCommand::Balance(balance) => balance.run().await, + SubCommand::Nonce(nonce) => nonce.run().await, } } } #[derive(Debug, Subcommand)] -enum Command { +enum SubCommand { /// Generates a new ED25519 keypair. - Create(CreateArgs), + Create(Create), /// Queries the Sequencer for the balances of an account. - Balance(BalanceArgs), + Balance(Balance), /// Queries the Sequencer for the current nonce of an account. - Nonce(NonceArgs), + Nonce(Nonce), } #[derive(Debug, clap::Args)] -struct CreateArgs; +struct Create; -impl CreateArgs { +impl Create { #[expect( clippy::unused_self, clippy::unnecessary_wraps, @@ -65,12 +65,12 @@ impl CreateArgs { } #[derive(Debug, clap::Args)] -struct BalanceArgs { +struct Balance { #[command(flatten)] inner: ArgsInner, } -impl BalanceArgs { +impl Balance { async fn run(self) -> eyre::Result<()> { let args = self.inner; let sequencer_client = HttpClient::new(args.sequencer_url.as_str()) @@ -91,12 +91,12 @@ impl BalanceArgs { } #[derive(Debug, clap::Args)] -struct NonceArgs { +struct Nonce { #[command(flatten)] inner: ArgsInner, } -impl NonceArgs { +impl Nonce { async fn run(self) -> eyre::Result<()> { let args = self.inner; let sequencer_client = HttpClient::new(args.sequencer_url.as_str()) diff --git a/crates/astria-cli/src/sequencer/address.rs b/crates/astria-cli/src/sequencer/address.rs index 952211e52b..fa7dcee7cb 100644 --- a/crates/astria-cli/src/sequencer/address.rs +++ b/crates/astria-cli/src/sequencer/address.rs @@ -1,6 +1,5 @@ use astria_core::primitive::v1::{ Address, - Bech32m, ADDRESS_LEN, }; use color_eyre::eyre::{ @@ -9,26 +8,26 @@ use color_eyre::eyre::{ }; #[derive(Debug, clap::Args)] -pub(super) struct Args { +pub(super) struct Command { #[command(subcommand)] - command: Command, + command: SubCommand, } -impl Args { +impl Command { pub(super) fn run(self) -> eyre::Result<()> { - let Command::Bech32m(bech32m) = self.command; + let SubCommand::Bech32m(bech32m) = self.command; bech32m.run() } } #[derive(Debug, clap::Subcommand)] -enum Command { +enum SubCommand { /// Returns a bech32m sequencer address given a prefix and hex-encoded byte slice - Bech32m(Bech32mArgs), + Bech32m(Bech32m), } #[derive(Debug, clap::Args)] -struct Bech32mArgs { +struct Bech32m { /// The hex formatted byte part of the bech32m address #[arg(long)] bytes: String, @@ -37,12 +36,12 @@ struct Bech32mArgs { prefix: String, } -impl Bech32mArgs { +impl Bech32m { fn run(self) -> eyre::Result<()> { use hex::FromHex as _; let bytes = <[u8; ADDRESS_LEN]>::from_hex(&self.bytes) .wrap_err("failed decoding provided hex bytes")?; - let address = Address::::builder() + let address = Address::::builder() .array(bytes) .prefix(&self.prefix) .try_build() diff --git a/crates/astria-cli/src/sequencer/balance.rs b/crates/astria-cli/src/sequencer/balance.rs index 8d99bac8c2..2533dcc122 100644 --- a/crates/astria-cli/src/sequencer/balance.rs +++ b/crates/astria-cli/src/sequencer/balance.rs @@ -10,26 +10,26 @@ use color_eyre::eyre::{ }; #[derive(Debug, clap::Args)] -pub(super) struct Args { +pub(super) struct Command { #[command(subcommand)] - command: Command, + command: SubCommand, } -impl Args { +impl Command { pub(super) async fn run(self) -> eyre::Result<()> { - let Command::Get(get) = self.command; + let SubCommand::Get(get) = self.command; get.run().await } } #[derive(Debug, Subcommand)] -enum Command { +enum SubCommand { /// Get the balance of a Sequencer account - Get(GetArgs), + Get(Get), } #[derive(clap::Args, Debug)] -struct GetArgs { +struct Get { /// The url of the Sequencer node #[arg( long, @@ -41,7 +41,7 @@ struct GetArgs { address: Address, } -impl GetArgs { +impl Get { async fn run(self) -> eyre::Result<()> { let sequencer_client = HttpClient::new(self.sequencer_url.as_str()) .wrap_err("failed constructing http sequencer client")?; diff --git a/crates/astria-cli/src/sequencer/block_height.rs b/crates/astria-cli/src/sequencer/block_height.rs index 1435f0977e..6e9f1df628 100644 --- a/crates/astria-cli/src/sequencer/block_height.rs +++ b/crates/astria-cli/src/sequencer/block_height.rs @@ -9,26 +9,26 @@ use color_eyre::eyre::{ }; #[derive(Debug, clap::Args)] -pub(super) struct Args { +pub(super) struct Command { #[command(subcommand)] - command: Command, + command: SubCommand, } -impl Args { +impl Command { pub(super) async fn run(self) -> eyre::Result<()> { - let Command::Get(get) = self.command; + let SubCommand::Get(get) = self.command; get.run().await } } #[derive(Debug, Subcommand)] -enum Command { +enum SubCommand { /// Get the current block height of the Sequencer node - Get(GetArgs), + Get(Get), } #[derive(clap::Args, Debug)] -struct GetArgs { +struct Get { /// The url of the Sequencer node #[arg( long, @@ -45,7 +45,7 @@ struct GetArgs { sequencer_chain_id: String, } -impl GetArgs { +impl Get { async fn run(self) -> eyre::Result<()> { let sequencer_client = HttpClient::new(self.sequencer_url.as_str()) .wrap_err("failed constructing http sequencer client")?; diff --git a/crates/astria-cli/src/sequencer/bridge_lock.rs b/crates/astria-cli/src/sequencer/bridge_lock.rs index 4c964876d3..baeabbc717 100644 --- a/crates/astria-cli/src/sequencer/bridge_lock.rs +++ b/crates/astria-cli/src/sequencer/bridge_lock.rs @@ -16,7 +16,7 @@ use color_eyre::eyre::{ use crate::utils::submit_transaction; #[derive(clap::Args, Debug)] -pub(super) struct Args { +pub(super) struct Command { /// The address of the Sequencer account to lock amount to to_address: Address, /// The amount being locked @@ -55,7 +55,7 @@ pub(super) struct Args { fee_asset: asset::Denom, } -impl Args { +impl Command { pub(super) async fn run(self) -> eyre::Result<()> { let res = submit_transaction( self.sequencer_url.as_str(), diff --git a/crates/astria-cli/src/sequencer/init_bridge_account.rs b/crates/astria-cli/src/sequencer/init_bridge_account.rs index a7b8f99bb4..1e411457eb 100644 --- a/crates/astria-cli/src/sequencer/init_bridge_account.rs +++ b/crates/astria-cli/src/sequencer/init_bridge_account.rs @@ -11,7 +11,7 @@ use color_eyre::eyre::{ }; #[derive(clap::Args, Debug)] -pub(super) struct Args { +pub(super) struct Command { /// The bech32m prefix that will be used for constructing addresses using the private key #[arg(long, default_value = "astria")] prefix: String, @@ -47,7 +47,7 @@ pub(super) struct Args { fee_asset: asset::Denom, } -impl Args { +impl Command { pub(super) async fn run(self) -> eyre::Result<()> { use astria_core::primitive::v1::RollupId; diff --git a/crates/astria-cli/src/sequencer/mod.rs b/crates/astria-cli/src/sequencer/mod.rs index 8143197538..d0bc48982a 100644 --- a/crates/astria-cli/src/sequencer/mod.rs +++ b/crates/astria-cli/src/sequencer/mod.rs @@ -35,20 +35,20 @@ impl Args { #[derive(Debug, Subcommand)] enum Command { /// Commands for interacting with Sequencer accounts - Account(account::Args), + Account(account::Command), /// Utilities for constructing and inspecting sequencer addresses - Address(address::Args), + Address(address::Command), /// Commands for interacting with Sequencer balances - Balance(balance::Args), + Balance(balance::Command), /// Commands for interacting with Sequencer block heights #[command(name = "blockheight")] - BlockHeight(block_height::Args), + BlockHeight(block_height::Command), /// Command for transferring to a bridge account - BridgeLock(bridge_lock::Args), + BridgeLock(bridge_lock::Command), /// Command for initializing a bridge account - InitBridgeAccount(init_bridge_account::Args), + InitBridgeAccount(init_bridge_account::Command), /// Commands requiring authority for Sequencer - Sudo(sudo::Args), + Sudo(sudo::Command), /// Command for sending balance between accounts - Transfer(transfer::Args), + Transfer(transfer::Command), } diff --git a/crates/astria-cli/src/sequencer/sudo/fee_asset.rs b/crates/astria-cli/src/sequencer/sudo/fee_asset.rs index a1bde7b8b4..181c833cda 100644 --- a/crates/astria-cli/src/sequencer/sudo/fee_asset.rs +++ b/crates/astria-cli/src/sequencer/sudo/fee_asset.rs @@ -14,35 +14,35 @@ use color_eyre::eyre::{ use crate::utils::submit_transaction; #[derive(Debug, clap::Args)] -pub(super) struct Args { +pub(super) struct Command { #[command(subcommand)] - command: Command, + command: SubCommand, } -impl Args { +impl Command { pub(super) async fn run(self) -> eyre::Result<()> { match self.command { - Command::Add(add) => add.run().await, - Command::Remove(remove) => remove.run().await, + SubCommand::Add(add) => add.run().await, + SubCommand::Remove(remove) => remove.run().await, } } } #[derive(Debug, Subcommand)] -enum Command { +enum SubCommand { /// Add Fee Asset - Add(AddArgs), + Add(Add), /// Remove Fee Asset - Remove(RemoveArgs), + Remove(Remove), } #[derive(Clone, Debug, clap::Args)] -struct AddArgs { +struct Add { #[command(flatten)] inner: ArgsInner, } -impl AddArgs { +impl Add { async fn run(self) -> eyre::Result<()> { let args = self.inner; let res = submit_transaction( @@ -62,12 +62,12 @@ impl AddArgs { } #[derive(Clone, Debug, clap::Args)] -struct RemoveArgs { +struct Remove { #[command(flatten)] inner: ArgsInner, } -impl RemoveArgs { +impl Remove { async fn run(self) -> eyre::Result<()> { let args = self.inner; let res = submit_transaction( diff --git a/crates/astria-cli/src/sequencer/sudo/ibc_relayer.rs b/crates/astria-cli/src/sequencer/sudo/ibc_relayer.rs index 426a8ddc70..f8c190b157 100644 --- a/crates/astria-cli/src/sequencer/sudo/ibc_relayer.rs +++ b/crates/astria-cli/src/sequencer/sudo/ibc_relayer.rs @@ -13,33 +13,33 @@ use color_eyre::{ use crate::utils::submit_transaction; #[derive(Debug, clap::Args)] -pub(super) struct Args { +pub(super) struct Command { #[command(subcommand)] - command: Command, + command: SubCommand, } -impl Args { +impl Command { pub(super) async fn run(self) -> eyre::Result<()> { match self.command { - Command::Add(add) => add.run().await, - Command::Remove(remove) => remove.run().await, + SubCommand::Add(add) => add.run().await, + SubCommand::Remove(remove) => remove.run().await, } } } #[derive(Debug, clap::Subcommand)] -enum Command { - Add(AddArgs), - Remove(RemoveArgs), +enum SubCommand { + Add(Add), + Remove(Remove), } #[derive(Debug, clap::Args)] -struct AddArgs { +struct Add { #[command(flatten)] inner: ArgsInner, } -impl AddArgs { +impl Add { async fn run(self) -> eyre::Result<()> { let args = self.inner; let res = submit_transaction( @@ -59,12 +59,12 @@ impl AddArgs { } #[derive(Debug, clap::Args)] -struct RemoveArgs { +struct Remove { #[command(flatten)] inner: ArgsInner, } -impl RemoveArgs { +impl Remove { async fn run(self) -> eyre::Result<()> { let args = self.inner; let res = submit_transaction( diff --git a/crates/astria-cli/src/sequencer/sudo/mod.rs b/crates/astria-cli/src/sequencer/sudo/mod.rs index 368766bc45..b983d2eb03 100644 --- a/crates/astria-cli/src/sequencer/sudo/mod.rs +++ b/crates/astria-cli/src/sequencer/sudo/mod.rs @@ -6,26 +6,26 @@ mod sudo_address_change; mod validator_update; #[derive(Debug, clap::Args)] -pub(super) struct Args { +pub(super) struct Command { #[command(subcommand)] - command: Command, + command: SubCommand, } -impl Args { +impl Command { pub(super) async fn run(self) -> eyre::Result<()> { match self.command { - Command::IbcRelayer(ibc_relayer) => ibc_relayer.run().await, - Command::FeeAsset(fee_asset) => fee_asset.run().await, - Command::SudoAddressChange(sudo_address_change) => sudo_address_change.run().await, - Command::ValidatorUpdate(validator_update) => validator_update.run().await, + SubCommand::IbcRelayer(ibc_relayer) => ibc_relayer.run().await, + SubCommand::FeeAsset(fee_asset) => fee_asset.run().await, + SubCommand::SudoAddressChange(sudo_address_change) => sudo_address_change.run().await, + SubCommand::ValidatorUpdate(validator_update) => validator_update.run().await, } } } #[derive(Debug, clap::Subcommand)] -enum Command { - IbcRelayer(ibc_relayer::Args), - FeeAsset(fee_asset::Args), - SudoAddressChange(sudo_address_change::Args), - ValidatorUpdate(validator_update::Args), +enum SubCommand { + IbcRelayer(ibc_relayer::Command), + FeeAsset(fee_asset::Command), + SudoAddressChange(sudo_address_change::Command), + ValidatorUpdate(validator_update::Command), } diff --git a/crates/astria-cli/src/sequencer/sudo/sudo_address_change.rs b/crates/astria-cli/src/sequencer/sudo/sudo_address_change.rs index 70df073977..f93277440e 100644 --- a/crates/astria-cli/src/sequencer/sudo/sudo_address_change.rs +++ b/crates/astria-cli/src/sequencer/sudo/sudo_address_change.rs @@ -13,7 +13,7 @@ use color_eyre::eyre::{ use crate::utils::submit_transaction; #[derive(Debug, clap::Args)] -pub(super) struct Args { +pub(super) struct Command { /// The bech32m prefix that will be used for constructing addresses using the private key #[arg(long, default_value = "astria")] prefix: String, @@ -42,7 +42,7 @@ pub(super) struct Args { address: Address, } -impl Args { +impl Command { pub(super) async fn run(self) -> eyre::Result<()> { let res = submit_transaction( self.sequencer_url.as_str(), diff --git a/crates/astria-cli/src/sequencer/sudo/validator_update.rs b/crates/astria-cli/src/sequencer/sudo/validator_update.rs index 15ba795487..bcbca1832f 100644 --- a/crates/astria-cli/src/sequencer/sudo/validator_update.rs +++ b/crates/astria-cli/src/sequencer/sudo/validator_update.rs @@ -10,7 +10,7 @@ use color_eyre::eyre::{ use crate::utils::submit_transaction; #[derive(clap::Args, Debug)] -pub(super) struct Args { +pub(super) struct Command { /// The url of the Sequencer node #[arg( long, @@ -43,7 +43,7 @@ pub(super) struct Args { power: u32, } -impl Args { +impl Command { pub(super) async fn run(self) -> eyre::Result<()> { let verification_key = astria_core::crypto::VerificationKey::try_from( &*hex::decode(&self.validator_public_key) diff --git a/crates/astria-cli/src/sequencer/transfer.rs b/crates/astria-cli/src/sequencer/transfer.rs index 98ee7cb3a0..648156cd3e 100644 --- a/crates/astria-cli/src/sequencer/transfer.rs +++ b/crates/astria-cli/src/sequencer/transfer.rs @@ -16,7 +16,7 @@ use color_eyre::eyre::{ use crate::utils::submit_transaction; #[derive(clap::Args, Debug)] -pub(super) struct Args { +pub(super) struct Command { // The address of the Sequencer account to send amount to to_address: Address, // The amount being sent @@ -54,7 +54,7 @@ pub(super) struct Args { fee_asset: asset::Denom, } -impl Args { +impl Command { pub(super) async fn run(self) -> eyre::Result<()> { let res = submit_transaction( self.sequencer_url.as_str(),