|
1 | 1 | use wasm_bindgen_test::*;
|
2 | 2 | wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
|
3 | 3 |
|
4 |
| -use webz_core::{bindgen::wallet::WebWallet, Wallet}; |
5 |
| -use zcash_address::ZcashAddress; |
6 |
| -use zcash_primitives::consensus::Network; |
| 4 | +use std::sync::Once; |
| 5 | +use webz_core::bindgen::wallet::WebWallet; |
7 | 6 |
|
8 | 7 | const SEED: &str = "visit armed kite pen cradle toward reward clay marble oil write dove blind oyster silk oyster original message skate bench tone enable stadium element";
|
9 | 8 | const HD_INDEX: u32 = 0;
|
10 | 9 | const BIRTHDAY: Option<u32> = Some(2577329);
|
11 | 10 |
|
12 | 11 | // Required to initialize the logger and panic hooks only once
|
13 |
| -use std::{num::NonZeroU32, sync::Once}; |
14 | 12 | static INIT: Once = Once::new();
|
15 | 13 | pub fn initialize() {
|
16 | 14 | INIT.call_once(|| {
|
@@ -46,71 +44,3 @@ async fn test_get_and_scan_range() {
|
46 | 44 | let summary = w.get_wallet_summary().unwrap();
|
47 | 45 | tracing::info!("Wallet summary: {:?}", summary);
|
48 | 46 | }
|
49 |
| - |
50 |
| -#[cfg(feature = "native")] |
51 |
| -#[tokio::test] |
52 |
| -async fn test_get_and_scan_range_native() { |
53 |
| - use zcash_primitives::consensus; |
54 |
| - let db_cache = tempfile::tempdir().unwrap(); |
55 |
| - let _db_data = tempfile::NamedTempFile::new_in(db_cache.path()).unwrap(); |
56 |
| - |
57 |
| - initialize(); |
58 |
| - let url = "https://testnet.zec.rocks:443"; |
59 |
| - let c = tonic::transport::Channel::from_shared(url).unwrap(); |
60 |
| - |
61 |
| - let tls = tonic::transport::ClientTlsConfig::new() |
62 |
| - .domain_name("testnet.zec.rocks") |
63 |
| - .with_webpki_roots(); |
64 |
| - let channel = c.tls_config(tls).unwrap(); |
65 |
| - |
66 |
| - #[cfg(feature = "sqlite-db")] |
67 |
| - let wallet_db = { |
68 |
| - use zcash_client_sqlite::{ |
69 |
| - chain::init::init_blockmeta_db, wallet::init::init_wallet_db, FsBlockDb, WalletDb, |
70 |
| - }; |
71 |
| - |
72 |
| - let mut db_cache = FsBlockDb::for_path(&db_cache).unwrap(); |
73 |
| - let mut wallet_db = WalletDb::for_path(&_db_data, consensus::Network::TestNetwork).unwrap(); |
74 |
| - init_blockmeta_db(&mut db_cache).unwrap(); |
75 |
| - init_wallet_db(&mut wallet_db, None).unwrap(); |
76 |
| - wallet_db |
77 |
| - }; |
78 |
| - |
79 |
| - #[cfg(not(feature = "sqlite-db"))] |
80 |
| - let wallet_db = zcash_client_memory::MemoryWalletDb::new( |
81 |
| - consensus::Network::TestNetwork, |
82 |
| - webz_core::PRUNING_DEPTH, |
83 |
| - ); |
84 |
| - |
85 |
| - let mut w = Wallet::new( |
86 |
| - wallet_db, |
87 |
| - channel.connect().await.unwrap(), |
88 |
| - Network::TestNetwork, |
89 |
| - NonZeroU32::try_from(1).unwrap(), |
90 |
| - ) |
91 |
| - .unwrap(); |
92 |
| - |
93 |
| - let id = w.create_account(SEED, HD_INDEX, BIRTHDAY).await.unwrap(); |
94 |
| - tracing::info!("Created account with id: {}", id); |
95 |
| - |
96 |
| - tracing::info!("Syncing wallet"); |
97 |
| - w.sync(|scanned_to, tip| { |
98 |
| - println!("Scanned: {}/{}", scanned_to, tip); |
99 |
| - }) |
100 |
| - .await |
101 |
| - .unwrap(); |
102 |
| - |
103 |
| - tracing::info!("Syncing complete :)"); |
104 |
| - |
105 |
| - let summary = w.get_wallet_summary().unwrap(); |
106 |
| - tracing::info!("Wallet summary: {:?}", summary); |
107 |
| - |
108 |
| - tracing::info!("Proposing a transaction"); |
109 |
| - let addr = ZcashAddress::try_from_encoded("utest1z00xn09t4eyeqw9zmjss75sf460423dymgyfjn8rtlj26cffy0yad3eea82xekk24s00wnm38cvyrm2c6x7fxlc0ns4a5j7utgl6lchvglfvl9g9p56fqwzvzvj9d3z6r6ft88j654d7dj0ep6myq5duz9s8x78fdzmtx04d2qn8ydkxr4lfdhlkx9ktrw98gd97dateegrr68vl8xu"); |
110 |
| - |
111 |
| - w.transfer(SEED, 0, addr.unwrap(), 1000).await.unwrap(); |
112 |
| - tracing::info!("Transaction proposed"); |
113 |
| - |
114 |
| - let summary = w.get_wallet_summary().unwrap(); |
115 |
| - tracing::info!("Wallet summary: {:?}", summary); |
116 |
| -} |
0 commit comments