diff --git a/CHANGELOG.md b/CHANGELOG.md index df8fc7cc..0d7a589b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Changed +- All command parameters have been moved to the end of the command. E.g. instead of `quill --pem-file $PEM `, it is now `quill --pem-file $PEM`. + ## [0.2.17] - 2022-07-13 ### Fixed diff --git a/e2e/tests-quill/create_neuron.bash b/e2e/tests-quill/create_neuron.bash index 0a555c9d..aeb42d87 100644 --- a/e2e/tests-quill/create_neuron.bash +++ b/e2e/tests-quill/create_neuron.bash @@ -10,13 +10,13 @@ teardown() { @test "basic create neuron" { #account is initialized with 10_000 tokens - assert_command quill --insecure-local-dev-mode account-balance 345f723e9e619934daac6ae0f4be13a7b0ba57d6a608e511a00fd0ded5866752 --yes + assert_command quill account-balance 345f723e9e619934daac6ae0f4be13a7b0ba57d6a608e511a00fd0ded5866752 --yes --insecure-local-dev-mode assert_string_match '(record { e8s = 1_000_000_000_000 : nat64 })' # stake 3 tokens - assert_command bash -c "quill --pem-file $PEM_LOCATION/identity.pem neuron-stake --amount 3 --name myneur > stake.call" + assert_command bash -c "quill neuron-stake --amount 3 --name myneur --pem-file $PEM_LOCATION/identity.pem > stake.call" assert_file_not_empty stake.call - SEND_OUTPUT="$(quill --insecure-local-dev-mode send stake.call --yes)" + SEND_OUTPUT="$(quill send stake.call --yes --insecure-local-dev-mode)" assert_command echo "$SEND_OUTPUT" # replay the output so string matches work echo "$SEND_OUTPUT" assert_string_match "Method name: claim_or_refresh_neuron_from_account" @@ -25,16 +25,16 @@ teardown() { assert_string_match "record { result = opt variant { NeuronId = record { id =" #fragment of a correct response # check that staking worked using get-neuron-info - assert_command bash -c "quill --insecure-local-dev-mode get-neuron-info $NEURON_ID --yes" + assert_command bash -c "quill get-neuron-info $NEURON_ID --yes --insecure-local-dev-mode" assert_string_match 'stake_e8s = 300_000_000' # increase dissolve delay by 6 months - assert_command bash -c "quill --pem-file $PEM_LOCATION/identity.pem neuron-manage --additional-dissolve-delay-seconds 15778800 $NEURON_ID > more-delay.call" + assert_command bash -c "quill neuron-manage --additional-dissolve-delay-seconds 15778800 --pem-file $PEM_LOCATION/identity.pem $NEURON_ID > more-delay.call" assert_file_not_empty more-delay.call - assert_command quill --insecure-local-dev-mode send more-delay.call --yes #provides no interesting output on succes. Command not failing is good enough here + assert_command quill send more-delay.call --yes --insecure-local-dev-mode #provides no interesting output on succes. Command not failing is good enough here # check that increasing dissolve delay worked, this time using list-neurons - assert_command bash -c "quill --pem-file $PEM_LOCATION/identity.pem list-neurons > neuron.call" - assert_command quill --insecure-local-dev-mode send neuron.call --yes + assert_command bash -c "quill list-neurons --pem-file $PEM_LOCATION/identity.pem > neuron.call" + assert_command quill send neuron.call --yes --insecure-local-dev-mode assert_string_match "dissolve_delay_seconds = 15_778_800" } diff --git a/src/commands/generate.rs b/src/commands/generate.rs index b05d29e3..d0afd56c 100644 --- a/src/commands/generate.rs +++ b/src/commands/generate.rs @@ -3,7 +3,7 @@ use anyhow::{anyhow, Context}; use bip39::{Language, Mnemonic}; use clap::Parser; use rand::{rngs::OsRng, RngCore}; -use std::path::Path; +use std::path::PathBuf; #[derive(Parser, Debug)] #[clap(about, version, author)] @@ -14,11 +14,11 @@ pub struct GenerateOpts { /// File to write the seed phrase to. #[clap(long, default_value = "seed.txt")] - seed_file: String, + seed_file: PathBuf, /// File to write the PEM to. #[clap(long)] - pem_file: Option, + pem_file: Option, /// A seed phrase in quotes to use to generate the PEM file. #[clap(long)] @@ -35,11 +35,11 @@ pub struct GenerateOpts { /// Generate or recover mnemonic seed phrase and/or PEM file. pub fn exec(opts: GenerateOpts) -> AnyhowResult { - if Path::new(&opts.seed_file).exists() && !opts.overwrite_seed_file { + if opts.seed_file.exists() && !opts.overwrite_seed_file { return Err(anyhow!("Seed file exists and overwrite is not set.")); } if let Some(path) = &opts.pem_file { - if Path::new(path).exists() && !opts.overwrite_pem_file { + if path.exists() && !opts.overwrite_pem_file { return Err(anyhow!("PEM file exists and overwrite is not set.")); } } @@ -64,7 +64,7 @@ pub fn exec(opts: GenerateOpts) -> AnyhowResult { phrase.push('\n'); std::fs::write(opts.seed_file, phrase)?; if let Some(path) = opts.pem_file { - std::fs::write(path, pem.clone())?; + std::fs::write(path, &pem)?; } let (principal_id, account_id) = crate::commands::public::get_ids(&AuthInfo::PemFile(pem))?; println!("Principal id: {}", principal_id); diff --git a/src/commands/mod.rs b/src/commands/mod.rs index 4f8d4a38..e2ce9610 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -1,8 +1,8 @@ //! This module implements the command-line API. -use crate::lib::{AnyhowResult, AuthInfo}; +use crate::{get_auth, lib::AnyhowResult, BaseOpts}; use anyhow::Context; -use clap::Parser; +use clap::{Args, Parser}; use std::io::{self, Write}; use tokio::runtime::Runtime; @@ -28,66 +28,88 @@ pub use public::get_ids; #[derive(Parser)] pub enum Command { /// Prints the principal id and the account id. - PublicIds(public::PublicOpts), - Send(send::SendOpts), - Transfer(transfer::TransferOpts), + PublicIds(BaseOpts), + Send(BaseOpts), + Transfer(BaseOpts), /// Claim seed neurons from the Genesis Token Canister. - ClaimNeurons, - NeuronStake(neuron_stake::StakeOpts), - NeuronManage(neuron_manage::ManageOpts), + ClaimNeurons(BaseOpts), + NeuronStake(BaseOpts), + NeuronManage(BaseOpts), /// Signs the query for all neurons belonging to the signing principal. - ListNeurons(list_neurons::ListNeuronsOpts), - ListProposals(list_proposals::ListProposalsOpts), - GetProposalInfo(get_proposal_info::GetProposalInfoOpts), - GetNeuronInfo(get_neuron_info::GetNeuronInfoOpts), + ListNeurons(BaseOpts), + ListProposals(BaseOpts), + GetProposalInfo(BaseOpts), + GetNeuronInfo(BaseOpts), /// Queries a ledger account balance. - AccountBalance(account_balance::AccountBalanceOpts), + AccountBalance(BaseOpts), /// Update node provider details - UpdateNodeProvider(update_node_provider::UpdateNodeProviderOpts), - ReplaceNodeProviderId(replace_node_provide_id::ReplaceNodeProviderIdOpts), + UpdateNodeProvider(BaseOpts), + ReplaceNodeProviderId(BaseOpts), /// Generate a mnemonic seed phrase and generate or recover PEM. - Generate(generate::GenerateOpts), + Generate(BaseOpts), /// Print QR Scanner dapp QR code: scan to start dapp to submit QR results. ScannerQRCode, /// Print QR code for data e.g. principal id. - QRCode(qrcode::QRCodeOpts), + QRCode(BaseOpts), } -pub fn exec(auth: &AuthInfo, qr: bool, fetch_root_key: bool, cmd: Command) -> AnyhowResult { +#[derive(Args)] +pub struct Empty; + +pub fn dispatch(cmd: Command) -> AnyhowResult { let runtime = Runtime::new().expect("Unable to create a runtime"); match cmd { - Command::PublicIds(opts) => public::exec(auth, opts), - Command::Transfer(opts) => transfer::exec(auth, opts).and_then(|out| print_vec(qr, &out)), + Command::PublicIds(opts) => public::exec(&get_auth(opts.global_opts)?, opts.command_opts)?, + Command::Transfer(opts) => { + let qr = opts.global_opts.qr; + let out = transfer::exec(&get_auth(opts.global_opts)?, opts.command_opts)?; + print_vec(qr, &out)?; + } Command::NeuronStake(opts) => { - neuron_stake::exec(auth, opts).and_then(|out| print_vec(qr, &out)) + let qr = opts.global_opts.qr; + let out = neuron_stake::exec(&get_auth(opts.global_opts)?, opts.command_opts)?; + print_vec(qr, &out)?; } Command::NeuronManage(opts) => { - neuron_manage::exec(auth, opts).and_then(|out| print_vec(qr, &out)) + let qr = opts.global_opts.qr; + let out = neuron_manage::exec(&get_auth(opts.global_opts)?, opts.command_opts)?; + print_vec(qr, &out)?; } Command::ListNeurons(opts) => { - list_neurons::exec(auth, opts).and_then(|out| print_vec(qr, &out)) - } - Command::ClaimNeurons => claim_neurons::exec(auth).and_then(|out| print_vec(qr, &out)), - Command::ListProposals(opts) => { - runtime.block_on(async { list_proposals::exec(opts, fetch_root_key).await }) + let qr = opts.global_opts.qr; + let out = list_neurons::exec(&get_auth(opts.global_opts)?, opts.command_opts)?; + print_vec(qr, &out)?; } - Command::GetProposalInfo(opts) => { - runtime.block_on(async { get_proposal_info::exec(opts, fetch_root_key).await }) - } - Command::GetNeuronInfo(opts) => { - runtime.block_on(async { get_neuron_info::exec(opts, fetch_root_key).await }) - } - Command::AccountBalance(opts) => { - runtime.block_on(async { account_balance::exec(opts, fetch_root_key).await }) + Command::ClaimNeurons(opts) => { + let qr = opts.global_opts.qr; + claim_neurons::exec(&get_auth(opts.global_opts)?) + .and_then(|out| print_vec(qr, &out))?; } + Command::ListProposals(opts) => runtime.block_on(async { + list_proposals::exec(opts.command_opts, opts.global_opts.fetch_root_key).await + })?, + Command::GetProposalInfo(opts) => runtime.block_on(async { + get_proposal_info::exec(opts.command_opts, opts.global_opts.fetch_root_key).await + })?, + Command::GetNeuronInfo(opts) => runtime.block_on(async { + get_neuron_info::exec(opts.command_opts, opts.global_opts.fetch_root_key).await + })?, + Command::AccountBalance(opts) => runtime.block_on(async { + account_balance::exec(opts.command_opts, opts.global_opts.fetch_root_key).await + })?, Command::UpdateNodeProvider(opts) => { - update_node_provider::exec(auth, opts).and_then(|out| print(&out)) + let out = update_node_provider::exec(&get_auth(opts.global_opts)?, opts.command_opts)?; + print(&out)?; } Command::ReplaceNodeProviderId(opts) => { - replace_node_provide_id::exec(auth, opts).and_then(|out| print(&out)) + let out = + replace_node_provide_id::exec(&get_auth(opts.global_opts)?, opts.command_opts)?; + print(&out)?; } - Command::Send(opts) => runtime.block_on(async { send::exec(opts, fetch_root_key).await }), - Command::Generate(opts) => generate::exec(opts), + Command::Send(opts) => runtime.block_on(async { + send::exec(opts.command_opts, opts.global_opts.fetch_root_key).await + })?, + Command::Generate(opts) => generate::exec(opts.command_opts)?, // QR code for URL: https://p5deo-6aaaa-aaaab-aaaxq-cai.raw.ic0.app/ // Source code: https://github.com/ninegua/ic-qr-scanner Command::ScannerQRCode => { @@ -113,10 +135,10 @@ pub fn exec(auth: &AuthInfo, qr: bool, fetch_root_key: bool, cmd: Command) -> An █████████████████████████████████████ █████████████████████████████████████" ); - Ok(()) } - Command::QRCode(opts) => qrcode::exec(opts), + Command::QRCode(opts) => qrcode::exec(opts.command_opts)?, } + Ok(()) } // Using println! for printing to STDOUT and piping it to other tools leads to diff --git a/src/commands/qrcode.rs b/src/commands/qrcode.rs index 561274df..f1fcdc9f 100644 --- a/src/commands/qrcode.rs +++ b/src/commands/qrcode.rs @@ -1,3 +1,5 @@ +use std::path::PathBuf; + use crate::lib::{read_from_file, AnyhowResult}; use clap::Parser; use qrcodegen::{QrCode, QrCodeEcc}; @@ -6,7 +8,7 @@ use qrcodegen::{QrCode, QrCodeEcc}; pub struct QRCodeOpts { /// File the contents of which to be output as a QRCode. #[clap(long)] - file: Option, + file: Option, // String to be output as a QRCode. #[clap(long)] diff --git a/src/commands/send.rs b/src/commands/send.rs index c5c55e25..ee262794 100644 --- a/src/commands/send.rs +++ b/src/commands/send.rs @@ -12,6 +12,7 @@ use ic_agent::{agent::http_transport::ReqwestHttpReplicaV2Transport, RequestId}; use ic_types::principal::Principal; use ledger_canister::{ICPTs, Subaccount}; use serde::{Deserialize, Serialize}; +use std::path::PathBuf; use std::str::FromStr; #[derive( @@ -49,7 +50,7 @@ pub struct SendArgs { #[derive(Parser)] pub struct SendOpts { /// Path to the signed message - file_name: String, + file_name: PathBuf, /// Will display the signed message, but not send it. #[clap(long)] diff --git a/src/lib/mod.rs b/src/lib/mod.rs index a34b3ced..1e56ed04 100644 --- a/src/lib/mod.rs +++ b/src/lib/mod.rs @@ -24,8 +24,8 @@ use simple_asn1::ASN1Block::{ BitString, Explicit, Integer, ObjectIdentifier, OctetString, Sequence, }; use simple_asn1::{oid, to_der, ASN1Class, BigInt, BigUint}; -use std::env::VarError; use std::path::PathBuf; +use std::{env::VarError, path::Path}; pub const IC_URL: &str = "https://ic0.app"; @@ -160,13 +160,13 @@ pub fn get_candid_type(idl: String, method_name: &str) -> Option<(TypeEnv, Funct } /// Reads from the file path or STDIN and returns the content. -pub fn read_from_file(path: &str) -> AnyhowResult { +pub fn read_from_file(path: impl AsRef) -> AnyhowResult { use std::io::Read; + let path = path.as_ref(); let mut content = String::new(); - if path == "-" { + if path == Path::new("-") { std::io::stdin().read_to_string(&mut content)?; } else { - let path = std::path::Path::new(&path); let mut file = std::fs::File::open(&path).context("Cannot open the message file.")?; file.read_to_string(&mut content) .context("Cannot read the message file.")?; diff --git a/src/main.rs b/src/main.rs index 0d1aa0ad..e1fd280d 100755 --- a/src/main.rs +++ b/src/main.rs @@ -1,8 +1,11 @@ #![warn(unused_extern_crates)] +use std::path::{Path, PathBuf}; + use crate::lib::AnyhowResult; -use anyhow::{Context, Error}; +use anyhow::Context; use bip39::Mnemonic; -use clap::{crate_version, Parser}; +use clap::{crate_version, Args, Parser}; +use lib::AuthInfo; mod commands; mod lib; @@ -11,15 +14,21 @@ mod lib; #[derive(Parser)] #[clap(name("quill"), version = crate_version!())] pub struct CliOpts { + #[clap(subcommand)] + command: commands::Command, +} + +#[derive(Args)] +struct GlobalOpts { /// Path to your PEM file (use "-" for STDIN) #[clap(long)] - pem_file: Option, + pem_file: Option, #[clap(long)] hsm: bool, #[clap(long)] - hsm_libpath: Option, + hsm_libpath: Option, #[clap(long)] hsm_slot: Option, @@ -29,7 +38,7 @@ pub struct CliOpts { /// Path to your seed file (use "-" for STDIN) #[clap(long)] - seed_file: Option, + seed_file: Option, /// Output the result(s) as UTF-8 QR codes. #[clap(long)] @@ -37,16 +46,21 @@ pub struct CliOpts { /// Fetches the root key before making requests so that interfacing with local instances is possible. /// DO NOT USE WITH ANY REAL INFORMATION - #[clap(long)] - insecure_local_dev_mode: bool, + #[clap(long = "insecure-local-dev-mode", name = "insecure-local-dev-mode")] + fetch_root_key: bool, +} - #[clap(subcommand)] - command: commands::Command, +#[derive(Args)] +pub struct BaseOpts { + #[clap(flatten)] + command_opts: T, + #[clap(flatten, next_help_heading = "COMMON")] + global_opts: GlobalOpts, } fn main() { let opts = CliOpts::parse(); - if let Err(err) = run(opts) { + if let Err(err) = commands::dispatch(opts.command) { for (level, cause) in err.chain().enumerate() { if level == 0 { eprintln!("Error: {}", err); @@ -61,12 +75,12 @@ fn main() { } } -fn run(opts: CliOpts) -> AnyhowResult<()> { +fn get_auth(opts: GlobalOpts) -> AnyhowResult { // Get PEM from the file if provided, or try to convert from the seed file - let auth: lib::AuthInfo = if opts.hsm { + if opts.hsm { let mut hsm = lib::HSMInfo::new(); if let Some(path) = opts.hsm_libpath { - hsm.libpath = std::path::PathBuf::from(path); + hsm.libpath = path; } if let Some(slot) = opts.hsm_slot { hsm.slot = slot; @@ -74,25 +88,23 @@ fn run(opts: CliOpts) -> AnyhowResult<()> { if let Some(id) = opts.hsm_id { hsm.ident = id; } - Ok::<_, Error>(lib::AuthInfo::NitroHsm(hsm)) + Ok(lib::AuthInfo::NitroHsm(hsm)) } else { - let pem = read_pem(opts.pem_file, opts.seed_file)?; + let pem = read_pem(opts.pem_file.as_deref(), opts.seed_file.as_deref())?; if let Some(pem) = pem { Ok(lib::AuthInfo::PemFile(pem)) } else { Ok(lib::AuthInfo::NoAuth) } - }?; - - commands::exec(&auth, opts.qr, opts.insecure_local_dev_mode, opts.command) + } } // Get PEM from the file if provided, or try to convert from the seed file -fn read_pem(pem_file: Option, seed_file: Option) -> AnyhowResult> { +fn read_pem(pem_file: Option<&Path>, seed_file: Option<&Path>) -> AnyhowResult> { match (pem_file, seed_file) { - (Some(pem_file), _) => read_file(&pem_file, "PEM").map(Some), + (Some(pem_file), _) => read_file(pem_file, "PEM").map(Some), (_, Some(seed_file)) => { - let seed = read_file(&seed_file, "seed")?; + let seed = read_file(seed_file, "seed")?; let mnemonic = parse_mnemonic(&seed)?; let mnemonic = lib::mnemonic_to_pem(&mnemonic)?; Ok(Some(mnemonic)) @@ -105,18 +117,18 @@ fn parse_mnemonic(phrase: &str) -> AnyhowResult { Mnemonic::parse(phrase).context("Couldn't parse the seed phrase as a valid mnemonic. {:?}") } -fn read_file(path: &str, name: &str) -> AnyhowResult { - match path { +fn read_file(path: impl AsRef, name: &str) -> AnyhowResult { + let path = path.as_ref(); + if path == Path::new("-") { // read from STDIN - "-" => { - let mut buffer = String::new(); - use std::io::Read; - std::io::stdin() - .read_to_string(&mut buffer) - .map(|_| buffer) - .context(format!("Couldn't read {} from STDIN", name)) - } - path => std::fs::read_to_string(path).context(format!("Couldn't read {} file", name)), + let mut buffer = String::new(); + use std::io::Read; + std::io::stdin() + .read_to_string(&mut buffer) + .map(|_| buffer) + .context(format!("Couldn't read {} from STDIN", name)) + } else { + std::fs::read_to_string(path).with_context(|| format!("Couldn't read {} file", name)) } } @@ -142,7 +154,7 @@ mod tests { .write_all(content.as_bytes()) .expect("Cannot write to temp file"); - let res = read_pem(Some(pem_file.path().to_str().unwrap().to_string()), None); + let res = read_pem(Some(pem_file.path()), None); assert_eq!(Some(content), res.expect("read_pem from pem file")); } @@ -159,7 +171,7 @@ mod tests { .expect("Cannot write to temp file"); let mnemonic = crate::lib::mnemonic_to_pem(&Mnemonic::parse(phrase).unwrap()).unwrap(); - let pem = read_pem(None, Some(seed_file.path().to_str().unwrap().to_string())) + let pem = read_pem(None, Some(seed_file.path())) .expect("Unable to read seed_file") .expect("None returned instead of Some"); @@ -169,16 +181,10 @@ mod tests { #[test] fn test_read_pem_from_non_existing_file() { let dir = tempfile::tempdir().expect("Cannot create temp dir"); - let non_existing_file = dir - .path() - .join("non_existing_pem_file") - .as_path() - .to_str() - .unwrap() - .to_string(); + let non_existing_file = dir.path().join("non_existing_pem_file"); - read_pem(Some(non_existing_file.clone()), None).unwrap_err(); + read_pem(Some(&non_existing_file), None).unwrap_err(); - read_pem(None, Some(non_existing_file)).unwrap_err(); + read_pem(None, Some(&non_existing_file)).unwrap_err(); } } diff --git a/tests/commands/claim-neurons.sh b/tests/commands/claim-neurons.sh index a0c5a784..ea1ddf2d 100755 --- a/tests/commands/claim-neurons.sh +++ b/tests/commands/claim-neurons.sh @@ -1 +1 @@ -${CARGO_TARGET_DIR:-../target}/debug/quill --pem-file - claim-neurons | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - +${CARGO_TARGET_DIR:-../target}/debug/quill claim-neurons --pem-file - | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - diff --git a/tests/commands/fixed-pipe.sh b/tests/commands/fixed-pipe.sh index db4a5a37..35829538 100755 --- a/tests/commands/fixed-pipe.sh +++ b/tests/commands/fixed-pipe.sh @@ -1 +1 @@ -${CARGO_TARGET_DIR:-../target}/debug/quill --pem-file - transfer 345f723e9e619934daac6ae0f4be13a7b0ba57d6a608e511a00fd0ded5866752 --amount 123.0456 | gzip -9c | zcat | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - +${CARGO_TARGET_DIR:-../target}/debug/quill transfer 345f723e9e619934daac6ae0f4be13a7b0ba57d6a608e511a00fd0ded5866752 --amount 123.0456 --pem-file - | gzip -9c | zcat | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - diff --git a/tests/commands/list-neurons-many.sh b/tests/commands/list-neurons-many.sh index c057c75b..54f8f5d2 100755 --- a/tests/commands/list-neurons-many.sh +++ b/tests/commands/list-neurons-many.sh @@ -1 +1 @@ -${CARGO_TARGET_DIR:-../target}/debug/quill --pem-file - list-neurons 123 456 789 | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - +${CARGO_TARGET_DIR:-../target}/debug/quill list-neurons 123 456 789 --pem-file - | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - diff --git a/tests/commands/list-neurons.sh b/tests/commands/list-neurons.sh index 28d837c4..dd4c70b5 100755 --- a/tests/commands/list-neurons.sh +++ b/tests/commands/list-neurons.sh @@ -1 +1 @@ -${CARGO_TARGET_DIR:-../target}/debug/quill --pem-file - list-neurons | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - +${CARGO_TARGET_DIR:-../target}/debug/quill list-neurons --pem-file - | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - diff --git a/tests/commands/neuron-manage-a.sh b/tests/commands/neuron-manage-a.sh index 28d92807..be811cce 100755 --- a/tests/commands/neuron-manage-a.sh +++ b/tests/commands/neuron-manage-a.sh @@ -1 +1 @@ -${CARGO_TARGET_DIR:-../target}/debug/quill --pem-file - neuron-manage 2313380519530470538 -a 3600 | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - +${CARGO_TARGET_DIR:-../target}/debug/quill neuron-manage 2313380519530470538 -a 3600 --pem-file - | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - diff --git a/tests/commands/neuron-manage-add-hot-key.sh b/tests/commands/neuron-manage-add-hot-key.sh index a78c0cc2..f053a4a4 100755 --- a/tests/commands/neuron-manage-add-hot-key.sh +++ b/tests/commands/neuron-manage-add-hot-key.sh @@ -1 +1 @@ -${CARGO_TARGET_DIR:-../target}/debug/quill --pem-file - neuron-manage 2313380519530470538 --add-hot-key fdsgv-62ihb-nbiqv-xgic5-iefsv-3cscz-tmbzv-63qd5-vh43v-dqfrt-pae | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - +${CARGO_TARGET_DIR:-../target}/debug/quill neuron-manage 2313380519530470538 --pem-file - --add-hot-key fdsgv-62ihb-nbiqv-xgic5-iefsv-3cscz-tmbzv-63qd5-vh43v-dqfrt-pae | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - diff --git a/tests/commands/neuron-manage-clear.sh b/tests/commands/neuron-manage-clear.sh index 9a94d934..ac57de0e 100755 --- a/tests/commands/neuron-manage-clear.sh +++ b/tests/commands/neuron-manage-clear.sh @@ -1 +1 @@ -${CARGO_TARGET_DIR:-../target}/debug/quill --pem-file - neuron-manage 2313380519530470538 --clear-manage-neuron-followees | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - +${CARGO_TARGET_DIR:-../target}/debug/quill neuron-manage 2313380519530470538 --clear-manage-neuron-followees --pem-file - | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - diff --git a/tests/commands/neuron-manage-disburse-stop-dissolving.sh b/tests/commands/neuron-manage-disburse-stop-dissolving.sh index f8e41cc5..fc1ff7d4 100755 --- a/tests/commands/neuron-manage-disburse-stop-dissolving.sh +++ b/tests/commands/neuron-manage-disburse-stop-dissolving.sh @@ -1 +1 @@ -${CARGO_TARGET_DIR:-../target}/debug/quill --pem-file - neuron-manage 2313380519530470538 --disburse --stop-dissolving | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - +${CARGO_TARGET_DIR:-../target}/debug/quill neuron-manage 2313380519530470538 --disburse --stop-dissolving --pem-file - | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - diff --git a/tests/commands/neuron-manage-follow.sh b/tests/commands/neuron-manage-follow.sh index 73d0a15c..8d78504c 100755 --- a/tests/commands/neuron-manage-follow.sh +++ b/tests/commands/neuron-manage-follow.sh @@ -1 +1 @@ -${CARGO_TARGET_DIR:-../target}/debug/quill --pem-file - neuron-manage 2313380519530470538 --follow-topic 0 --follow-neurons 380519530470538 380519530470539 | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - \ No newline at end of file +${CARGO_TARGET_DIR:-../target}/debug/quill neuron-manage 2313380519530470538 --follow-topic 0 --follow-neurons 380519530470538 380519530470539 --pem-file - | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - \ No newline at end of file diff --git a/tests/commands/neuron-manage-join-community-fund.sh b/tests/commands/neuron-manage-join-community-fund.sh index e01ad74a..f38621ff 100755 --- a/tests/commands/neuron-manage-join-community-fund.sh +++ b/tests/commands/neuron-manage-join-community-fund.sh @@ -1 +1 @@ -${CARGO_TARGET_DIR:-../target}/debug/quill --pem-file - neuron-manage 2313380519530470538 --join-community-fund | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - +${CARGO_TARGET_DIR:-../target}/debug/quill neuron-manage 2313380519530470538 --join-community-fund --pem-file - | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - diff --git a/tests/commands/neuron-manage-merge-maturity.sh b/tests/commands/neuron-manage-merge-maturity.sh index 0da82317..dd81e17e 100755 --- a/tests/commands/neuron-manage-merge-maturity.sh +++ b/tests/commands/neuron-manage-merge-maturity.sh @@ -1 +1 @@ -${CARGO_TARGET_DIR:-../target}/debug/quill --pem-file - neuron-manage 65 --merge-maturity 100 | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - +${CARGO_TARGET_DIR:-../target}/debug/quill neuron-manage 65 --merge-maturity 100 --pem-file - | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - diff --git a/tests/commands/neuron-manage-merge.sh b/tests/commands/neuron-manage-merge.sh index 2958d90a..9f8b1058 100755 --- a/tests/commands/neuron-manage-merge.sh +++ b/tests/commands/neuron-manage-merge.sh @@ -1 +1 @@ -${CARGO_TARGET_DIR:-../target}/debug/quill --pem-file - neuron-manage 2313380519530470538 --merge-from-neuron 380519530470538 | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - +${CARGO_TARGET_DIR:-../target}/debug/quill neuron-manage 2313380519530470538 --merge-from-neuron 380519530470538 --pem-file - | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - diff --git a/tests/commands/neuron-manage-spawn.sh b/tests/commands/neuron-manage-spawn.sh index 12a12fe0..34a4a5ce 100755 --- a/tests/commands/neuron-manage-spawn.sh +++ b/tests/commands/neuron-manage-spawn.sh @@ -1 +1 @@ -${CARGO_TARGET_DIR:-../target}/debug/quill --pem-file - neuron-manage 2_313_380_519_530_470_538 --spawn | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - +${CARGO_TARGET_DIR:-../target}/debug/quill neuron-manage 2_313_380_519_530_470_538 --spawn --pem-file - | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - diff --git a/tests/commands/neuron-manage-split.sh b/tests/commands/neuron-manage-split.sh index 69fbc0e2..972f0dc7 100755 --- a/tests/commands/neuron-manage-split.sh +++ b/tests/commands/neuron-manage-split.sh @@ -1 +1 @@ -${CARGO_TARGET_DIR:-../target}/debug/quill --pem-file - neuron-manage 2313380519530470538 --split 100 | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - +${CARGO_TARGET_DIR:-../target}/debug/quill neuron-manage 2313380519530470538 --split 100 --pem-file - | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - diff --git a/tests/commands/neuron-manage.sh b/tests/commands/neuron-manage.sh index e19a2d49..f9ba1843 100755 --- a/tests/commands/neuron-manage.sh +++ b/tests/commands/neuron-manage.sh @@ -1 +1 @@ -${CARGO_TARGET_DIR:-../target}/debug/quill --pem-file - neuron-manage 2313380519530470538 -a 7200 --remove-hot-key fdsgv-62ihb-nbiqv-xgic5-iefsv-3cscz-tmbzv-63qd5-vh43v-dqfrt-pae --start-dissolving | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - +${CARGO_TARGET_DIR:-../target}/debug/quill neuron-manage 2313380519530470538 -a 7200 --remove-hot-key fdsgv-62ihb-nbiqv-xgic5-iefsv-3cscz-tmbzv-63qd5-vh43v-dqfrt-pae --start-dissolving --pem-file - | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - diff --git a/tests/commands/neuron-stake-nonce.sh b/tests/commands/neuron-stake-nonce.sh index 2079d5f9..f5957067 100755 --- a/tests/commands/neuron-stake-nonce.sh +++ b/tests/commands/neuron-stake-nonce.sh @@ -1 +1 @@ -cargo run -- --pem-file - neuron-stake --amount 12 --nonce 777 | cargo run -- send --dry-run - +${CARGO_TARGET_DIR:-../target}/debug/quill neuron-stake --amount 12 --nonce 777 --pem-file - | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - diff --git a/tests/commands/neuron-stake-with-name.sh b/tests/commands/neuron-stake-with-name.sh index 811b31e8..d43693b5 100755 --- a/tests/commands/neuron-stake-with-name.sh +++ b/tests/commands/neuron-stake-with-name.sh @@ -1 +1 @@ -${CARGO_TARGET_DIR:-../target}/debug/quill --pem-file - neuron-stake --amount 12 --name myNeuron | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - +${CARGO_TARGET_DIR:-../target}/debug/quill neuron-stake --amount 12 --name myNeuron --pem-file - | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - diff --git a/tests/commands/public-ids.sh b/tests/commands/public-ids.sh index 91f12b6c..4f7ca9c7 100755 --- a/tests/commands/public-ids.sh +++ b/tests/commands/public-ids.sh @@ -1,2 +1,2 @@ -${CARGO_TARGET_DIR:-../target}/debug/quill --pem-file - public-ids +${CARGO_TARGET_DIR:-../target}/debug/quill public-ids --pem-file - ${CARGO_TARGET_DIR:-../target}/debug/quill public-ids --principal-id 44mwt-bq3um-tqicz-bwhad-iipx4-6wzex-olvaj-z63bj-wkelv-xoua3-rqe diff --git a/tests/commands/transfer-e8s-2.sh b/tests/commands/transfer-e8s-2.sh index b206e532..25e394c9 100644 --- a/tests/commands/transfer-e8s-2.sh +++ b/tests/commands/transfer-e8s-2.sh @@ -1 +1 @@ -${CARGO_TARGET_DIR:-../target}/debug/quill --pem-file - transfer 345f723e9e619934daac6ae0f4be13a7b0ba57d6a608e511a00fd0ded5866752 --amount 0.0000000999999 | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - +${CARGO_TARGET_DIR:-../target}/debug/quill transfer 345f723e9e619934daac6ae0f4be13a7b0ba57d6a608e511a00fd0ded5866752 --amount 0.0000000999999 --pem-file - | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - diff --git a/tests/commands/transfer-e8s.sh b/tests/commands/transfer-e8s.sh index 66626ff9..127d2a05 100755 --- a/tests/commands/transfer-e8s.sh +++ b/tests/commands/transfer-e8s.sh @@ -1 +1 @@ -${CARGO_TARGET_DIR:-../target}/debug/quill --pem-file - transfer 345f723e9e619934daac6ae0f4be13a7b0ba57d6a608e511a00fd0ded5866752 --amount 0.123456 | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - +${CARGO_TARGET_DIR:-../target}/debug/quill transfer 345f723e9e619934daac6ae0f4be13a7b0ba57d6a608e511a00fd0ded5866752 --amount 0.123456 --pem-file - | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - diff --git a/tests/commands/transfer-icp-and-e8s.sh b/tests/commands/transfer-icp-and-e8s.sh index 1f930e5e..18d2cebb 100755 --- a/tests/commands/transfer-icp-and-e8s.sh +++ b/tests/commands/transfer-icp-and-e8s.sh @@ -1 +1 @@ -${CARGO_TARGET_DIR:-../target}/debug/quill --pem-file - transfer 345f723e9e619934daac6ae0f4be13a7b0ba57d6a608e511a00fd0ded5866752 --amount 1.23456 | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - +${CARGO_TARGET_DIR:-../target}/debug/quill transfer 345f723e9e619934daac6ae0f4be13a7b0ba57d6a608e511a00fd0ded5866752 --amount 1.23456 --pem-file - | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - diff --git a/tests/commands/transfer-with-fees-and-memo.sh b/tests/commands/transfer-with-fees-and-memo.sh index 7bb4c743..cd21a617 100755 --- a/tests/commands/transfer-with-fees-and-memo.sh +++ b/tests/commands/transfer-with-fees-and-memo.sh @@ -1 +1 @@ -${CARGO_TARGET_DIR:-../target}/debug/quill --pem-file - transfer 345f723e9e619934daac6ae0f4be13a7b0ba57d6a608e511a00fd0ded5866752 --amount 123.0456 --fee 0.0023 --memo 777 | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - +${CARGO_TARGET_DIR:-../target}/debug/quill transfer 345f723e9e619934daac6ae0f4be13a7b0ba57d6a608e511a00fd0ded5866752 --amount 123.0456 --fee 0.0023 --memo 777 --pem-file - | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - diff --git a/tests/commands/transfer-with-fees.sh b/tests/commands/transfer-with-fees.sh index 34c28c57..a2d562ca 100755 --- a/tests/commands/transfer-with-fees.sh +++ b/tests/commands/transfer-with-fees.sh @@ -1 +1 @@ -${CARGO_TARGET_DIR:-../target}/debug/quill --pem-file - transfer 345f723e9e619934daac6ae0f4be13a7b0ba57d6a608e511a00fd0ded5866752 --amount 123.0456 --fee 0.0023 | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - +${CARGO_TARGET_DIR:-../target}/debug/quill transfer 345f723e9e619934daac6ae0f4be13a7b0ba57d6a608e511a00fd0ded5866752 --amount 123.0456 --fee 0.0023 --pem-file - | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - diff --git a/tests/commands/transfer.sh b/tests/commands/transfer.sh index 59644eda..9d1501f5 100755 --- a/tests/commands/transfer.sh +++ b/tests/commands/transfer.sh @@ -1 +1 @@ -${CARGO_TARGET_DIR:-../target}/debug/quill --pem-file - transfer 345f723e9e619934daac6ae0f4be13a7b0ba57d6a608e511a00fd0ded5866752 --amount 0.000123 | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run - +${CARGO_TARGET_DIR:-../target}/debug/quill transfer 345f723e9e619934daac6ae0f4be13a7b0ba57d6a608e511a00fd0ded5866752 --amount 0.000123 --pem-file - | ${CARGO_TARGET_DIR:-../target}/debug/quill send --dry-run -