Skip to content

Commit

Permalink
Merge pull request #19 from nuttycom/update_librustzcash
Browse files Browse the repository at this point in the history
Update to latest development version of librustzcash crates.
  • Loading branch information
str4d authored May 9, 2024
2 parents 1607a4f + 8e4a7f9 commit b2b249a
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 43 deletions.
45 changes: 25 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ tokio = { version = "1.21.0", features = ["fs", "macros", "rt-multi-thread"] }
tonic = { version = "0.10", features = ["gzip", "tls-webpki-roots"] }
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter", "fmt"] }
zcash_address = "0.3.2"
zcash_client_backend = { version = "0.12.1", features = ["lightwalletd-tonic", "orchard"] }
zcash_client_sqlite = { version = "0.10.2", features = ["unstable", "orchard"] }
zcash_keys = { version = "0.2", features = ["unstable", "orchard"] }
zcash_primitives = "0.15"
zcash_proofs = "0.15"
zcash_protocol = "0.1"
zip321 = "0.0.0"

# TUI
crossterm = { version = "0.27", optional = true, features = ["event-stream"] }
Expand All @@ -43,3 +45,13 @@ tui = [
"dep:tokio-util",
"dep:tui-logger",
]

[patch.crates-io]
zcash_address = { git = "https://github.com/zcash/librustzcash", rev = "9375c1b7edc936b4bb21986c8b16fe26bd412ba2" }
zip321 = { git = "https://github.com/zcash/librustzcash", rev = "9375c1b7edc936b4bb21986c8b16fe26bd412ba2" }
zcash_keys = { git = "https://github.com/zcash/librustzcash", rev = "9375c1b7edc936b4bb21986c8b16fe26bd412ba2" }
zcash_primitives = { git = "https://github.com/zcash/librustzcash", rev = "9375c1b7edc936b4bb21986c8b16fe26bd412ba2" }
zcash_protocol = { git = "https://github.com/zcash/librustzcash", rev = "9375c1b7edc936b4bb21986c8b16fe26bd412ba2" }
zcash_proofs = { git = "https://github.com/zcash/librustzcash", rev = "9375c1b7edc936b4bb21986c8b16fe26bd412ba2" }
zcash_client_backend = { git = "https://github.com/zcash/librustzcash", rev = "9375c1b7edc936b4bb21986c8b16fe26bd412ba2" }
zcash_client_sqlite = { git = "https://github.com/zcash/librustzcash", rev = "9375c1b7edc936b4bb21986c8b16fe26bd412ba2" }
20 changes: 8 additions & 12 deletions src/commands/propose.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
use std::str::FromStr;

use anyhow::anyhow;
use gumdrop::Options;

use zcash_address::ZcashAddress;
use zcash_client_backend::{
data_api::{
wallet::{input_selection::GreedyInputSelector, propose_transfer},
WalletRead,
},
fees::standard::SingleOutputChangeStrategy,
zip321::{Payment, TransactionRequest},
ShieldedProtocol,
};
use zcash_client_sqlite::WalletDb;
use zcash_keys::address::Address;
use zcash_primitives::transaction::{components::amount::NonNegativeAmount, fees::StandardFeeRule};
use zip321::{Payment, TransactionRequest};

use crate::{
data::{get_db_paths, get_wallet_network},
Expand Down Expand Up @@ -85,16 +87,10 @@ impl Command {
Default::default(),
);

let request = TransactionRequest::new(vec![Payment {
recipient_address: Address::decode(&params, &self.address)
.ok_or(error::Error::InvalidRecipient)?,
amount: NonNegativeAmount::from_u64(self.value)
.map_err(|_| error::Error::InvalidAmount)?,
memo: None,
label: None,
message: None,
other_params: vec![],
}])
let request = TransactionRequest::new(vec![Payment::without_memo(
ZcashAddress::from_str(&self.address).map_err(|_| error::Error::InvalidRecipient)?,
NonNegativeAmount::from_u64(self.value).map_err(|_| error::Error::InvalidAmount)?,
)])
.map_err(error::Error::from)?;

let proposal = propose_transfer(
Expand Down
19 changes: 8 additions & 11 deletions src/commands/send.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#![allow(deprecated)]
use std::str::FromStr;

use anyhow::anyhow;
use gumdrop::Options;
use secrecy::ExposeSecret;

use zcash_address::ZcashAddress;
use zcash_client_backend::{
data_api::{
wallet::{input_selection::GreedyInputSelector, spend},
Expand All @@ -12,13 +15,12 @@ use zcash_client_backend::{
keys::UnifiedSpendingKey,
proto::service,
wallet::OvkPolicy,
zip321::{Payment, TransactionRequest},
ShieldedProtocol,
};
use zcash_client_sqlite::WalletDb;
use zcash_keys::address::Address;
use zcash_proofs::prover::LocalTxProver;
use zcash_protocol::value::Zatoshis;
use zip321::{Payment, TransactionRequest};

use crate::{
commands::propose::{parse_fee_rule, FeeRule},
Expand Down Expand Up @@ -89,15 +91,10 @@ impl Command {
Default::default(),
);

let request = TransactionRequest::new(vec![Payment {
recipient_address: Address::decode(&params, &self.address)
.ok_or(error::Error::InvalidRecipient)?,
amount: Zatoshis::from_u64(self.value).map_err(|_| error::Error::InvalidAmount)?,
memo: None,
label: None,
message: None,
other_params: vec![],
}])
let request = TransactionRequest::new(vec![Payment::without_memo(
ZcashAddress::from_str(&self.address).map_err(|_| error::Error::InvalidRecipient)?,
Zatoshis::from_u64(self.value).map_err(|_| error::Error::InvalidAmount)?,
)])
.map_err(error::Error::from)?;

let txids = spend(
Expand Down

0 comments on commit b2b249a

Please sign in to comment.