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

Rename transaction-path arg to wasm-path #231

Open
wants to merge 3 commits into
base: feat-track-node-2.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion lib/json_rpc/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use serde_json::json;

const RPC_API_PATH: &str = "rpc";
#[cfg(not(target_arch = "wasm32"))]
const REQUEST_TIMEOUT: Duration = Duration::from_secs(5);
const REQUEST_TIMEOUT: Duration = Duration::from_secs(15);

/// Statically declared client used when making HTTP requests
/// so opened connections are pooled.
Expand Down
8 changes: 3 additions & 5 deletions src/deploy/creation_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -572,11 +572,9 @@ pub(super) fn apply_common_creation_options(
);

if include_node_address {
subcommand = subcommand.arg(
common::node_address::arg(DisplayOrder::NodeAddress as usize)
.required_unless_present(show_simple_arg_examples::ARG_NAME)
.required_unless_present(show_json_args_examples::ARG_NAME),
);
subcommand = subcommand.arg(common::node_address::arg(
DisplayOrder::NodeAddress as usize,
));
}

let secret_key_arg = if require_secret_key {
Expand Down
29 changes: 13 additions & 16 deletions src/transaction/creation_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -690,11 +690,9 @@ pub(super) fn apply_common_creation_options(
include_transaction_args: bool,
) -> Command {
if include_node_address {
subcommand = subcommand.arg(
common::node_address::arg(DisplayOrder::NodeAddress as usize)
.required_unless_present(show_simple_arg_examples::ARG_NAME)
.required_unless_present(show_json_args_examples::ARG_NAME),
);
subcommand = subcommand.arg(common::node_address::arg(
DisplayOrder::NodeAddress as usize,
));
}

let secret_key_arg = if require_secret_key {
Expand Down Expand Up @@ -817,13 +815,13 @@ pub(super) mod output {
}
}

pub(super) mod transaction_path {
pub(super) mod wasm_path {
use super::*;

const ARG_NAME: &str = "transaction-path";
const ARG_SHORT: char = 't';
const ARG_NAME: &str = "wasm-path";
const ARG_SHORT: char = 'w';
const ARG_VALUE_NAME: &str = common::ARG_PATH;
const ARG_HELP: &str = "Path to input transaction file";
const ARG_HELP: &str = "Path to compiled Wasm session code";

pub fn arg() -> Arg {
Arg::new(ARG_NAME)
Expand Down Expand Up @@ -2284,17 +2282,16 @@ pub(super) mod session {
show_simple_arg_examples_and_exit_if_required(matches);
show_json_args_examples_and_exit_if_required(matches);

let transaction_path_str = transaction_path::get(matches);
let wasm_path_str = wasm_path::get(matches);

if transaction_path_str.is_none() {
if wasm_path_str.is_none() {
return Err(CliError::InvalidArgument {
context: "transaction_path",
error: "Transaction path cannot be empty".to_string(),
context: "wasm_path",
error: "Wasm path cannot be empty".to_string(),
});
}

let transaction_bytes =
parse::transaction_module_bytes(transaction_path_str.unwrap_or_default())?;
let transaction_bytes = parse::transaction_module_bytes(wasm_path_str.unwrap_or_default())?;

let is_install_upgrade: bool = is_install_upgrade::get(matches);
let runtime = get_transaction_runtime(matches)?;
Expand All @@ -2310,7 +2307,7 @@ pub(super) mod session {

fn add_args(session_subcommand: Command) -> Command {
session_subcommand
.arg(transaction_path::arg())
.arg(wasm_path::arg())
.arg(session_entry_point::arg())
.arg(is_install_upgrade::arg(
DisplayOrder::IsInstallUpgrade as usize,
Expand Down
4 changes: 2 additions & 2 deletions src/transaction/send.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ impl ClientCommand for SendTransaction {
))
.arg(common::rpc_id::arg(DisplayOrder::RpcId as usize))
.arg(creation_common::speculative_exec::arg())
.arg(creation_common::transaction_path::arg())
.arg(creation_common::wasm_path::arg())
}

async fn run(matches: &ArgMatches) -> Result<Success, CliError> {
let is_speculative_exec = creation_common::speculative_exec::get(matches);
let maybe_rpc_id = common::rpc_id::get(matches);
let node_address = common::node_address::get(matches);
let verbosity_level = common::verbose::get(matches);
let input_path = creation_common::transaction_path::get(matches).unwrap_or_default();
let input_path = creation_common::wasm_path::get(matches).unwrap_or_default();
if input_path.is_empty() {
return Err(CliError::InvalidArgument {
context: "send_deploy",
Expand Down
4 changes: 2 additions & 2 deletions src/transaction/sign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl ClientCommand for SignTransaction {
common::secret_key::arg(creation_common::DisplayOrder::SecretKey as usize, "")
.required(true),
)
.arg(creation_common::transaction_path::arg())
.arg(creation_common::wasm_path::arg())
.arg(creation_common::output::arg())
.arg(common::force::arg(
creation_common::DisplayOrder::Force as usize,
Expand All @@ -32,7 +32,7 @@ impl ClientCommand for SignTransaction {
}

async fn run(matches: &ArgMatches) -> Result<Success, CliError> {
let input_path = creation_common::transaction_path::get(matches).unwrap_or_default();
let input_path = creation_common::wasm_path::get(matches).unwrap_or_default();
let secret_key = common::secret_key::get(matches).unwrap_or_default();
let maybe_output_path = creation_common::output::get(matches).unwrap_or_default();
let force = common::force::get(matches);
Expand Down
Loading