So, I have warp api working and I can do some basic stuff already. But for some reason I cannot get the unified address using warp_api_ffi::api::account::get_unified_address
. I don’t know if I’m doing this correctly.
My code just hangs up, the process doesn’t close, doesn’t give a error, nothing … just sites there doing nothing …
My code:
use warp_api_ffi::api::account::{new_account, check_account, get_unified_address};
use warp_api_ffi::api::sync::{coin_sync, skip_to_last_height};
use warp_api_ffi::{CoinConfig, init_coin, set_coin_lwd_url, set_active_account};
use lazy_static::lazy_static;
use std::sync::Mutex;
lazy_static! {
static ref CANCEL: Mutex<bool> = Mutex::new(false);
}
#[tokio::main]
async fn main() {
env_logger::init();
// Initialize the library for Zcash (coin = 0)
init_coin(0, "./zec.db").unwrap();
set_coin_lwd_url(0, "https://mainnet.lightwalletd.com:9067");
let id_account = 1;
if check_account(0, id_account) {
println!("Srating existing account id {}", id_account);
set_active_account(0, id_account);
} else {
let id_account = new_account(0, "test", None, None).unwrap();
let _ = skip_to_last_height(0).await;
println!("Created new account wuth id {}", id_account);
}
println!("Starting wallet synchronization ...");
coin_sync(0,
true,
0,
100,
|p| {
println!("{}", p.height)
},
&CANCEL).await.unwrap();
// Grab the database accessor
let cc = &CoinConfig::get_active();
let db = cc.db.as_ref().unwrap().clone();
let db = db.lock().unwrap();
let bal = db.get_balance(id_account).unwrap();
println!("Balance: {}", bal);
let info = db.get_account_info(id_account).unwrap();
// println!("{:?}", info);
println!("Sapling address: {}", info.address);
let ua = get_unified_address(cc.coin, cc.id_account, 7).unwrap();
println!("Unified address: {}", ua);
}
Output:
Srating existing account id 1
Starting wallet synchronization ...
2221189
Balance: 40000
Sapling address: zs1z3mwhdyx4ehcy6j8plag634vh0svhw6ryev8yca8supmy4qsfsa3fznw0fscm53xcvpnwn96wq2
And it sits there forever …
What could it be? or I’m just doing it wrong?
I really would like to make it work, for current and future projects …