Merge pull request #75 from zcash/remove_deprecated_api_usage
Remove uses of `zcash_primitives` public reexports.
This commit is contained in:
commit
825e969d1e
|
@ -7,17 +7,20 @@ use bech32::Bech32;
|
||||||
use clap::Args;
|
use clap::Args;
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use secrecy::Zeroize;
|
use secrecy::Zeroize;
|
||||||
|
|
||||||
use zcash_address::{
|
use zcash_address::{
|
||||||
unified::{self, Encoding},
|
unified::{self, Encoding},
|
||||||
ZcashAddress,
|
ZcashAddress,
|
||||||
};
|
};
|
||||||
use zcash_primitives::{block::BlockHeader, consensus::BranchId, transaction::Transaction};
|
use zcash_primitives::{block::BlockHeader, transaction::Transaction};
|
||||||
use zcash_proofs::{default_params_folder, load_parameters, ZcashParameters};
|
use zcash_proofs::{default_params_folder, load_parameters, ZcashParameters};
|
||||||
use zcash_protocol::consensus::NetworkType;
|
use zcash_protocol::{
|
||||||
|
consensus::{BranchId, NetworkType},
|
||||||
|
constants,
|
||||||
|
};
|
||||||
|
|
||||||
mod context;
|
mod context;
|
||||||
use context::{Context, ZUint256};
|
use context::{Context, ZUint256};
|
||||||
use zcash_protocol::constants;
|
|
||||||
|
|
||||||
mod address;
|
mod address;
|
||||||
mod block;
|
mod block;
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
use zcash_address::{
|
use zcash_address::{
|
||||||
unified::{self, Container, Encoding},
|
unified::{self, Container, Encoding},
|
||||||
ConversionError, Network, ToAddress, ZcashAddress,
|
ConversionError, ToAddress, ZcashAddress,
|
||||||
};
|
};
|
||||||
|
use zcash_protocol::consensus::NetworkType;
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
enum AddressKind {
|
enum AddressKind {
|
||||||
|
@ -14,14 +15,17 @@ enum AddressKind {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Address {
|
struct Address {
|
||||||
net: Network,
|
net: NetworkType,
|
||||||
kind: AddressKind,
|
kind: AddressKind,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl zcash_address::TryFromAddress for Address {
|
impl zcash_address::TryFromAddress for Address {
|
||||||
type Error = ();
|
type Error = ();
|
||||||
|
|
||||||
fn try_from_sprout(net: Network, data: [u8; 64]) -> Result<Self, ConversionError<Self::Error>> {
|
fn try_from_sprout(
|
||||||
|
net: NetworkType,
|
||||||
|
data: [u8; 64],
|
||||||
|
) -> Result<Self, ConversionError<Self::Error>> {
|
||||||
Ok(Address {
|
Ok(Address {
|
||||||
net,
|
net,
|
||||||
kind: AddressKind::Sprout(data),
|
kind: AddressKind::Sprout(data),
|
||||||
|
@ -29,7 +33,7 @@ impl zcash_address::TryFromAddress for Address {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn try_from_sapling(
|
fn try_from_sapling(
|
||||||
net: Network,
|
net: NetworkType,
|
||||||
data: [u8; 43],
|
data: [u8; 43],
|
||||||
) -> Result<Self, ConversionError<Self::Error>> {
|
) -> Result<Self, ConversionError<Self::Error>> {
|
||||||
Ok(Address {
|
Ok(Address {
|
||||||
|
@ -39,7 +43,7 @@ impl zcash_address::TryFromAddress for Address {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn try_from_unified(
|
fn try_from_unified(
|
||||||
net: Network,
|
net: NetworkType,
|
||||||
data: unified::Address,
|
data: unified::Address,
|
||||||
) -> Result<Self, ConversionError<Self::Error>> {
|
) -> Result<Self, ConversionError<Self::Error>> {
|
||||||
Ok(Address {
|
Ok(Address {
|
||||||
|
@ -49,7 +53,7 @@ impl zcash_address::TryFromAddress for Address {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn try_from_transparent_p2pkh(
|
fn try_from_transparent_p2pkh(
|
||||||
net: Network,
|
net: NetworkType,
|
||||||
data: [u8; 20],
|
data: [u8; 20],
|
||||||
) -> Result<Self, ConversionError<Self::Error>> {
|
) -> Result<Self, ConversionError<Self::Error>> {
|
||||||
Ok(Address {
|
Ok(Address {
|
||||||
|
@ -59,7 +63,7 @@ impl zcash_address::TryFromAddress for Address {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn try_from_transparent_p2sh(
|
fn try_from_transparent_p2sh(
|
||||||
net: Network,
|
net: NetworkType,
|
||||||
data: [u8; 20],
|
data: [u8; 20],
|
||||||
) -> Result<Self, ConversionError<Self::Error>> {
|
) -> Result<Self, ConversionError<Self::Error>> {
|
||||||
Ok(Address {
|
Ok(Address {
|
||||||
|
@ -68,7 +72,10 @@ impl zcash_address::TryFromAddress for Address {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn try_from_tex(net: Network, data: [u8; 20]) -> Result<Self, ConversionError<Self::Error>> {
|
fn try_from_tex(
|
||||||
|
net: NetworkType,
|
||||||
|
data: [u8; 20],
|
||||||
|
) -> Result<Self, ConversionError<Self::Error>> {
|
||||||
Ok(Address {
|
Ok(Address {
|
||||||
net,
|
net,
|
||||||
kind: AddressKind::Tex(data),
|
kind: AddressKind::Tex(data),
|
||||||
|
@ -87,9 +94,9 @@ pub(crate) fn inspect(addr: ZcashAddress) {
|
||||||
eprintln!(
|
eprintln!(
|
||||||
" - Network: {}",
|
" - Network: {}",
|
||||||
match addr.net {
|
match addr.net {
|
||||||
Network::Main => "main",
|
NetworkType::Main => "main",
|
||||||
Network::Test => "testnet",
|
NetworkType::Test => "testnet",
|
||||||
Network::Regtest => "regtest",
|
NetworkType::Regtest => "regtest",
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
eprintln!(
|
eprintln!(
|
||||||
|
|
|
@ -2,17 +2,14 @@
|
||||||
#![allow(clippy::assign_op_pattern)]
|
#![allow(clippy::assign_op_pattern)]
|
||||||
#![allow(clippy::ptr_offset_with_cast)]
|
#![allow(clippy::ptr_offset_with_cast)]
|
||||||
|
|
||||||
|
use sha2::{Digest, Sha256};
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::convert::{TryFrom, TryInto};
|
use std::convert::{TryFrom, TryInto};
|
||||||
use std::io::{self, Read};
|
use std::io::{self, Read};
|
||||||
|
|
||||||
use sha2::{Digest, Sha256};
|
|
||||||
use zcash_encoding::Vector;
|
use zcash_encoding::Vector;
|
||||||
use zcash_primitives::{
|
use zcash_primitives::{block::BlockHeader, transaction::Transaction};
|
||||||
block::BlockHeader,
|
use zcash_protocol::consensus::{BlockHeight, BranchId, Network, NetworkUpgrade, Parameters};
|
||||||
consensus::{BlockHeight, BranchId, Network, NetworkUpgrade, Parameters},
|
|
||||||
transaction::Transaction,
|
|
||||||
};
|
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
transaction::{extract_height_from_coinbase, is_coinbase},
|
transaction::{extract_height_from_coinbase, is_coinbase},
|
||||||
|
|
|
@ -6,12 +6,13 @@ use serde::{
|
||||||
de::{Unexpected, Visitor},
|
de::{Unexpected, Visitor},
|
||||||
Deserialize, Serialize, Serializer,
|
Deserialize, Serialize, Serializer,
|
||||||
};
|
};
|
||||||
use zcash_primitives::{
|
|
||||||
consensus::Network,
|
use ::transparent::{address::Script, bundle as transparent, bundle::TxOut};
|
||||||
legacy::Script,
|
use zcash_protocol::{
|
||||||
transaction::components::{amount::NonNegativeAmount, transparent, TxOut},
|
consensus::{Network, NetworkType},
|
||||||
zip32::AccountId,
|
value::Zatoshis,
|
||||||
};
|
};
|
||||||
|
use zip32::AccountId;
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug)]
|
||||||
pub(crate) struct JsonNetwork(Network);
|
pub(crate) struct JsonNetwork(Network);
|
||||||
|
@ -170,7 +171,7 @@ impl fmt::Display for ZUint256 {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
struct ZOutputValue(NonNegativeAmount);
|
struct ZOutputValue(Zatoshis);
|
||||||
|
|
||||||
struct ZOutputValueVisitor;
|
struct ZOutputValueVisitor;
|
||||||
|
|
||||||
|
@ -185,7 +186,7 @@ impl Visitor<'_> for ZOutputValueVisitor {
|
||||||
where
|
where
|
||||||
E: serde::de::Error,
|
E: serde::de::Error,
|
||||||
{
|
{
|
||||||
NonNegativeAmount::from_u64(v)
|
Zatoshis::from_u64(v)
|
||||||
.map(ZOutputValue)
|
.map(ZOutputValue)
|
||||||
.map_err(|e| match e {
|
.map_err(|e| match e {
|
||||||
zcash_protocol::value::BalanceError::Overflow => serde::de::Error::invalid_type(
|
zcash_protocol::value::BalanceError::Overflow => serde::de::Error::invalid_type(
|
||||||
|
@ -297,10 +298,10 @@ impl Context {
|
||||||
self.network.map(|n| n.0)
|
self.network.map(|n| n.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn addr_network(&self) -> Option<zcash_address::Network> {
|
pub(crate) fn addr_network(&self) -> Option<NetworkType> {
|
||||||
self.network().map(|params| match params {
|
self.network().map(|params| match params {
|
||||||
Network::MainNetwork => zcash_address::Network::Main,
|
Network::MainNetwork => NetworkType::Main,
|
||||||
Network::TestNetwork => zcash_address::Network::Test,
|
Network::TestNetwork => NetworkType::Test,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,18 +3,16 @@ use std::iter;
|
||||||
|
|
||||||
use bech32::{Bech32, Hrp};
|
use bech32::{Bech32, Hrp};
|
||||||
use secrecy::Zeroize;
|
use secrecy::Zeroize;
|
||||||
|
|
||||||
|
use ::transparent::{
|
||||||
|
address::TransparentAddress,
|
||||||
|
keys::{AccountPrivKey, IncomingViewingKey},
|
||||||
|
};
|
||||||
use zcash_address::{
|
use zcash_address::{
|
||||||
unified::{self, Encoding},
|
unified::{self, Encoding},
|
||||||
ToAddress, ZcashAddress,
|
ToAddress, ZcashAddress,
|
||||||
};
|
};
|
||||||
use zcash_keys::keys::UnifiedFullViewingKey;
|
use zcash_keys::keys::UnifiedFullViewingKey;
|
||||||
use zcash_primitives::{
|
|
||||||
legacy::{
|
|
||||||
keys::{AccountPrivKey, IncomingViewingKey},
|
|
||||||
TransparentAddress,
|
|
||||||
},
|
|
||||||
zip32,
|
|
||||||
};
|
|
||||||
use zcash_protocol::{
|
use zcash_protocol::{
|
||||||
consensus::{Network, NetworkConstants, NetworkType},
|
consensus::{Network, NetworkConstants, NetworkType},
|
||||||
local_consensus::LocalNetwork,
|
local_consensus::LocalNetwork,
|
||||||
|
|
|
@ -3,28 +3,35 @@ use std::{
|
||||||
convert::{TryFrom, TryInto},
|
convert::{TryFrom, TryInto},
|
||||||
};
|
};
|
||||||
|
|
||||||
use ::transparent::sighash::SighashType;
|
|
||||||
use bellman::groth16;
|
use bellman::groth16;
|
||||||
use group::GroupEncoding;
|
use group::GroupEncoding;
|
||||||
use orchard::note_encryption::OrchardDomain;
|
|
||||||
use sapling::{note_encryption::SaplingDomain, SaplingVerificationContext};
|
use sapling::{note_encryption::SaplingDomain, SaplingVerificationContext};
|
||||||
use secp256k1::{Secp256k1, VerifyOnly};
|
use secp256k1::{Secp256k1, VerifyOnly};
|
||||||
|
|
||||||
|
#[allow(deprecated)]
|
||||||
|
use ::transparent::keys::pubkey_to_address;
|
||||||
|
use ::transparent::{
|
||||||
|
address::{Script, TransparentAddress},
|
||||||
|
bundle as transparent,
|
||||||
|
sighash::{SighashType, TransparentAuthorizingContext},
|
||||||
|
};
|
||||||
|
use orchard::note_encryption::OrchardDomain;
|
||||||
use zcash_address::{
|
use zcash_address::{
|
||||||
unified::{self, Encoding},
|
unified::{self, Encoding},
|
||||||
ToAddress, ZcashAddress,
|
ToAddress, ZcashAddress,
|
||||||
};
|
};
|
||||||
use zcash_note_encryption::try_output_recovery_with_ovk;
|
use zcash_note_encryption::try_output_recovery_with_ovk;
|
||||||
#[allow(deprecated)]
|
#[allow(deprecated)]
|
||||||
use zcash_primitives::{
|
use zcash_primitives::transaction::{
|
||||||
|
components::sapling as sapling_serialization,
|
||||||
|
sighash::{signature_hash, SignableInput},
|
||||||
|
txid::TxIdDigester,
|
||||||
|
Authorization, Transaction, TransactionData, TxId, TxVersion,
|
||||||
|
};
|
||||||
|
use zcash_protocol::{
|
||||||
consensus::BlockHeight,
|
consensus::BlockHeight,
|
||||||
legacy::{keys::pubkey_to_address, Script, TransparentAddress},
|
|
||||||
memo::{Memo, MemoBytes},
|
memo::{Memo, MemoBytes},
|
||||||
transaction::{
|
value::Zatoshis,
|
||||||
components::{amount::NonNegativeAmount, sapling as sapling_serialization, transparent},
|
|
||||||
sighash::{signature_hash, SignableInput, TransparentAuthorizingContext},
|
|
||||||
txid::TxIdDigester,
|
|
||||||
Authorization, Transaction, TransactionData, TxId, TxVersion,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
|
@ -106,7 +113,7 @@ impl transparent::Authorization for TransparentAuth {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TransparentAuthorizingContext for TransparentAuth {
|
impl TransparentAuthorizingContext for TransparentAuth {
|
||||||
fn input_amounts(&self) -> Vec<NonNegativeAmount> {
|
fn input_amounts(&self) -> Vec<Zatoshis> {
|
||||||
self.all_prev_outputs
|
self.all_prev_outputs
|
||||||
.iter()
|
.iter()
|
||||||
.map(|prevout| prevout.value)
|
.map(|prevout| prevout.value)
|
||||||
|
|
|
@ -5,6 +5,7 @@ use anyhow::anyhow;
|
||||||
use clap::Args;
|
use clap::Args;
|
||||||
use tokio::io::{stdout, AsyncWriteExt};
|
use tokio::io::{stdout, AsyncWriteExt};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use zcash_address::ZcashAddress;
|
use zcash_address::ZcashAddress;
|
||||||
use zcash_client_backend::{
|
use zcash_client_backend::{
|
||||||
data_api::{
|
data_api::{
|
||||||
|
@ -15,12 +16,12 @@ use zcash_client_backend::{
|
||||||
},
|
},
|
||||||
fees::{standard::MultiOutputChangeStrategy, DustOutputPolicy, SplitPolicy, StandardFeeRule},
|
fees::{standard::MultiOutputChangeStrategy, DustOutputPolicy, SplitPolicy, StandardFeeRule},
|
||||||
wallet::OvkPolicy,
|
wallet::OvkPolicy,
|
||||||
ShieldedProtocol,
|
|
||||||
};
|
};
|
||||||
use zcash_client_sqlite::WalletDb;
|
use zcash_client_sqlite::WalletDb;
|
||||||
use zcash_protocol::{
|
use zcash_protocol::{
|
||||||
memo::{Memo, MemoBytes},
|
memo::{Memo, MemoBytes},
|
||||||
value::Zatoshis,
|
value::Zatoshis,
|
||||||
|
ShieldedProtocol,
|
||||||
};
|
};
|
||||||
use zip321::{Payment, TransactionRequest};
|
use zip321::{Payment, TransactionRequest};
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,10 @@ use clap::Args;
|
||||||
use pczt::{roles::verifier::Verifier, Pczt};
|
use pczt::{roles::verifier::Verifier, Pczt};
|
||||||
use secrecy::ExposeSecret;
|
use secrecy::ExposeSecret;
|
||||||
use tokio::io::{stdin, AsyncReadExt};
|
use tokio::io::{stdin, AsyncReadExt};
|
||||||
|
|
||||||
|
use ::transparent::sighash::SighashType;
|
||||||
use zcash_primitives::transaction::{
|
use zcash_primitives::transaction::{
|
||||||
sighash::{SighashType, SignableInput},
|
sighash::SignableInput,
|
||||||
sighash_v5::v5_signature_hash,
|
sighash_v5::v5_signature_hash,
|
||||||
txid::{to_txid, TxIdDigester},
|
txid::{to_txid, TxIdDigester},
|
||||||
TxVersion,
|
TxVersion,
|
||||||
|
|
|
@ -254,11 +254,8 @@ impl<'b, C> minicbor::Decode<'b, C> for ZcashPczt {
|
||||||
cbor_map(d, &mut result, |key, obj, d| {
|
cbor_map(d, &mut result, |key, obj, d| {
|
||||||
let key =
|
let key =
|
||||||
u8::try_from(key).map_err(|e| minicbor::decode::Error::message(e.to_string()))?;
|
u8::try_from(key).map_err(|e| minicbor::decode::Error::message(e.to_string()))?;
|
||||||
match key {
|
if key == DATA {
|
||||||
DATA => {
|
obj.data = d.bytes()?.to_vec();
|
||||||
obj.data = d.bytes()?.to_vec();
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
})?;
|
})?;
|
||||||
|
|
|
@ -13,10 +13,9 @@ use zcash_client_backend::{
|
||||||
},
|
},
|
||||||
fees::{standard::MultiOutputChangeStrategy, DustOutputPolicy, SplitPolicy, StandardFeeRule},
|
fees::{standard::MultiOutputChangeStrategy, DustOutputPolicy, SplitPolicy, StandardFeeRule},
|
||||||
wallet::OvkPolicy,
|
wallet::OvkPolicy,
|
||||||
ShieldedProtocol,
|
|
||||||
};
|
};
|
||||||
use zcash_client_sqlite::WalletDb;
|
use zcash_client_sqlite::WalletDb;
|
||||||
use zcash_protocol::value::Zatoshis;
|
use zcash_protocol::{value::Zatoshis, ShieldedProtocol};
|
||||||
|
|
||||||
use crate::{commands::select_account, config::WalletConfig, data::get_db_paths, error};
|
use crate::{commands::select_account, config::WalletConfig, data::get_db_paths, error};
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,9 @@ use pczt::{
|
||||||
};
|
};
|
||||||
use secrecy::ExposeSecret;
|
use secrecy::ExposeSecret;
|
||||||
use tokio::io::{stdin, stdout, AsyncReadExt, AsyncWriteExt};
|
use tokio::io::{stdin, stdout, AsyncReadExt, AsyncWriteExt};
|
||||||
|
|
||||||
|
use ::transparent::keys::{NonHardenedChildIndex, TransparentKeyScope};
|
||||||
use zcash_keys::keys::UnifiedSpendingKey;
|
use zcash_keys::keys::UnifiedSpendingKey;
|
||||||
use zcash_primitives::legacy::keys::{NonHardenedChildIndex, TransparentKeyScope};
|
|
||||||
use zcash_protocol::consensus::{NetworkConstants, Parameters};
|
use zcash_protocol::consensus::{NetworkConstants, Parameters};
|
||||||
use zip32::fingerprint::SeedFingerprint;
|
use zip32::fingerprint::SeedFingerprint;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
use anyhow::anyhow;
|
use anyhow::anyhow;
|
||||||
use clap::Args;
|
use clap::Args;
|
||||||
|
|
||||||
use zcash_address::unified::{self, Encoding};
|
use zcash_address::unified::{self, Encoding};
|
||||||
use zcash_client_backend::{
|
use zcash_client_backend::{
|
||||||
data_api::{AccountBirthday, AccountPurpose, WalletWrite, Zip32Derivation},
|
data_api::{AccountBirthday, AccountPurpose, WalletWrite, Zip32Derivation},
|
||||||
|
@ -7,7 +8,7 @@ use zcash_client_backend::{
|
||||||
};
|
};
|
||||||
use zcash_client_sqlite::WalletDb;
|
use zcash_client_sqlite::WalletDb;
|
||||||
use zcash_keys::keys::UnifiedFullViewingKey;
|
use zcash_keys::keys::UnifiedFullViewingKey;
|
||||||
use zcash_primitives::consensus;
|
use zcash_protocol::consensus;
|
||||||
use zip32::fingerprint::SeedFingerprint;
|
use zip32::fingerprint::SeedFingerprint;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
|
|
@ -9,8 +9,7 @@ use zcash_client_backend::{
|
||||||
data_api::{AccountBirthday, WalletWrite},
|
data_api::{AccountBirthday, WalletWrite},
|
||||||
proto::service::{self, compact_tx_streamer_client::CompactTxStreamerClient},
|
proto::service::{self, compact_tx_streamer_client::CompactTxStreamerClient},
|
||||||
};
|
};
|
||||||
use zcash_primitives::consensus::{self, Parameters};
|
use zcash_protocol::consensus::{self, BlockHeight, Parameters};
|
||||||
use zcash_protocol::consensus::BlockHeight;
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
config::WalletConfig,
|
config::WalletConfig,
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
use anyhow::anyhow;
|
use anyhow::anyhow;
|
||||||
use clap::Args;
|
use clap::Args;
|
||||||
|
|
||||||
use zcash_address::unified::{Encoding, Ufvk};
|
use zcash_address::unified::{Encoding, Ufvk};
|
||||||
use zcash_client_backend::{
|
use zcash_client_backend::{
|
||||||
data_api::{AccountPurpose, WalletWrite, Zip32Derivation},
|
data_api::{AccountPurpose, WalletWrite, Zip32Derivation},
|
||||||
proto::service,
|
proto::service,
|
||||||
};
|
};
|
||||||
use zcash_keys::{encoding::decode_extfvk_with_network, keys::UnifiedFullViewingKey};
|
use zcash_keys::{encoding::decode_extfvk_with_network, keys::UnifiedFullViewingKey};
|
||||||
use zcash_primitives::consensus::NetworkType;
|
use zcash_protocol::consensus::{self, NetworkType};
|
||||||
use zcash_protocol::consensus;
|
|
||||||
use zip32::fingerprint::SeedFingerprint;
|
use zip32::fingerprint::SeedFingerprint;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
|
|
@ -2,16 +2,12 @@ use anyhow::anyhow;
|
||||||
use clap::Args;
|
use clap::Args;
|
||||||
use rusqlite::{named_params, Connection};
|
use rusqlite::{named_params, Connection};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
use zcash_primitives::{
|
|
||||||
consensus::BlockHeight,
|
|
||||||
transaction::{
|
|
||||||
components::{amount::NonNegativeAmount, Amount},
|
|
||||||
TxId,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
use zcash_protocol::{
|
use zcash_protocol::{
|
||||||
|
consensus::BlockHeight,
|
||||||
memo::{Memo, MemoBytes},
|
memo::{Memo, MemoBytes},
|
||||||
PoolType,
|
value::{ZatBalance, Zatoshis},
|
||||||
|
PoolType, TxId,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{data::get_db_paths, ui::format_zec};
|
use crate::{data::get_db_paths, ui::format_zec};
|
||||||
|
@ -132,7 +128,7 @@ struct WalletTxOutput {
|
||||||
from_account: Option<Uuid>,
|
from_account: Option<Uuid>,
|
||||||
to_account: Option<Uuid>,
|
to_account: Option<Uuid>,
|
||||||
to_address: Option<String>,
|
to_address: Option<String>,
|
||||||
value: NonNegativeAmount,
|
value: Zatoshis,
|
||||||
is_change: bool,
|
is_change: bool,
|
||||||
memo: Option<Memo>,
|
memo: Option<Memo>,
|
||||||
}
|
}
|
||||||
|
@ -165,7 +161,7 @@ impl WalletTxOutput {
|
||||||
from_account,
|
from_account,
|
||||||
to_account,
|
to_account,
|
||||||
to_address,
|
to_address,
|
||||||
value: NonNegativeAmount::from_nonnegative_i64(value)?,
|
value: Zatoshis::from_nonnegative_i64(value)?,
|
||||||
is_change,
|
is_change,
|
||||||
memo: memo
|
memo: memo
|
||||||
.as_ref()
|
.as_ref()
|
||||||
|
@ -212,8 +208,8 @@ struct WalletTx {
|
||||||
mined_height: Option<BlockHeight>,
|
mined_height: Option<BlockHeight>,
|
||||||
txid: TxId,
|
txid: TxId,
|
||||||
expiry_height: Option<BlockHeight>,
|
expiry_height: Option<BlockHeight>,
|
||||||
account_balance_delta: Amount,
|
account_balance_delta: ZatBalance,
|
||||||
fee_paid: Option<NonNegativeAmount>,
|
fee_paid: Option<Zatoshis>,
|
||||||
sent_note_count: usize,
|
sent_note_count: usize,
|
||||||
received_note_count: usize,
|
received_note_count: usize,
|
||||||
memo_count: usize,
|
memo_count: usize,
|
||||||
|
@ -241,10 +237,10 @@ impl WalletTx {
|
||||||
mined_height: mined_height.map(BlockHeight::from_u32),
|
mined_height: mined_height.map(BlockHeight::from_u32),
|
||||||
txid: TxId::from_bytes(txid.try_into().map_err(|_| anyhow!("Invalid TxId"))?),
|
txid: TxId::from_bytes(txid.try_into().map_err(|_| anyhow!("Invalid TxId"))?),
|
||||||
expiry_height: expiry_height.map(BlockHeight::from_u32),
|
expiry_height: expiry_height.map(BlockHeight::from_u32),
|
||||||
account_balance_delta: Amount::from_i64(account_balance_delta)
|
account_balance_delta: ZatBalance::from_i64(account_balance_delta)
|
||||||
.map_err(|_| anyhow!("Amount out of range"))?,
|
.map_err(|_| anyhow!("Amount out of range"))?,
|
||||||
fee_paid: fee_paid
|
fee_paid: fee_paid
|
||||||
.map(|v| NonNegativeAmount::from_u64(v).map_err(|_| anyhow!("Fee out of range")))
|
.map(|v| Zatoshis::from_u64(v).map_err(|_| anyhow!("Fee out of range")))
|
||||||
.transpose()?,
|
.transpose()?,
|
||||||
sent_note_count,
|
sent_note_count,
|
||||||
received_note_count,
|
received_note_count,
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
use anyhow::anyhow;
|
use anyhow::anyhow;
|
||||||
use clap::Args;
|
use clap::Args;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
use zcash_client_backend::{
|
use zcash_client_backend::data_api::{Account as _, InputSource, WalletRead};
|
||||||
data_api::{Account as _, InputSource, WalletRead},
|
use zcash_client_sqlite::WalletDb;
|
||||||
|
use zcash_protocol::{
|
||||||
|
value::{Zatoshis, MAX_MONEY},
|
||||||
ShieldedProtocol,
|
ShieldedProtocol,
|
||||||
};
|
};
|
||||||
use zcash_client_sqlite::WalletDb;
|
|
||||||
use zcash_protocol::value::{Zatoshis, MAX_MONEY};
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
commands::select_account, config::get_wallet_network, data::get_db_paths, error, ui::format_zec,
|
commands::select_account, config::get_wallet_network, data::get_db_paths, error, ui::format_zec,
|
||||||
|
|
|
@ -10,10 +10,9 @@ use zcash_client_backend::{
|
||||||
Account as _,
|
Account as _,
|
||||||
},
|
},
|
||||||
fees::{zip317::MultiOutputChangeStrategy, DustOutputPolicy, SplitPolicy, StandardFeeRule},
|
fees::{zip317::MultiOutputChangeStrategy, DustOutputPolicy, SplitPolicy, StandardFeeRule},
|
||||||
ShieldedProtocol,
|
|
||||||
};
|
};
|
||||||
use zcash_client_sqlite::WalletDb;
|
use zcash_client_sqlite::WalletDb;
|
||||||
use zcash_protocol::value::Zatoshis;
|
use zcash_protocol::{value::Zatoshis, ShieldedProtocol};
|
||||||
use zip321::{Payment, TransactionRequest};
|
use zip321::{Payment, TransactionRequest};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
|
|
@ -5,6 +5,7 @@ use anyhow::anyhow;
|
||||||
use clap::Args;
|
use clap::Args;
|
||||||
use secrecy::ExposeSecret;
|
use secrecy::ExposeSecret;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use zcash_address::ZcashAddress;
|
use zcash_address::ZcashAddress;
|
||||||
use zcash_client_backend::{
|
use zcash_client_backend::{
|
||||||
data_api::{
|
data_api::{
|
||||||
|
@ -14,14 +15,13 @@ use zcash_client_backend::{
|
||||||
Account, WalletRead,
|
Account, WalletRead,
|
||||||
},
|
},
|
||||||
fees::{standard::MultiOutputChangeStrategy, DustOutputPolicy, SplitPolicy, StandardFeeRule},
|
fees::{standard::MultiOutputChangeStrategy, DustOutputPolicy, SplitPolicy, StandardFeeRule},
|
||||||
keys::UnifiedSpendingKey,
|
|
||||||
proto::service,
|
proto::service,
|
||||||
wallet::OvkPolicy,
|
wallet::OvkPolicy,
|
||||||
ShieldedProtocol,
|
|
||||||
};
|
};
|
||||||
use zcash_client_sqlite::WalletDb;
|
use zcash_client_sqlite::WalletDb;
|
||||||
|
use zcash_keys::keys::UnifiedSpendingKey;
|
||||||
use zcash_proofs::prover::LocalTxProver;
|
use zcash_proofs::prover::LocalTxProver;
|
||||||
use zcash_protocol::value::Zatoshis;
|
use zcash_protocol::{value::Zatoshis, ShieldedProtocol};
|
||||||
use zip321::{Payment, TransactionRequest};
|
use zip321::{Payment, TransactionRequest};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
|
|
@ -4,6 +4,7 @@ use anyhow::anyhow;
|
||||||
use clap::Args;
|
use clap::Args;
|
||||||
use secrecy::ExposeSecret;
|
use secrecy::ExposeSecret;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use zcash_client_backend::{
|
use zcash_client_backend::{
|
||||||
data_api::{
|
data_api::{
|
||||||
wallet::{
|
wallet::{
|
||||||
|
@ -12,14 +13,13 @@ use zcash_client_backend::{
|
||||||
Account, WalletRead,
|
Account, WalletRead,
|
||||||
},
|
},
|
||||||
fees::{standard::MultiOutputChangeStrategy, DustOutputPolicy, SplitPolicy, StandardFeeRule},
|
fees::{standard::MultiOutputChangeStrategy, DustOutputPolicy, SplitPolicy, StandardFeeRule},
|
||||||
keys::UnifiedSpendingKey,
|
|
||||||
proto::service,
|
proto::service,
|
||||||
wallet::OvkPolicy,
|
wallet::OvkPolicy,
|
||||||
ShieldedProtocol,
|
|
||||||
};
|
};
|
||||||
use zcash_client_sqlite::WalletDb;
|
use zcash_client_sqlite::WalletDb;
|
||||||
|
use zcash_keys::keys::UnifiedSpendingKey;
|
||||||
use zcash_proofs::prover::LocalTxProver;
|
use zcash_proofs::prover::LocalTxProver;
|
||||||
use zcash_protocol::value::Zatoshis;
|
use zcash_protocol::{value::Zatoshis, ShieldedProtocol};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
commands::select_account,
|
commands::select_account,
|
||||||
|
|
|
@ -34,12 +34,13 @@ use crate::{
|
||||||
|
|
||||||
#[cfg(feature = "transparent-inputs")]
|
#[cfg(feature = "transparent-inputs")]
|
||||||
use {
|
use {
|
||||||
zcash_client_backend::{encoding::AddressCodec, wallet::WalletTransparentOutput},
|
::transparent::{
|
||||||
zcash_client_sqlite::AccountUuid,
|
address::Script,
|
||||||
zcash_primitives::{
|
bundle::{OutPoint, TxOut},
|
||||||
legacy::Script,
|
|
||||||
transaction::components::transparent::{OutPoint, TxOut},
|
|
||||||
},
|
},
|
||||||
|
zcash_client_backend::wallet::WalletTransparentOutput,
|
||||||
|
zcash_client_sqlite::AccountUuid,
|
||||||
|
zcash_keys::encoding::AddressCodec,
|
||||||
zcash_protocol::value::Zatoshis,
|
zcash_protocol::value::Zatoshis,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -246,7 +246,7 @@ impl App {
|
||||||
// Determine the density of blocks we will be rendering. Use ceiling division
|
// Determine the density of blocks we will be rendering. Use ceiling division
|
||||||
// to ensure we don't require more cells than we have (which would cause the
|
// to ensure we don't require more cells than we have (which would cause the
|
||||||
// blocks around the chain tip to never be rendered).
|
// blocks around the chain tip to never be rendered).
|
||||||
let area = u32::from(defrag_area.area());
|
let area = defrag_area.area();
|
||||||
let blocks_per_cell = (block_count + area - 1) / area;
|
let blocks_per_cell = (block_count + area - 1) / area;
|
||||||
let blocks_per_row = blocks_per_cell * u32::from(defrag_area.width);
|
let blocks_per_row = blocks_per_cell * u32::from(defrag_area.width);
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,7 @@ use std::path::Path;
|
||||||
use secrecy::{ExposeSecret, SecretVec, Zeroize};
|
use secrecy::{ExposeSecret, SecretVec, Zeroize};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use zcash_primitives::consensus::{self, BlockHeight};
|
use zcash_protocol::consensus::{self, BlockHeight, Parameters};
|
||||||
use zcash_protocol::consensus::Parameters;
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
data::{Network, DEFAULT_WALLET_DIR},
|
data::{Network, DEFAULT_WALLET_DIR},
|
||||||
|
|
|
@ -6,8 +6,7 @@ use zcash_client_sqlite::{FsBlockDb, WalletDb};
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
|
|
||||||
use zcash_client_sqlite::chain::BlockMeta;
|
use zcash_client_sqlite::chain::BlockMeta;
|
||||||
use zcash_primitives::consensus;
|
use zcash_protocol::consensus::{self, Parameters};
|
||||||
use zcash_protocol::consensus::Parameters;
|
|
||||||
|
|
||||||
use crate::error;
|
use crate::error;
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,13 @@
|
||||||
use std::convert::Infallible;
|
use std::convert::Infallible;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
use zcash_client_backend::{
|
use zcash_client_backend::data_api::{
|
||||||
data_api::{
|
error::Error as WalletError, wallet::input_selection::GreedyInputSelectorError, BirthdayError,
|
||||||
error::Error as WalletError, wallet::input_selection::GreedyInputSelectorError,
|
|
||||||
BirthdayError,
|
|
||||||
},
|
|
||||||
keys::DerivationError,
|
|
||||||
};
|
};
|
||||||
use zcash_client_sqlite::{
|
use zcash_client_sqlite::{
|
||||||
error::SqliteClientError, wallet::commitment_tree, FsBlockDbError, ReceivedNoteId,
|
error::SqliteClientError, wallet::commitment_tree, FsBlockDbError, ReceivedNoteId,
|
||||||
};
|
};
|
||||||
|
use zcash_keys::keys::DerivationError;
|
||||||
use zcash_primitives::transaction::fees::zip317;
|
use zcash_primitives::transaction::fees::zip317;
|
||||||
use zip321::Zip321Error;
|
use zip321::Zip321Error;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue