From 1dfe374e739a89a52ff8d31c2505e14b0f0b4f8b Mon Sep 17 00:00:00 2001 From: driemworks Date: Tue, 1 Oct 2024 13:46:58 -0500 Subject: [PATCH] remove -cli, simplify u128 with clap --- lib/Cargo.toml | 2 +- lib/src/bin/{murmur-cli => murmur}/main.rs | 12 +++--------- 2 files changed, 4 insertions(+), 10 deletions(-) rename lib/src/bin/{murmur-cli => murmur}/main.rs (95%) diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 05f0865..86873e9 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -12,7 +12,7 @@ crate-type = [ ] [[bin]] -name = "murmur-cli" +name = "murmur" [dependencies] subxt = "0.35.2" diff --git a/lib/src/bin/murmur-cli/main.rs b/lib/src/bin/murmur/main.rs similarity index 95% rename from lib/src/bin/murmur-cli/main.rs rename to lib/src/bin/murmur/main.rs index 1aab343..d70a385 100644 --- a/lib/src/bin/murmur-cli/main.rs +++ b/lib/src/bin/murmur/main.rs @@ -64,8 +64,8 @@ struct WalletExecuteDetails { seed: String, #[arg(long, short)] to: String, - #[arg(short, long)] - amount: String + #[arg(short, long, value_parser = clap::value_parser!(u128))] + amount: u128 } #[derive(Error, Debug)] @@ -133,16 +133,10 @@ async fn main() -> Result<(), Box> { let from_ss58_sized: [u8;32] = bytes.try_into() .map_err(|_| CLIError::InvalidRecipient)?; let to = subxt::utils::AccountId32::from(from_ss58_sized); - let v: u128 = args.amount - .split_whitespace() - .map(|r| r.replace('_', "") - .parse() - .unwrap() - ).collect::>()[0]; let balance_transfer_call = Balances(etf::balances::Call::transfer_allow_death { dest: subxt::utils::MultiAddress::<_, u32>::from(to), - value: v, + value: args.amount, }); let store: MurmurStore = load_mmr_store(MMR_STORE_FILEPATH)?;