wip compiles now

This commit is contained in:
Steve Myers 2021-10-12 11:53:11 -07:00
parent aa63457d9c
commit cdb90aa35c

View File

@ -2,9 +2,13 @@ use bdk::Wallet;
use bdk::database::MemoryDatabase;
use bdk::bitcoin::Network;
// use crate::error::FfiError;
use std::sync::RwLock;
use std::sync::{RwLock, Mutex};
use std::vec::Vec;
use bdk::database::BatchDatabase;
use bdk::sled;
use bdk::sled::Tree;
//mod error;
//mod types;
//mod wallet;
@ -12,21 +16,24 @@ use std::vec::Vec;
uniffi_macros::include_scaffolding!("bdk");
struct OfflineWallet {
wallet: Wallet<(), MemoryDatabase>,
wallet: Mutex<Wallet<(), Tree>>,
//wallet: RwLock<Vec<String>>
}
impl OfflineWallet {
fn new(descriptor: String) -> Self {
let database = sled::open("testdb").unwrap();
let tree = database.open_tree("test").unwrap();
let wallet = Wallet::new_offline(
&descriptor,
None,
Network::Regtest,
MemoryDatabase::new(),
tree,
).unwrap();
OfflineWallet {
wallet
wallet: Mutex::new(wallet)
}
// OfflineWallet {
@ -35,3 +42,6 @@ impl OfflineWallet {
}
}
uniffi::deps::static_assertions::assert_impl_all!(OfflineWallet: Sync, Send);