zcash-sync/src/lib.rs

90 lines
2.4 KiB
Rust
Raw Normal View History

2021-11-11 17:39:50 -08:00
// #![allow(dead_code)]
// #![allow(unused_imports)]
2021-06-17 09:56:20 -07:00
#[path = "generated/cash.z.wallet.sdk.rpc.rs"]
pub mod lw_rpc;
2022-06-07 09:58:24 -07:00
pub use zcash_params::coin::{get_branch, get_coin_type, CoinType};
2021-06-29 00:04:12 -07:00
// Mainnet
2022-06-07 09:58:24 -07:00
pub const LWD_URL: &str = "https://mainnet.lightwalletd.com:9067";
2021-06-29 00:04:12 -07:00
// pub const LWD_URL: &str = "https://lwdv3.zecwallet.co";
2021-07-16 01:42:29 -07:00
// pub const LWD_URL: &str = "http://lwd.hanh.me:9067";
2022-06-07 09:58:24 -07:00
// pub const LWD_URL: &str = "http://127.0.0.1:9067";
2021-06-29 00:04:12 -07:00
// Testnet
2021-07-07 08:38:22 -07:00
// pub const LWD_URL: &str = "https://testnet.lightwalletd.com:9067";
2021-06-29 00:04:12 -07:00
// pub const LWD_URL: &str = "http://lwd.hanh.me:9067";
// pub const LWD_URL: &str = "http://127.0.0.1:9067";
// YCash
2021-11-11 17:39:50 -08:00
// pub const LWD_URL: &str = "https://lite.ycash.xyz:9067";
2021-06-17 09:56:20 -07:00
2021-06-21 17:33:13 -07:00
mod builder;
2021-06-17 09:56:20 -07:00
mod chain;
2022-06-08 05:48:16 -07:00
mod coinconfig;
2021-06-18 01:17:41 -07:00
mod commitment;
2021-11-11 17:39:50 -08:00
mod contact;
2021-06-21 17:33:13 -07:00
mod db;
2022-06-20 02:05:11 -07:00
mod fountain;
2021-07-16 01:42:29 -07:00
mod hash;
2021-06-26 02:52:03 -07:00
mod key;
2022-06-08 05:48:16 -07:00
mod key2;
2021-06-26 02:52:03 -07:00
mod mempool;
2021-08-16 06:07:04 -07:00
mod pay;
mod prices;
2021-06-24 05:08:20 -07:00
mod print;
2021-06-26 02:52:03 -07:00
mod scan;
2021-07-09 06:33:05 -07:00
mod taddr;
2021-07-09 22:44:13 -07:00
mod transaction;
2021-11-11 17:39:50 -08:00
mod ua;
2022-06-08 05:48:16 -07:00
// mod wallet;
2022-06-09 10:05:58 -07:00
pub mod api;
2021-06-18 01:17:41 -07:00
2022-03-30 17:40:02 -07:00
#[cfg(feature = "ledger")]
mod ledger;
#[cfg(not(feature = "ledger"))]
2022-06-07 09:58:24 -07:00
#[allow(dead_code)]
2022-03-30 17:40:02 -07:00
mod ledger {
2022-06-07 09:58:24 -07:00
pub async fn build_tx_ledger(
_tx: &mut super::pay::Tx,
_prover: &impl zcash_primitives::sapling::prover::TxProver,
) -> anyhow::Result<Vec<u8>> {
unreachable!()
}
2022-03-30 17:40:02 -07:00
}
2021-11-11 17:39:50 -08:00
pub fn hex_to_hash(hex: &str) -> anyhow::Result<[u8; 32]> {
let mut hash = [0u8; 32];
hex::decode_to_slice(hex, &mut hash)?;
Ok(hash)
}
2021-06-21 07:04:45 -07:00
pub use crate::builder::advance_tree;
2021-06-21 17:33:13 -07:00
pub use crate::chain::{
calculate_tree_state_v2, connect_lightwalletd, download_chain, get_latest_height, sync,
2021-07-16 01:42:29 -07:00
ChainError, DecryptNode,
2021-06-21 17:33:13 -07:00
};
2022-06-10 03:09:37 -07:00
pub use crate::coinconfig::{
init_coin, set_active, set_active_account, set_coin_lwd_url, CoinConfig,
};
2021-06-21 17:33:13 -07:00
pub use crate::commitment::{CTree, Witness};
2022-06-10 11:41:05 -07:00
pub use crate::db::{AccountRec, DbAdapter, TxRec};
2022-06-20 02:05:11 -07:00
pub use crate::fountain::{put_drop, FountainCodes, RaptorQDrops};
2021-07-16 01:42:29 -07:00
pub use crate::hash::pedersen_hash;
2022-06-07 09:58:24 -07:00
pub use crate::key::{generate_random_enc_key, KeyHelpers};
2021-06-18 01:17:41 -07:00
pub use crate::lw_rpc::compact_tx_streamer_client::CompactTxStreamerClient;
pub use crate::lw_rpc::*;
2021-06-26 02:52:03 -07:00
pub use crate::mempool::MemPool;
2021-11-11 17:39:50 -08:00
pub use crate::pay::{broadcast_tx, Tx, TxIn, TxOut};
2021-07-16 01:42:29 -07:00
pub use crate::print::*;
2021-06-26 02:52:03 -07:00
pub use crate::scan::{latest_height, scan_all, sync_async};
2021-08-27 01:03:45 -07:00
pub use crate::ua::{get_sapling, get_ua};
2022-06-08 05:48:16 -07:00
// pub use crate::wallet::{decrypt_backup, encrypt_backup, RecipientMemo, Wallet, WalletBalance};
2022-06-06 18:27:50 -07:00
#[cfg(feature = "ledger_sapling")]
pub use crate::ledger::sapling::build_tx_ledger;
2022-06-07 09:58:24 -07:00
#[cfg(feature = "ledger")]
pub use crate::ledger::sweep_ledger;