From 1969f4ae994aa93db459986f0a9a805023c1b58a Mon Sep 17 00:00:00 2001 From: Hubert Bugaj Date: Thu, 28 Aug 2025 14:21:29 +0200 Subject: [PATCH] chore: remove deprecated `forest-cli send` --- CHANGELOG.md | 2 + src/cli/main.rs | 1 - src/cli/subcommands/mod.rs | 9 +---- src/cli/subcommands/send_cmd.rs | 65 --------------------------------- 4 files changed, 4 insertions(+), 73 deletions(-) delete mode 100644 src/cli/subcommands/send_cmd.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index 0eb58ecaf33d..a174cc4f3f2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,8 @@ ### Removed +- [#6010](https://github.com/ChainSafe/forest/pull/6010) Removed the deprecated `forest-cli send` subcommand. Use `forest-wallet send` instead. + ### Fixed ## Forest v0.29.0 "Fëanor" diff --git a/src/cli/main.rs b/src/cli/main.rs index c0b17e0e79e1..50aabf58b6dc 100644 --- a/src/cli/main.rs +++ b/src/cli/main.rs @@ -42,7 +42,6 @@ where Subcommand::Mpool(cmd) => cmd.run(client).await, Subcommand::State(cmd) => cmd.run(client).await, Subcommand::Config(cmd) => cmd.run(&mut std::io::stdout()), - Subcommand::Send(cmd) => cmd.run(client).await, Subcommand::Info(cmd) => cmd.run(client).await, Subcommand::Snapshot(cmd) => cmd.run(client).await, Subcommand::Shutdown(cmd) => cmd.run(client).await, diff --git a/src/cli/subcommands/mod.rs b/src/cli/subcommands/mod.rs index 1a39dd8061e7..bbb39793a7e9 100644 --- a/src/cli/subcommands/mod.rs +++ b/src/cli/subcommands/mod.rs @@ -14,7 +14,6 @@ mod healthcheck_cmd; mod info_cmd; mod mpool_cmd; mod net_cmd; -pub(crate) mod send_cmd; mod shutdown_cmd; mod snapshot_cmd; mod state_cmd; @@ -31,9 +30,8 @@ use tracing::error; pub(super) use self::{ auth_cmd::AuthCommands, chain_cmd::ChainCommands, config_cmd::ConfigCommands, f3_cmd::F3Commands, healthcheck_cmd::HealthcheckCommand, mpool_cmd::MpoolCommands, - net_cmd::NetCommands, send_cmd::SendCommand, shutdown_cmd::ShutdownCommand, - snapshot_cmd::SnapshotCommands, state_cmd::StateCommands, sync_cmd::SyncCommands, - wait_api_cmd::WaitApiCommand, + net_cmd::NetCommands, shutdown_cmd::ShutdownCommand, snapshot_cmd::SnapshotCommands, + state_cmd::StateCommands, sync_cmd::SyncCommands, wait_api_cmd::WaitApiCommand, }; use crate::cli::subcommands::info_cmd::InfoCommand; @@ -85,9 +83,6 @@ pub enum Subcommand { #[command(subcommand)] Snapshot(SnapshotCommands), - /// Send funds between accounts - Send(SendCommand), - /// Print node info #[command(subcommand)] Info(InfoCommand), diff --git a/src/cli/subcommands/send_cmd.rs b/src/cli/subcommands/send_cmd.rs deleted file mode 100644 index cabbd3e3a358..000000000000 --- a/src/cli/subcommands/send_cmd.rs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2019-2025 ChainSafe Systems -// SPDX-License-Identifier: Apache-2.0, MIT - -use std::str::FromStr as _; - -use crate::rpc::{self, prelude::*}; -use crate::shim::address::{Address, StrictAddress}; -use crate::shim::econ::TokenAmount; -use crate::shim::message::{METHOD_SEND, Message}; -use anyhow::Context as _; -use num::Zero as _; - -use crate::cli::humantoken; - -#[derive(Debug, clap::Args)] -pub struct SendCommand { - /// optionally specify the account to send funds from (otherwise the default - /// one will be used) - #[arg(long)] - from: Option, - target_address: String, - #[arg(value_parser = humantoken::parse)] - amount: TokenAmount, - #[arg(long, value_parser = humantoken::parse, default_value_t = TokenAmount::zero())] - gas_feecap: TokenAmount, - /// In milliGas - #[arg(long, default_value_t = 0)] - gas_limit: i64, - #[arg(long, value_parser = humantoken::parse, default_value_t = TokenAmount::zero())] - gas_premium: TokenAmount, -} - -impl SendCommand { - pub async fn run(self, client: rpc::Client) -> anyhow::Result<()> { - eprintln!( - "This command has been deprecated and will be removed in the future.\n\ - Please use the 'forest-wallet' executable instead." - ); - - let from: Address = if let Some(from) = &self.from { - StrictAddress::from_str(from)?.into() - } else { - WalletDefaultAddress::call(&client, ()) - .await? - .context("No default wallet address selected. Please set a default address.")? - }; - - let message = Message { - from, - to: StrictAddress::from_str(&self.target_address)?.into(), - value: self.amount.clone(), - method_num: METHOD_SEND, - gas_limit: self.gas_limit as u64, - gas_fee_cap: self.gas_feecap.clone(), - gas_premium: self.gas_premium.clone(), - ..Default::default() - }; - - let signed_msg = MpoolPushMessage::call(&client, (message, None)).await?; - - println!("{}", signed_msg.cid()); - - Ok(()) - } -}