Browse Source

port to pirate

master
Cryptoforge 4 years ago
parent
commit
e0ca959796
  1. 2
      cli/src/main.rs
  2. 6
      docker/Dockerfile
  3. 20
      lib/src/commands.rs
  4. 6
      lib/src/lightclient.rs
  5. 2
      lib/src/lightwallet/bugs.rs

2
cli/src/main.rs

@ -10,7 +10,7 @@ use log::error;
pub fn main() {
// Get command line arguments
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 matches = configured_app.get_matches();

6
docker/Dockerfile

@ -37,7 +37,7 @@ RUN cd /opt && wget https://download.libsodium.org/libsodium/releases/libsodium-
RUN apt install -y git
# 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 && \
cd zecwallet-light-cli && \
RUN cd /tmp && git clone https://github.com/piratenetwork/piratewallet-light-cli.git && \
cd piratewallet-light-cli && \
cargo fetch && \
cd /tmp && rm -rf zecwallet-light-cli
cd /tmp && rm -rf piratewallet-light-cli

20
lib/src/commands.rs

@ -205,17 +205,17 @@ struct BalanceCommand {}
impl Command for BalanceCommand {
fn help(&self) -> String {
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("balance");
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")
}
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 {
@ -250,14 +250,14 @@ impl Command for ExportCommand {
fn help(&self) -> String {
let mut h = vec![];
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("export [t-address or z-address]");
h.push("export [z-address]");
h.push("");
h.push("If no address is passed, private key for all addresses in the wallet are exported.");
h.push("");
h.push("Example:");
h.push("export ztestsapling1x65nq4dgp0qfywgxcwk9n0fvm4fysmapgr2q00p85ju252h6l7mmxu2jg9cqqhtvzd69jwhgv8d");
h.push("export zs1x65nq4dgp0qfywgxcwk9n0fvm4fysmapgr2q00p85ju252h6l7mmxu2jg9cqqhtvzd69jwhgv8d");
h.join("\n")
}
@ -284,7 +284,7 @@ impl Command for EncryptCommand {
fn help(&self) -> String {
let mut h = vec![];
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(" to permanatly remove the encryption");
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 {
let mut h = vec![];
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("Note 2: If you've forgotten the password, the only way to recover the wallet is to restore");
h.push(" from the seed phrase.");
@ -444,7 +444,7 @@ struct SendCommand {}
impl Command for SendCommand {
fn help(&self) -> String {
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("send '{'input': <address>, 'output': [{'address': <address>, 'amount': <amount in zatoshis>, 'memo': <optional memo>}, ...]}");
h.push("");
@ -456,7 +456,7 @@ impl Command for SendCommand {
}
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 {

6
lib/src/lightclient.rs

@ -172,13 +172,13 @@ impl LightClientConfig {
} else {
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.push("Zero");
zcash_data_location.push("Pirate");
} else {
if dirs::home_dir().is_none() {
info!("Couldn't determine home dir!");
}
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[..] {
@ -770,7 +770,7 @@ impl LightClient {
}
}).collect::<Vec<JsonValue>>();
// Collect t addresses
// Collect t addresses - not required for pirate
let t_addresses = wallet.taddresses.read().unwrap().iter().map( |address| {
// Get the balance for this address
let balance = wallet.tbalance(Some(address.clone()));

2
lib/src/lightwallet/bugs.rs

@ -73,7 +73,7 @@ impl BugBip39Derivation {
}
// 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 balance_json = client.do_balance();
let amount: u64 = balance_json["zbalance"].as_u64().unwrap()

Loading…
Cancel
Save