Skip to content
Merged
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
46 changes: 23 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ name = "near"
path = "src/main.rs"

[dependencies]
clap = { version = "4.0.18", features = ["derive"] }
fast_clap = { version = "4.5.57", features = ["derive", "unstable-v5"] }
inquire = "0.9.3"
strum = { version = "0.24", features = ["derive"] }
strum_macros = "0.24"
Expand Down
20 changes: 10 additions & 10 deletions src/js_command_match/account/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@ use crate::js_command_match::constants::{
#[derive(Debug, Clone, clap::Parser)]
pub struct CreateAccountArgs {
new_account_id: String,
#[clap(long, aliases = USE_FAUCET_ALIASES, default_value_t = false)]
#[arg(long, aliases = USE_FAUCET_ALIASES, default_value_t = false)]
use_faucet: bool,
#[clap(long, aliases = USE_ACCOUNT_ALIASES, conflicts_with = "use_faucet")]
#[arg(long, aliases = USE_ACCOUNT_ALIASES, conflicts_with = "use_faucet")]
use_account: Option<String>,
#[clap(long, aliases = INITIAL_BALANCE_ALIASES, default_value = "1")]
#[arg(long, aliases = INITIAL_BALANCE_ALIASES, default_value = "1")]
initial_balance: String,
#[clap(long, aliases = PUBLIC_KEY_ALIASES)]
#[arg(long, aliases = PUBLIC_KEY_ALIASES)]
public_key: Option<String>,
#[clap(long, aliases = SEED_PHRASE_ALIASES, conflicts_with = "public_key")]
#[arg(long, aliases = SEED_PHRASE_ALIASES, conflicts_with = "public_key")]
seed_phrase: Option<String>,
#[clap(long, aliases = SIGN_WITH_LEDGER_ALIASES, default_value_t = false, conflicts_with="use_faucet")]
#[arg(long, aliases = SIGN_WITH_LEDGER_ALIASES, default_value_t = false, conflicts_with="use_faucet")]
sign_with_ledger: bool,
#[clap(long, aliases = LEDGER_PATH_ALIASES, default_value = DEFAULT_SEED_PHRASE_PATH)]
#[arg(long, aliases = LEDGER_PATH_ALIASES, default_value = DEFAULT_SEED_PHRASE_PATH)]
ledger_path: String,
#[clap(long, aliases = USE_LEDGER_PK_ALIASES, default_value_t = false, conflicts_with = "public_key")]
#[arg(long, aliases = USE_LEDGER_PK_ALIASES, default_value_t = false, conflicts_with = "public_key")]
use_ledger_pk: bool,
#[clap(long, aliases = PK_LEDGER_PATH_ALIASES, default_value = DEFAULT_SEED_PHRASE_PATH)]
#[arg(long, aliases = PK_LEDGER_PATH_ALIASES, default_value = DEFAULT_SEED_PHRASE_PATH)]
pk_ledger_path: String,
#[clap(long, aliases = NETWORK_ID_ALIASES)]
#[arg(long, aliases = NETWORK_ID_ALIASES)]
network_id: Option<String>,
}

Expand Down
8 changes: 4 additions & 4 deletions src/js_command_match/account/delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ use crate::js_command_match::constants::{
pub struct DeleteAccountArgs {
account_id: String,
beneficiary_id: String,
#[clap(long, aliases = SIGN_WITH_LEDGER_ALIASES, default_value_t = false)]
#[arg(long, aliases = SIGN_WITH_LEDGER_ALIASES, default_value_t = false)]
sign_with_ledger: bool,
#[clap(long, aliases = LEDGER_PATH_ALIASES, default_value = DEFAULT_SEED_PHRASE_PATH)]
#[arg(long, aliases = LEDGER_PATH_ALIASES, default_value = DEFAULT_SEED_PHRASE_PATH)]
ledger_path: String,
#[clap(long, aliases = NETWORK_ID_ALIASES)]
#[arg(long, aliases = NETWORK_ID_ALIASES)]
network_id: Option<String>,
#[clap(long, default_value_t = false)]
#[arg(long, default_value_t = false)]
force: bool,
}

Expand Down
2 changes: 1 addition & 1 deletion src/js_command_match/account/login.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::js_command_match::constants::NETWORK_ID_ALIASES;
#[derive(Debug, Clone, clap::Parser)]
/// This is a legacy `legacy` command. Once you run it with the specified arguments, new syntax command will be suggested.
pub struct LoginArgs {
#[clap(long, aliases = NETWORK_ID_ALIASES)]
#[arg(long, aliases = NETWORK_ID_ALIASES)]
network_id: Option<String>,
}

Expand Down
2 changes: 1 addition & 1 deletion src/js_command_match/account/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::js_command_match::constants::NETWORK_ID_ALIASES;
#[derive(Debug, Clone, clap::Parser)]
pub struct StateArgs {
account_id: String,
#[clap(long, aliases = NETWORK_ID_ALIASES)]
#[arg(long, aliases = NETWORK_ID_ALIASES)]
network_id: Option<String>,
}

Expand Down
20 changes: 10 additions & 10 deletions src/js_command_match/contract/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,25 @@ use crate::js_command_match::constants::{
pub struct CallArgs {
contract_name: String,
method_name: String,
#[clap(default_value = "{}")]
#[arg(default_value = "{}")]
args: String,
#[clap(long, aliases = USE_ACCOUNT_ALIASES)]
#[arg(long, aliases = USE_ACCOUNT_ALIASES)]
use_account: String,
#[clap(long, aliases = SIGN_WITH_LEDGER_ALIASES, default_value_t = false)]
#[arg(long, aliases = SIGN_WITH_LEDGER_ALIASES, default_value_t = false)]
sign_with_ledger: bool,
#[clap(long, aliases = LEDGER_PATH_ALIASES, default_value = DEFAULT_SEED_PHRASE_PATH)]
#[arg(long, aliases = LEDGER_PATH_ALIASES, default_value = DEFAULT_SEED_PHRASE_PATH)]
ledger_path: String,
#[clap(long, default_value_t = 30_000_000_000_000)]
#[arg(long, default_value_t = 30_000_000_000_000)]
gas: u64,
#[clap(long, default_value = "0")]
#[arg(long, default_value = "0")]
deposit: String,
#[clap(long, default_value = "0", conflicts_with = "deposit", aliases = ["depositYocto"])]
#[arg(long, default_value = "0", conflicts_with = "deposit", aliases = ["depositYocto"])]
deposit_yocto: String,
#[clap(long, default_value_t = false)]
#[arg(long, default_value_t = false)]
base64: bool,
#[clap(long, aliases = ["privateKey"])]
#[arg(long, aliases = ["privateKey"])]
private_key: Option<String>,
#[clap(long, aliases = NETWORK_ID_ALIASES)]
#[arg(long, aliases = NETWORK_ID_ALIASES)]
network_id: Option<String>,
}

Expand Down
14 changes: 7 additions & 7 deletions src/js_command_match/contract/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ use crate::js_command_match::constants::{
#[derive(Debug, Clone, clap::Parser)]
pub struct DeployArgs {
account_id: String,
#[clap(required_unless_present = "wasm_file")]
#[arg(required_unless_present = "wasm_file")]
wasm_file_path: Option<String>,
#[clap(long, aliases = WASM_FILE_ALIASES )]
#[arg(long, aliases = WASM_FILE_ALIASES )]
wasm_file: Option<String>,
#[clap(long, aliases = INIT_FUNCTION_ALIASES)]
#[arg(long, aliases = INIT_FUNCTION_ALIASES)]
init_function: Option<String>,
#[clap(long, aliases = INIT_ARGS_ALIASES, default_value = "{}")]
#[arg(long, aliases = INIT_ARGS_ALIASES, default_value = "{}")]
init_args: String,
#[clap(long, aliases = INIT_GAS_ALIASES, default_value_t = 30_000_000_000_000)]
#[arg(long, aliases = INIT_GAS_ALIASES, default_value_t = 30_000_000_000_000)]
init_gas: u64,
#[clap(long, aliases = INIT_DEPOSIT_ALIASES, default_value = "0")]
#[arg(long, aliases = INIT_DEPOSIT_ALIASES, default_value = "0")]
init_deposit: String,
#[clap(long, aliases = NETWORK_ID_ALIASES)]
#[arg(long, aliases = NETWORK_ID_ALIASES)]
network_id: Option<String>,
}

Expand Down
10 changes: 5 additions & 5 deletions src/js_command_match/contract/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ use crate::js_command_match::constants::{BLOCK_ID_ALIASES, NETWORK_ID_ALIASES};
#[derive(Debug, Clone, clap::Parser)]
pub struct ViewStateArgs {
account_id: String,
#[clap(long)]
#[arg(long)]
prefix: Option<String>,
#[clap(long, default_value_t = false)]
#[arg(long, default_value_t = false)]
utf8: bool,
#[clap(long, aliases = BLOCK_ID_ALIASES)]
#[arg(long, aliases = BLOCK_ID_ALIASES)]
block_id: Option<String>,
#[clap(long, conflicts_with = "block_id")]
#[arg(long, conflicts_with = "block_id")]
finality: Option<String>,
#[clap(long, aliases = NETWORK_ID_ALIASES)]
#[arg(long, aliases = NETWORK_ID_ALIASES)]
network_id: Option<String>,
}

Expand Down
4 changes: 2 additions & 2 deletions src/js_command_match/contract/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use crate::js_command_match::constants::NETWORK_ID_ALIASES;
pub struct ViewArgs {
contract_name: String,
method_name: String,
#[clap(default_value = "{}")]
#[arg(default_value = "{}")]
args: String,
#[clap(long, aliases = NETWORK_ID_ALIASES)]
#[arg(long, aliases = NETWORK_ID_ALIASES)]
network_id: Option<String>,
}

Expand Down
4 changes: 2 additions & 2 deletions src/js_command_match/deprecated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ use color_eyre::owo_colors::OwoColorize;
#[derive(Debug, Clone, clap::Parser)]
/// This is a legacy `validators` command. Once you run it with the specified arguments, new syntax command will be suggested.
pub struct ValidatorsArgs {
#[clap(allow_hyphen_values = true, num_args = 0..)]
#[arg(allow_hyphen_values = true, num_args = 0..)]
_unknown_args: Vec<String>,
}

#[derive(Debug, Clone, clap::Parser)]
pub struct StakeArgs {
#[clap(allow_hyphen_values = true, num_args = 0..)]
#[arg(allow_hyphen_values = true, num_args = 0..)]
_unknown_args: Vec<String>,
}

Expand Down
12 changes: 6 additions & 6 deletions src/js_command_match/keys/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ use crate::js_command_match::constants::{
pub struct AddKeyArgs {
account_id: String,
public_key: String,
#[clap(long, aliases = CONTRACT_ID_ALIASES)]
#[arg(long, aliases = CONTRACT_ID_ALIASES)]
contract_id: Option<String>,
#[clap(long, aliases = METHOD_NAMES_ALIASES, requires = "contract_id", default_value="", value_delimiter = ',', num_args = 0..)]
#[arg(long, aliases = METHOD_NAMES_ALIASES, requires = "contract_id", default_value="", value_delimiter = ',', num_args = 0..)]
method_names: Vec<String>,
#[clap(long, default_value = "0")]
#[arg(long, default_value = "0")]
allowance: String,
#[clap(long, aliases = SIGN_WITH_LEDGER_ALIASES, default_value_t = false)]
#[arg(long, aliases = SIGN_WITH_LEDGER_ALIASES, default_value_t = false)]
sign_with_ledger: bool,
#[clap(long, aliases = LEDGER_PATH_ALIASES, default_value = DEFAULT_SEED_PHRASE_PATH)]
#[arg(long, aliases = LEDGER_PATH_ALIASES, default_value = DEFAULT_SEED_PHRASE_PATH)]
ledger_path: String,
#[clap(long, aliases = NETWORK_ID_ALIASES)]
#[arg(long, aliases = NETWORK_ID_ALIASES)]
network_id: Option<String>,
}

Expand Down
6 changes: 3 additions & 3 deletions src/js_command_match/keys/delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ use crate::js_command_match::constants::{
pub struct DeleteKeyArgs {
account_id: String,
access_key: String,
#[clap(long, aliases = SIGN_WITH_LEDGER_ALIASES, default_value_t = false)]
#[arg(long, aliases = SIGN_WITH_LEDGER_ALIASES, default_value_t = false)]
sign_with_ledger: bool,
#[clap(long, aliases = LEDGER_PATH_ALIASES, default_value = DEFAULT_SEED_PHRASE_PATH)]
#[arg(long, aliases = LEDGER_PATH_ALIASES, default_value = DEFAULT_SEED_PHRASE_PATH)]
ledger_path: String,
#[clap(long, aliases = NETWORK_ID_ALIASES)]
#[arg(long, aliases = NETWORK_ID_ALIASES)]
network_id: Option<String>,
}

Expand Down
2 changes: 1 addition & 1 deletion src/js_command_match/keys/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::js_command_match::constants::NETWORK_ID_ALIASES;
/// This is a legacy `keys` command. Once you run it with the specified arguments, new syntax command will be suggested.
pub struct KeysArgs {
account_id: String,
#[clap(long, aliases = NETWORK_ID_ALIASES)]
#[arg(long, aliases = NETWORK_ID_ALIASES)]
network_id: Option<String>,
}

Expand Down
14 changes: 7 additions & 7 deletions src/js_command_match/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,31 @@ mod transactions;
#[derive(Debug, Clone, clap::Parser)]
/// Legacy CLI commands are only supported at best-effort
pub enum JsCmd {
#[clap(alias("create"))]
#[command(alias("create"))]
CreateAccount(self::account::create::CreateAccountArgs),
#[clap(alias("delete"))]
#[command(alias("delete"))]
DeleteAccount(self::account::delete::DeleteAccountArgs),
#[clap(alias("import-account"))]
#[command(alias("import-account"))]
Login(self::account::login::LoginArgs),
State(self::account::state::StateArgs),

Call(self::contract::call::CallArgs),
Deploy(self::contract::deploy::DeployArgs),
#[clap(alias("storage"))]
#[command(alias("storage"))]
ViewState(self::contract::storage::ViewStateArgs),
View(self::contract::view::ViewArgs),

AddKey(self::keys::add::AddKeyArgs),
DeleteKey(self::keys::delete::DeleteKeyArgs),
#[clap(alias("keys"))]
#[command(alias("keys"))]
ListKeys(self::keys::list::KeysArgs),

#[clap(alias("send-near"))]
#[command(alias("send-near"))]
Send(self::transactions::send::SendArgs),
TxStatus(self::transactions::status::TxStatusArgs),

Validators(self::deprecated::ValidatorsArgs),
#[clap(alias("validator-stake"))]
#[command(alias("validator-stake"))]
Stake(self::deprecated::StakeArgs),
}

Expand Down
6 changes: 3 additions & 3 deletions src/js_command_match/transactions/send.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ pub struct SendArgs {
pub sender: String,
pub receiver: String,
pub amount: String,
#[clap(long, aliases = SIGN_WITH_LEDGER_ALIASES, default_value_t = false)]
#[arg(long, aliases = SIGN_WITH_LEDGER_ALIASES, default_value_t = false)]
sign_with_ledger: bool,
#[clap(long, aliases = LEDGER_PATH_ALIASES, default_value = DEFAULT_SEED_PHRASE_PATH)]
#[arg(long, aliases = LEDGER_PATH_ALIASES, default_value = DEFAULT_SEED_PHRASE_PATH)]
ledger_path: String,
#[clap(long, aliases = NETWORK_ID_ALIASES)]
#[arg(long, aliases = NETWORK_ID_ALIASES)]
pub network_id: Option<String>,
}

Expand Down
4 changes: 2 additions & 2 deletions src/js_command_match/transactions/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use crate::js_command_match::constants::NETWORK_ID_ALIASES;
#[derive(Debug, Clone, clap::Parser)]
pub struct TxStatusArgs {
hash: String,
#[clap(long, aliases = NETWORK_ID_ALIASES)]
#[arg(long, aliases = NETWORK_ID_ALIASES)]
network_id: Option<String>,
#[clap(allow_hyphen_values = true, num_args = 0..)]
#[arg(allow_hyphen_values = true, num_args = 0..)]
_unknown_args: Vec<String>,
}

Expand Down
Loading
Loading