Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add put-deploy deprecation warning #224

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/cli/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ pub async fn put_deploy(
let rpc_id = parse::rpc_id(maybe_rpc_id);
let verbosity = parse::verbosity(verbosity_level);
let deploy = with_payment_and_session(deploy_params, payment_params, session_params, false)?;
#[allow(deprecated)]
crate::put_deploy(rpc_id, node_address, verbosity, deploy)
.await
.map_err(CliError::from)
Expand Down Expand Up @@ -115,6 +116,7 @@ pub async fn send_deploy_file(
let rpc_id = parse::rpc_id(maybe_rpc_id);
let verbosity = parse::verbosity(verbosity_level);
let deploy = crate::read_deploy_file(input_path)?;
#[allow(deprecated)]
crate::put_deploy(rpc_id, node_address, verbosity, deploy)
.await
.map_err(CliError::from)
Expand Down Expand Up @@ -170,6 +172,7 @@ pub async fn transfer(
payment_params,
false,
)?;
#[allow(deprecated)]
crate::put_deploy(rpc_id, node_address, verbosity, deploy)
.await
.map_err(CliError::from)
Expand Down
1 change: 1 addition & 0 deletions lib/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ pub const MAX_SERIALIZED_SIZE_OF_DEPLOY: u32 = 1_024 * 1_024;
/// Sends a JSON-RPC `account_put_deploy` request to the specified node.
///
/// For details of the parameters, see [the module docs](crate#common-parameters).
#[deprecated(since = "3.0.0", note = "use `put_transaction` instead")]
pub async fn put_deploy(
rpc_id: JsonRpcId,
node_address: &str,
Expand Down
15 changes: 14 additions & 1 deletion src/deploy/put.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,20 @@ use crate::{command::ClientCommand, common, Success};

pub struct PutDeploy;

static DEPRECATION_WARNING: &str = r#"
#################################### WARNING ####################################
# #
# put-deploy subcommand is deprecated in favor of put-transaction #
# and will be removed in a future release #
# #
#################################################################################
"#;

#[async_trait]
impl ClientCommand for PutDeploy {
const NAME: &'static str = "put-deploy";
const ABOUT: &'static str = "Create a deploy and send it to the network for execution";
const ABOUT: &'static str =
"[DEPRECATED: use `put-transaction` instead] Create a deploy and send it to the network for execution";

fn build(display_order: usize) -> Command {
let subcommand = Command::new(Self::NAME)
Expand All @@ -27,6 +37,9 @@ impl ClientCommand for PutDeploy {
}

async fn run(matches: &ArgMatches) -> Result<Success, CliError> {
// show deprecation warning for each use of `put-deploy` subcommand
println!("{DEPRECATION_WARNING}");

creation_common::show_simple_arg_examples_and_exit_if_required(matches);
creation_common::show_json_args_examples_and_exit_if_required(matches);

Expand Down
Loading