Reformat
This commit is contained in:
parent
9d7141ae40
commit
6d56f8a9ef
|
@ -11,8 +11,8 @@ pub use utxo::fetch_utxos;
|
||||||
|
|
||||||
use crate::api::recipient::Recipient;
|
use crate::api::recipient::Recipient;
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
use zcash_primitives::consensus::Network;
|
|
||||||
use ua::decode;
|
use ua::decode;
|
||||||
|
use zcash_primitives::consensus::Network;
|
||||||
use zcash_primitives::memo::Memo;
|
use zcash_primitives::memo::Memo;
|
||||||
|
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
|
|
|
@ -26,7 +26,7 @@ use zcash_primitives::sapling::prover::TxProver;
|
||||||
use zcash_primitives::sapling::{Diversifier, Node, PaymentAddress, Rseed};
|
use zcash_primitives::sapling::{Diversifier, Node, PaymentAddress, Rseed};
|
||||||
use zcash_primitives::transaction::builder::Builder;
|
use zcash_primitives::transaction::builder::Builder;
|
||||||
use zcash_primitives::transaction::components::{Amount, OutPoint, TxOut};
|
use zcash_primitives::transaction::components::{Amount, OutPoint, TxOut};
|
||||||
use zcash_primitives::transaction::sighash::{SignableInput, signature_hash};
|
use zcash_primitives::transaction::sighash::{signature_hash, SignableInput};
|
||||||
use zcash_primitives::transaction::txid::TxIdDigester;
|
use zcash_primitives::transaction::txid::TxIdDigester;
|
||||||
use zcash_primitives::transaction::{Transaction, TransactionData, TxVersion};
|
use zcash_primitives::transaction::{Transaction, TransactionData, TxVersion};
|
||||||
use zcash_primitives::zip32::{ExtendedFullViewingKey, ExtendedSpendingKey};
|
use zcash_primitives::zip32::{ExtendedFullViewingKey, ExtendedSpendingKey};
|
||||||
|
@ -56,8 +56,9 @@ impl TxBuilderContext {
|
||||||
let TreeCheckpoint { tree, .. } = db.get_tree_by_name(height, "orchard")?;
|
let TreeCheckpoint { tree, .. } = db.get_tree_by_name(height, "orchard")?;
|
||||||
let hasher = OrchardHasher::new();
|
let hasher = OrchardHasher::new();
|
||||||
Some(tree.root(32, &ORCHARD_ROOTS, &hasher))
|
Some(tree.root(32, &ORCHARD_ROOTS, &hasher))
|
||||||
}
|
} else {
|
||||||
else { None };
|
None
|
||||||
|
};
|
||||||
let context = TxBuilderContext {
|
let context = TxBuilderContext {
|
||||||
height,
|
height,
|
||||||
sapling_anchor,
|
sapling_anchor,
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
use zcash_primitives::consensus::Network;
|
|
||||||
use super::{types::*, Result};
|
use super::{types::*, Result};
|
||||||
use crate::note_selection::fee::FeeCalculator;
|
use crate::note_selection::fee::FeeCalculator;
|
||||||
use crate::note_selection::ua::decode;
|
use crate::note_selection::ua::decode;
|
||||||
use crate::note_selection::TransactionBuilderError::TxTooComplex;
|
use crate::note_selection::TransactionBuilderError::TxTooComplex;
|
||||||
use crate::note_selection::{TransactionBuilderError, MAX_ATTEMPTS};
|
use crate::note_selection::{TransactionBuilderError, MAX_ATTEMPTS};
|
||||||
use crate::Hash;
|
use crate::Hash;
|
||||||
|
use zcash_primitives::consensus::Network;
|
||||||
use zcash_primitives::memo::MemoBytes;
|
use zcash_primitives::memo::MemoBytes;
|
||||||
|
|
||||||
pub fn sum_utxos(utxos: &[UTXO]) -> Result<PoolAllocation> {
|
pub fn sum_utxos(utxos: &[UTXO]) -> Result<PoolAllocation> {
|
||||||
|
|
|
@ -10,12 +10,15 @@ pub fn decode(network: &Network, address: &str) -> anyhow::Result<[Option<Destin
|
||||||
if let Ok(data) = decode_payment_address(network.hrp_sapling_payment_address(), address) {
|
if let Ok(data) = decode_payment_address(network.hrp_sapling_payment_address(), address) {
|
||||||
let destination = Destination::Sapling(data.to_bytes());
|
let destination = Destination::Sapling(data.to_bytes());
|
||||||
destinations[Pool::Sapling as usize] = Some(destination);
|
destinations[Pool::Sapling as usize] = Some(destination);
|
||||||
}
|
} else if let Ok(Some(TransparentAddress::PublicKey(data))) = decode_transparent_address(
|
||||||
else if let Ok(Some(TransparentAddress::PublicKey(data))) = decode_transparent_address(&network.b58_pubkey_address_prefix(), &network.b58_script_address_prefix(), address) {
|
&network.b58_pubkey_address_prefix(),
|
||||||
|
&network.b58_script_address_prefix(),
|
||||||
|
address,
|
||||||
|
) {
|
||||||
let destination = Destination::Transparent(data);
|
let destination = Destination::Transparent(data);
|
||||||
destinations[Pool::Transparent as usize] = Some(destination);
|
destinations[Pool::Transparent as usize] = Some(destination);
|
||||||
}
|
} else if let Ok(address) = ZcashAddress::try_from_encoded(address) {
|
||||||
else if let Ok(address) = ZcashAddress::try_from_encoded(address) { // ZcashAddress only supports Zcash
|
// ZcashAddress only supports Zcash
|
||||||
match address.kind {
|
match address.kind {
|
||||||
AddressKind::Sprout(_) => {}
|
AddressKind::Sprout(_) => {}
|
||||||
AddressKind::Sapling(data) => {
|
AddressKind::Sapling(data) => {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use anyhow::anyhow;
|
|
||||||
use crate::DbAdapter;
|
use crate::DbAdapter;
|
||||||
|
use anyhow::anyhow;
|
||||||
use chrono::NaiveDateTime;
|
use chrono::NaiveDateTime;
|
||||||
use zcash_params::coin::get_coin_chain;
|
use zcash_params::coin::get_coin_chain;
|
||||||
|
|
||||||
|
@ -55,7 +55,8 @@ pub async fn fetch_historical_prices(
|
||||||
// rounded to daily
|
// rounded to daily
|
||||||
let date = NaiveDateTime::from_timestamp_opt(ts, 0)
|
let date = NaiveDateTime::from_timestamp_opt(ts, 0)
|
||||||
.ok_or(anyhow!("Invalid Date"))?
|
.ok_or(anyhow!("Invalid Date"))?
|
||||||
.date().and_hms_opt(0, 0, 0)
|
.date()
|
||||||
|
.and_hms_opt(0, 0, 0)
|
||||||
.ok_or(anyhow!("Invalid Date"))?;
|
.ok_or(anyhow!("Invalid Date"))?;
|
||||||
let timestamp = date.timestamp();
|
let timestamp = date.timestamp();
|
||||||
if timestamp != prev_timestamp {
|
if timestamp != prev_timestamp {
|
||||||
|
|
Loading…
Reference in New Issue