mirror of
https://github.com/Qortal/piratewallet-light-cli.git
synced 2025-01-30 02:22:15 +00:00
port to pirate
This commit is contained in:
parent
3f55a1411c
commit
e0ca959796
@ -10,7 +10,7 @@ use log::error;
|
|||||||
pub fn main() {
|
pub fn main() {
|
||||||
// Get command line arguments
|
// Get command line arguments
|
||||||
use clap::{App, Arg};
|
use clap::{App, Arg};
|
||||||
let fresh_app = App::new("Zecwallet CLI");
|
let fresh_app = App::new("Arrrwallet CLI");
|
||||||
let configured_app = configure_clapapp!(fresh_app);
|
let configured_app = configure_clapapp!(fresh_app);
|
||||||
let matches = configured_app.get_matches();
|
let matches = configured_app.get_matches();
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ RUN cd /opt && wget https://download.libsodium.org/libsodium/releases/libsodium-
|
|||||||
RUN apt install -y git
|
RUN apt install -y git
|
||||||
|
|
||||||
# Cargo fetch the dependencies so we don't download them over and over again
|
# Cargo fetch the dependencies so we don't download them over and over again
|
||||||
RUN cd /tmp && git clone https://github.com/adityapk00/zecwallet-light-cli.git && \
|
RUN cd /tmp && git clone https://github.com/piratenetwork/piratewallet-light-cli.git && \
|
||||||
cd zecwallet-light-cli && \
|
cd piratewallet-light-cli && \
|
||||||
cargo fetch && \
|
cargo fetch && \
|
||||||
cd /tmp && rm -rf zecwallet-light-cli
|
cd /tmp && rm -rf piratewallet-light-cli
|
||||||
|
@ -205,17 +205,17 @@ struct BalanceCommand {}
|
|||||||
impl Command for BalanceCommand {
|
impl Command for BalanceCommand {
|
||||||
fn help(&self) -> String {
|
fn help(&self) -> String {
|
||||||
let mut h = vec![];
|
let mut h = vec![];
|
||||||
h.push("Show the current ZEC balance in the wallet");
|
h.push("Show the current ARRR balance in the wallet");
|
||||||
h.push("Usage:");
|
h.push("Usage:");
|
||||||
h.push("balance");
|
h.push("balance");
|
||||||
h.push("");
|
h.push("");
|
||||||
h.push("Transparent and Shielded balances, along with the addresses they belong to are displayed");
|
h.push("Shielded balances, along with the addresses they belong to are displayed");
|
||||||
|
|
||||||
h.join("\n")
|
h.join("\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn short_help(&self) -> String {
|
fn short_help(&self) -> String {
|
||||||
"Show the current ZEC balance in the wallet".to_string()
|
"Show the current ARRR balance in the wallet".to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn exec(&self, _args: &[&str], lightclient: &LightClient) -> String {
|
fn exec(&self, _args: &[&str], lightclient: &LightClient) -> String {
|
||||||
@ -250,14 +250,14 @@ impl Command for ExportCommand {
|
|||||||
fn help(&self) -> String {
|
fn help(&self) -> String {
|
||||||
let mut h = vec![];
|
let mut h = vec![];
|
||||||
h.push("Export private key for an individual wallet addresses.");
|
h.push("Export private key for an individual wallet addresses.");
|
||||||
h.push("Note: To backup the whole wallet, use the 'seed' command insted");
|
h.push("Note: To backup the whole wallet, use the 'seed' command instead");
|
||||||
h.push("Usage:");
|
h.push("Usage:");
|
||||||
h.push("export [t-address or z-address]");
|
h.push("export [z-address]");
|
||||||
h.push("");
|
h.push("");
|
||||||
h.push("If no address is passed, private key for all addresses in the wallet are exported.");
|
h.push("If no address is passed, private key for all addresses in the wallet are exported.");
|
||||||
h.push("");
|
h.push("");
|
||||||
h.push("Example:");
|
h.push("Example:");
|
||||||
h.push("export ztestsapling1x65nq4dgp0qfywgxcwk9n0fvm4fysmapgr2q00p85ju252h6l7mmxu2jg9cqqhtvzd69jwhgv8d");
|
h.push("export zs1x65nq4dgp0qfywgxcwk9n0fvm4fysmapgr2q00p85ju252h6l7mmxu2jg9cqqhtvzd69jwhgv8d");
|
||||||
|
|
||||||
h.join("\n")
|
h.join("\n")
|
||||||
}
|
}
|
||||||
@ -284,7 +284,7 @@ impl Command for EncryptCommand {
|
|||||||
fn help(&self) -> String {
|
fn help(&self) -> String {
|
||||||
let mut h = vec![];
|
let mut h = vec![];
|
||||||
h.push("Encrypt the wallet with a password");
|
h.push("Encrypt the wallet with a password");
|
||||||
h.push("Note 1: This will encrypt the seed and the sapling and transparent private keys.");
|
h.push("Note 1: This will encrypt the seed and the private keys.");
|
||||||
h.push(" Use 'unlock' to temporarily unlock the wallet for spending or 'decrypt' ");
|
h.push(" Use 'unlock' to temporarily unlock the wallet for spending or 'decrypt' ");
|
||||||
h.push(" to permanatly remove the encryption");
|
h.push(" to permanatly remove the encryption");
|
||||||
h.push("Note 2: If you forget the password, the only way to recover the wallet is to restore");
|
h.push("Note 2: If you forget the password, the only way to recover the wallet is to restore");
|
||||||
@ -324,7 +324,7 @@ impl Command for DecryptCommand {
|
|||||||
fn help(&self) -> String {
|
fn help(&self) -> String {
|
||||||
let mut h = vec![];
|
let mut h = vec![];
|
||||||
h.push("Completely remove wallet encryption, storing the wallet in plaintext on disk");
|
h.push("Completely remove wallet encryption, storing the wallet in plaintext on disk");
|
||||||
h.push("Note 1: This will decrypt the seed and the sapling and transparent private keys and store them on disk.");
|
h.push("Note 1: This will decrypt the seed and the private keys and store them on disk.");
|
||||||
h.push(" Use 'unlock' to temporarily unlock the wallet for spending");
|
h.push(" Use 'unlock' to temporarily unlock the wallet for spending");
|
||||||
h.push("Note 2: If you've forgotten the password, the only way to recover the wallet is to restore");
|
h.push("Note 2: If you've forgotten the password, the only way to recover the wallet is to restore");
|
||||||
h.push(" from the seed phrase.");
|
h.push(" from the seed phrase.");
|
||||||
@ -444,7 +444,7 @@ struct SendCommand {}
|
|||||||
impl Command for SendCommand {
|
impl Command for SendCommand {
|
||||||
fn help(&self) -> String {
|
fn help(&self) -> String {
|
||||||
let mut h = vec![];
|
let mut h = vec![];
|
||||||
h.push("Send ZEC to a given address(es)");
|
h.push("Send ARRR to a given address(es)");
|
||||||
h.push("Usage:");
|
h.push("Usage:");
|
||||||
h.push("send '{'input': <address>, 'output': [{'address': <address>, 'amount': <amount in zatoshis>, 'memo': <optional memo>}, ...]}");
|
h.push("send '{'input': <address>, 'output': [{'address': <address>, 'amount': <amount in zatoshis>, 'memo': <optional memo>}, ...]}");
|
||||||
h.push("");
|
h.push("");
|
||||||
@ -456,7 +456,7 @@ impl Command for SendCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn short_help(&self) -> String {
|
fn short_help(&self) -> String {
|
||||||
"Send ZEC to the given address".to_string()
|
"Send ARRR to the given address".to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn exec(&self, args: &[&str], lightclient: &LightClient) -> String {
|
fn exec(&self, args: &[&str], lightclient: &LightClient) -> String {
|
||||||
|
@ -172,13 +172,13 @@ impl LightClientConfig {
|
|||||||
} else {
|
} else {
|
||||||
if cfg!(target_os="macos") || cfg!(target_os="windows") {
|
if cfg!(target_os="macos") || cfg!(target_os="windows") {
|
||||||
zcash_data_location = dirs::data_dir().expect("Couldn't determine app data directory!");
|
zcash_data_location = dirs::data_dir().expect("Couldn't determine app data directory!");
|
||||||
zcash_data_location.push("Zero");
|
zcash_data_location.push("Pirate");
|
||||||
} else {
|
} else {
|
||||||
if dirs::home_dir().is_none() {
|
if dirs::home_dir().is_none() {
|
||||||
info!("Couldn't determine home dir!");
|
info!("Couldn't determine home dir!");
|
||||||
}
|
}
|
||||||
zcash_data_location = dirs::home_dir().expect("Couldn't determine home directory!");
|
zcash_data_location = dirs::home_dir().expect("Couldn't determine home directory!");
|
||||||
zcash_data_location.push(".zero");
|
zcash_data_location.push(".pirate");
|
||||||
};
|
};
|
||||||
|
|
||||||
match &self.chain_name[..] {
|
match &self.chain_name[..] {
|
||||||
@ -770,7 +770,7 @@ impl LightClient {
|
|||||||
}
|
}
|
||||||
}).collect::<Vec<JsonValue>>();
|
}).collect::<Vec<JsonValue>>();
|
||||||
|
|
||||||
// Collect t addresses
|
// Collect t addresses - not required for pirate
|
||||||
let t_addresses = wallet.taddresses.read().unwrap().iter().map( |address| {
|
let t_addresses = wallet.taddresses.read().unwrap().iter().map( |address| {
|
||||||
// Get the balance for this address
|
// Get the balance for this address
|
||||||
let balance = wallet.tbalance(Some(address.clone()));
|
let balance = wallet.tbalance(Some(address.clone()));
|
||||||
|
@ -73,7 +73,7 @@ impl BugBip39Derivation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Tranfer money
|
// Tranfer money
|
||||||
// 1. The desination is z address #0
|
// 1. The destination is z address #0
|
||||||
let zaddr = client.do_address()["z_addresses"][0].as_str().unwrap().to_string();
|
let zaddr = client.do_address()["z_addresses"][0].as_str().unwrap().to_string();
|
||||||
let balance_json = client.do_balance();
|
let balance_json = client.do_balance();
|
||||||
let amount: u64 = balance_json["zbalance"].as_u64().unwrap()
|
let amount: u64 = balance_json["zbalance"].as_u64().unwrap()
|
||||||
|
Loading…
Reference in New Issue
Block a user