port to hush
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "zecwalletlitelib"
|
||||
name = "silentdragonlitelib"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
|
||||
@@ -36,38 +36,39 @@ rust-embed = { version = "5.1.0", features = ["debug-embed"] }
|
||||
rand = "0.7.2"
|
||||
|
||||
[dependencies.bellman]
|
||||
git = "https://github.com/adityapk00/librustzcash.git"
|
||||
rev = "188537ea025fcb7fbdfc11266f307a084a5451e4"
|
||||
git = "https://github.com/DenioD/librustzcash.git"
|
||||
rev= "af5f25e87347e9ac42f29c37d43250e9de5c21de"
|
||||
default-features = false
|
||||
features = ["groth16"]
|
||||
|
||||
[dependencies.pairing]
|
||||
git = "https://github.com/adityapk00/librustzcash.git"
|
||||
rev = "188537ea025fcb7fbdfc11266f307a084a5451e4"
|
||||
git = "https://github.com/DenioD/librustzcash.git"
|
||||
rev= "af5f25e87347e9ac42f29c37d43250e9de5c21de"
|
||||
|
||||
[dependencies.zcash_client_backend]
|
||||
git = "https://github.com/adityapk00/librustzcash.git"
|
||||
rev = "188537ea025fcb7fbdfc11266f307a084a5451e4"
|
||||
git = "https://github.com/DenioD/librustzcash.git"
|
||||
rev= "af5f25e87347e9ac42f29c37d43250e9de5c21de"
|
||||
|
||||
default-features = false
|
||||
|
||||
[dependencies.zcash_primitives]
|
||||
git = "https://github.com/adityapk00/librustzcash.git"
|
||||
rev = "188537ea025fcb7fbdfc11266f307a084a5451e4"
|
||||
git = "https://github.com/DenioD/librustzcash.git"
|
||||
rev= "af5f25e87347e9ac42f29c37d43250e9de5c21de"
|
||||
default-features = false
|
||||
features = ["transparent-inputs"]
|
||||
|
||||
[dependencies.zcash_proofs]
|
||||
git = "https://github.com/adityapk00/librustzcash.git"
|
||||
rev = "188537ea025fcb7fbdfc11266f307a084a5451e4"
|
||||
git = "https://github.com/DenioD/librustzcash.git"
|
||||
rev= "af5f25e87347e9ac42f29c37d43250e9de5c21de"
|
||||
default-features = false
|
||||
|
||||
[dependencies.ff]
|
||||
git = "https://github.com/adityapk00/librustzcash.git"
|
||||
rev = "188537ea025fcb7fbdfc11266f307a084a5451e4"
|
||||
git = "https://github.com/DenioD/librustzcash.git"
|
||||
rev= "af5f25e87347e9ac42f29c37d43250e9de5c21de"
|
||||
features = ["ff_derive"]
|
||||
|
||||
[build-dependencies]
|
||||
tower-grpc-build = { git = "https://github.com/tower-rs/tower-grpc", features = ["tower-hyper"] }
|
||||
|
||||
[profile.release]
|
||||
debug = false
|
||||
debug = true
|
||||
@@ -127,7 +127,7 @@ 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 HUSH balance in the wallet");
|
||||
h.push("Usage:");
|
||||
h.push("balance");
|
||||
h.push("");
|
||||
@@ -137,7 +137,7 @@ impl Command for BalanceCommand {
|
||||
}
|
||||
|
||||
fn short_help(&self) -> String {
|
||||
"Show the current ZEC balance in the wallet".to_string()
|
||||
"Show the current HUSH balance in the wallet".to_string()
|
||||
}
|
||||
|
||||
fn exec(&self, _args: &[&str], lightclient: &LightClient) -> String {
|
||||
@@ -206,7 +206,7 @@ struct SendCommand {}
|
||||
impl Command for SendCommand {
|
||||
fn help(&self) -> String {
|
||||
let mut h = vec![];
|
||||
h.push("Send ZEC to a given address");
|
||||
h.push("Send HUSH to a given address");
|
||||
h.push("Usage:");
|
||||
h.push("send <address> <amount in zatoshis> \"optional_memo\"");
|
||||
h.push("");
|
||||
@@ -218,7 +218,7 @@ impl Command for SendCommand {
|
||||
}
|
||||
|
||||
fn short_help(&self) -> String {
|
||||
"Send ZEC to the given address".to_string()
|
||||
"Send HUSH to the given address".to_string()
|
||||
}
|
||||
|
||||
fn exec(&self, args: &[&str], lightclient: &LightClient) -> String {
|
||||
@@ -232,7 +232,7 @@ impl Command for SendCommand {
|
||||
let value = match args[1].parse::<u64>() {
|
||||
Ok(amt) => amt,
|
||||
Err(e) => {
|
||||
return format!("Couldn't parse amount: {}", e);
|
||||
return format!("Couldn't parse amount: {}", e);;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@ use crate::grpcconnector::{self, *};
|
||||
use crate::SaplingParams;
|
||||
use crate::ANCHOR_OFFSET;
|
||||
|
||||
pub const DEFAULT_SERVER: &str = "https://lightd-main.zecwallet.co:443";
|
||||
pub const WALLET_NAME: &str = "zecwallet-light-wallet.dat";
|
||||
pub const LOGFILE_NAME: &str = "zecwallet-light-wallet.debug.log";
|
||||
pub const DEFAULT_SERVER: &str = "https://";
|
||||
pub const WALLET_NAME: &str = "silentdragonlite-cli.dat";
|
||||
pub const LOGFILE_NAME: &str = "silentdragonlite-cli.debug.log";
|
||||
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
@@ -61,10 +61,10 @@ impl LightClientConfig {
|
||||
let mut zcash_data_location;
|
||||
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("Zcash");
|
||||
zcash_data_location.push("HUSH3");
|
||||
} else {
|
||||
zcash_data_location = dirs::home_dir().expect("Couldn't determine home directory!");
|
||||
zcash_data_location.push(".zcash");
|
||||
zcash_data_location.push(".komodo/HUSH3/SilentDragonLite/");
|
||||
};
|
||||
|
||||
match &self.chain_name[..] {
|
||||
@@ -93,13 +93,13 @@ impl LightClientConfig {
|
||||
|
||||
pub fn get_initial_state(&self) -> Option<(u64, &str, &str)> {
|
||||
match &self.chain_name[..] {
|
||||
"test" => Some((600000,
|
||||
"0107385846c7451480912c294b6ce1ee1feba6c2619079fd9104f6e71e4d8fe7",
|
||||
"01690698411e3f8badea7da885e556d7aba365a797e9b20b44ac0946dced14b23c001001ab2a18a5a86aa5d77e43b69071b21770b6fe6b3c26304dcaf7f96c0bb3fed74d000186482712fa0f2e5aa2f2700c4ed49ef360820f323d34e2b447b78df5ec4dfa0401a332e89a21afb073cb1db7d6f07396b56a95e97454b9bca5a63d0ebc575d3a33000000000001c9d3564eff54ebc328eab2e4f1150c3637f4f47516f879a0cfebdf49fe7b1d5201c104705fac60a85596010e41260d07f3a64f38f37a112eaef41cd9d736edc5270145e3d4899fcd7f0f1236ae31eafb3f4b65ad6b11a17eae1729cec09bd3afa01a000000011f8322ef806eb2430dc4a7a41c1b344bea5be946efc7b4349c1c9edb14ff9d39"
|
||||
"test" => Some((105942,
|
||||
"00000001c0199f329ee03379bf1387856dbab23765da508bf9b9d8d544f212c0",
|
||||
""
|
||||
)),
|
||||
"main" => Some((610000,
|
||||
"000000000218882f481e3b49ca3df819734b8d74aac91f69e848d7499b34b472",
|
||||
"0192943f1eca6525cea7ea8e26b37c792593ed50cfe2be7a1ff551a08dc64b812f001000000001deef7ae5162a9942b4b9aa797137c5bdf60750e9548664127df99d1981dda66901747ad24d5daf294ce2a27aba923e16e52e7348eea3048c5b5654b99ab0a371200149d8aff830305beb3887529f6deb150ab012916c3ce88a6b47b78228f8bfeb3f01ff84a89890cfae65e0852bc44d9aa82be2c5d204f5aebf681c9e966aa46f540e000001d58f1dfaa9db0996996129f8c474acb813bfed452d347fb17ebac2e775e209120000000001319312241b0031e3a255b0d708750b4cb3f3fe79e3503fe488cc8db1dd00753801754bb593ea42d231a7ddf367640f09bbf59dc00f2c1d2003cc340e0c016b5b13"
|
||||
"main" => Some((105944,
|
||||
"0000000313b0ec7c5a1e9b997ce44a7763b56c5505526c36634a004ed52d7787",
|
||||
""
|
||||
)),
|
||||
_ => None
|
||||
}
|
||||
@@ -146,21 +146,21 @@ impl LightClientConfig {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn base58_pubkey_address(&self) -> [u8; 2] {
|
||||
pub fn base58_pubkey_address(&self) -> [u8; 1] {
|
||||
match &self.chain_name[..] {
|
||||
"main" => mainnet::B58_PUBKEY_ADDRESS_PREFIX,
|
||||
"test" => testnet::B58_PUBKEY_ADDRESS_PREFIX,
|
||||
"regtest" => regtest::B58_PUBKEY_ADDRESS_PREFIX,
|
||||
|
||||
|
||||
c => panic!("Unknown chain {}", c)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pub fn base58_script_address(&self) -> [u8; 2] {
|
||||
pub fn base58_script_address(&self) -> [u8; 1] {
|
||||
match &self.chain_name[..] {
|
||||
"main" => mainnet::B58_SCRIPT_ADDRESS_PREFIX,
|
||||
"test" => testnet::B58_SCRIPT_ADDRESS_PREFIX,
|
||||
"regtest" => regtest::B58_SCRIPT_ADDRESS_PREFIX,
|
||||
|
||||
|
||||
c => panic!("Unknown chain {}", c)
|
||||
}
|
||||
}
|
||||
@@ -435,7 +435,7 @@ impl LightClient {
|
||||
"unconfirmed_spent" => utxo.unconfirmed_spent.map(|spent_txid| format!("{}", spent_txid)),
|
||||
}
|
||||
)
|
||||
.collect::<Vec<JsonValue>>();
|
||||
.collect::<Vec<JsonValue>>();;
|
||||
|
||||
let mut res = object!{
|
||||
"unspent_notes" => unspent_notes,
|
||||
|
||||
@@ -2868,7 +2868,7 @@ pub mod tests {
|
||||
|
||||
// Test the addresses against https://iancoleman.io/bip39/
|
||||
let (taddr, pk) = &wallet.get_t_secret_keys()[0];
|
||||
assert_eq!(taddr, "t1eQ63fwkQ4n4Eo5uCrPGaAV8FWB2tmx7ui");
|
||||
assert_eq!(taddr, "RVog7rQu2Zo2iAQCjbZGXsiQm7SYr9bcaq");
|
||||
assert_eq!(pk, "Kz9ybX4giKag4NtnP1pi8WQF2B2hZDkFU85S7Dciz3UUhM59AnhE");
|
||||
|
||||
let (zaddr, sk) = &wallet.get_z_private_keys()[0];
|
||||
@@ -2880,7 +2880,7 @@ pub mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_invalid_scan_blocks() {
|
||||
const AMOUNT: u64 = 500000;
|
||||
const AMOUNT: u64 = 50000;
|
||||
let (wallet, _txid1, block_hash) = get_test_wallet(AMOUNT);
|
||||
|
||||
let prev_hash = add_blocks(&wallet, 2, 1, block_hash).unwrap();
|
||||
|
||||
@@ -24,7 +24,7 @@ impl From<TransparentAddress> for RecipientAddress {
|
||||
}
|
||||
|
||||
impl RecipientAddress {
|
||||
pub fn from_str(s: &str, hrp_sapling_address: &str, b58_pubkey_address: [u8; 2], b58_script_address: [u8; 2]) -> Option<Self> {
|
||||
pub fn from_str(s: &str, hrp_sapling_address: &str, b58_pubkey_address: [u8; 1], b58_script_address: [u8; 1]) -> Option<Self> {
|
||||
// Try to match a sapling z address
|
||||
if let Some(pa) = match decode_payment_address(hrp_sapling_address, s) {
|
||||
Ok(ret) => ret,
|
||||
|
||||
@@ -267,7 +267,7 @@ impl Utxo {
|
||||
let mut address_bytes = vec![0; address_len as usize];
|
||||
reader.read_exact(&mut address_bytes)?;
|
||||
let address = String::from_utf8(address_bytes).unwrap();
|
||||
assert_eq!(address.chars().take(1).collect::<Vec<char>>()[0], 't');
|
||||
assert_eq!(address.chars().take(1).collect::<Vec<char>>()[0], 'R');
|
||||
|
||||
let mut txid_bytes = [0; 32];
|
||||
reader.read_exact(&mut txid_bytes)?;
|
||||
|
||||
Reference in New Issue
Block a user