mirror of
https://github.com/Qortal/piratewallet-light-cli.git
synced 2025-02-12 02:05:47 +00:00
Cleanup (send working)
This commit is contained in:
parent
3ff71f26b7
commit
c4083a835f
@ -90,7 +90,7 @@ impl Command for SendCommand {
|
|||||||
fn exec(&self, _args: &[String], lightclient: &mut LightClient) {
|
fn exec(&self, _args: &[String], lightclient: &mut LightClient) {
|
||||||
lightclient.do_send(
|
lightclient.do_send(
|
||||||
"ztestsapling1x65nq4dgp0qfywgxcwk9n0fvm4fysmapgr2q00p85ju252h6l7mmxu2jg9cqqhtvzd69jwhgv8d".to_string(),
|
"ztestsapling1x65nq4dgp0qfywgxcwk9n0fvm4fysmapgr2q00p85ju252h6l7mmxu2jg9cqqhtvzd69jwhgv8d".to_string(),
|
||||||
1500000,
|
150000,
|
||||||
Some("Hello from the command".to_string()));
|
Some("Hello from the command".to_string()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -123,7 +123,7 @@ impl Command for SeedCommand {
|
|||||||
fn exec(&self, _args: &[String], lightclient: &mut LightClient) {
|
fn exec(&self, _args: &[String], lightclient: &mut LightClient) {
|
||||||
let phrase = lightclient.do_seed_phrase();
|
let phrase = lightclient.do_seed_phrase();
|
||||||
|
|
||||||
println!("Current seed phrase. PLEASE SAVE THIS CAREFULLY AND DO NOT SHARE IT");
|
println!("PLEASE SAVE YOUR SEED PHRASE CAREFULLY AND DO NOT SHARE IT");
|
||||||
println!();
|
println!();
|
||||||
println!("{}", phrase);
|
println!("{}", phrase);
|
||||||
println!();
|
println!();
|
||||||
|
@ -39,8 +39,8 @@ pub struct LightClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl LightClient {
|
impl LightClient {
|
||||||
pub fn new(seed_phrase: Option<&str>) -> io::Result<Self> {
|
|
||||||
|
|
||||||
|
pub fn new(seed_phrase: Option<&str>) -> io::Result<Self> {
|
||||||
let mut lc = if Path::new("wallet.dat").exists() {
|
let mut lc = if Path::new("wallet.dat").exists() {
|
||||||
// Make sure that if a wallet exists, there is no seed phrase being attempted
|
// Make sure that if a wallet exists, there is no seed phrase being attempted
|
||||||
if !seed_phrase.is_none() {
|
if !seed_phrase.is_none() {
|
||||||
@ -58,7 +58,7 @@ impl LightClient {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let l = LightClient {
|
let l = LightClient {
|
||||||
wallet : Arc::new(LightWallet::new(seed_phrase).unwrap()),
|
wallet : Arc::new(LightWallet::new(seed_phrase)?),
|
||||||
sapling_output : vec![],
|
sapling_output : vec![],
|
||||||
sapling_spend : vec![]
|
sapling_spend : vec![]
|
||||||
};
|
};
|
||||||
@ -287,23 +287,6 @@ impl LightClient {
|
|||||||
light_wallet_clone.scan_full_tx(&tx);
|
light_wallet_clone.scan_full_tx(&tx);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// // Print all the memos for fun.
|
|
||||||
// let memos = self.wallet.txs.read().unwrap()
|
|
||||||
// .values().flat_map(|wtx| {
|
|
||||||
// wtx.notes.iter().map(|nd| nd.memo.clone() ).collect::<Vec<Option<Memo>>>()
|
|
||||||
// })
|
|
||||||
// .map( |m| match m {
|
|
||||||
// Some(memo) => {
|
|
||||||
// match memo.to_utf8() {
|
|
||||||
// Some(Ok(memo_str)) => Some(memo_str),
|
|
||||||
// _ => None
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// _ => None
|
|
||||||
// })
|
|
||||||
// .collect::<Vec<Option<String>>>();
|
|
||||||
//println!("All Wallet Txns {:?}", memos);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn do_send(&self, addr: String, value: u64, memo: Option<String>) {
|
pub fn do_send(&self, addr: String, value: u64, memo: Option<String>) {
|
||||||
|
@ -879,7 +879,8 @@ impl LightWallet {
|
|||||||
println!("{}: Adding output", now() - start_time);
|
println!("{}: Adding output", now() - start_time);
|
||||||
if let Err(e) = match to {
|
if let Err(e) = match to {
|
||||||
address::RecipientAddress::Shielded(to) => {
|
address::RecipientAddress::Shielded(to) => {
|
||||||
builder.add_sapling_output(ovk, to.clone(), value, encoded_memo)
|
// TODO Make it use encoded_memo
|
||||||
|
builder.add_sapling_output(ovk, to.clone(), value, None)
|
||||||
}
|
}
|
||||||
address::RecipientAddress::Transparent(to) => {
|
address::RecipientAddress::Transparent(to) => {
|
||||||
builder.add_transparent_output(&to, value)
|
builder.add_transparent_output(&to, value)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user