zcash-sync/src/lib.rs

102 lines
2.7 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;
2022-07-17 19:55:57 -07:00
mod misc;
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-07-26 19:11:36 -07:00
mod zip32;
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::{
2022-07-13 20:22:12 -07:00
calculate_tree_state_v2, connect_lightwalletd, download_chain, get_best_server,
get_latest_height, 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-09-04 04:19:49 -07:00
pub use crate::db::{AccountInfo, AccountRec, AccountData, DbAdapter, TxRec};
2022-06-20 02:05:11 -07:00
pub use crate::fountain::{put_drop, FountainCodes, RaptorQDrops};
2022-08-03 08:30:34 -07:00
pub use crate::hash::{pedersen_hash, Hash, GENERATORS_EXP};
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;
2022-07-17 19:55:57 -07:00
pub use crate::misc::read_zwl;
2022-06-21 17:18:47 -07:00
pub use crate::pay::{broadcast_tx, get_tx_summary, Tx, TxIn, TxOut};
2021-07-16 01:42:29 -07:00
pub use crate::print::*;
2022-07-21 18:08:29 -07:00
pub use crate::scan::{latest_height, sync_async};
2021-08-27 01:03:45 -07:00
pub use crate::ua::{get_sapling, get_ua};
2022-08-16 07:47:48 -07:00
pub use chain::DOWNLOADED_BYTES;
2022-07-26 19:11:36 -07:00
pub use zip32::{derive_zip32, KeyPack};
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;
2022-07-21 04:22:41 -07:00
#[cfg(feature = "nodejs")]
pub mod nodejs;
2022-08-02 07:34:15 -07:00
2022-08-17 04:05:53 -07:00
mod gpu;
2022-08-13 19:56:42 -07:00
2022-08-21 10:48:34 -07:00
pub use gpu::{has_cuda, has_gpu, has_metal, use_gpu};