Skip to content

Commit

Permalink
Temp 15: Updating the NDK
Browse files Browse the repository at this point in the history
  • Loading branch information
thunderbiscuit committed Oct 3, 2023
1 parent 905c016 commit 413ec98
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions bdk-ffi/src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use bdk::Error as BdkError;

#[derive(Debug)]
pub(crate) struct Wallet {
// TODO 8: Do we really need the mutex on the wallet?
// TODO 8: Do we really need the mutex on the wallet? Could this be an Arc?
pub inner_mutex: Mutex<BdkWallet>,
}

Expand Down Expand Up @@ -74,7 +74,7 @@ impl Wallet {
}

// TODO 10: Do we need this mutex
pub(crate) fn get_wallet(&self) -> MutexGuard<BdkWallet> {
fn get_wallet(&self) -> MutexGuard<BdkWallet> {
self.inner_mutex.lock().expect("wallet")
}

Expand All @@ -86,6 +86,22 @@ impl Wallet {
// self.get_wallet().get_address(address_index.into())
// )
}

pub fn network(&self) -> Network {
self.get_wallet().network().into()
}

fn get_internal_address(&mut self, address_index: AddressIndex) -> AddressInfo {
self.get_wallet().get_internal_address(address_index.into()).into()
}

// fn get_balance(&self) -> Balance {
// Balance::from(self.inner.get_balance())
// }

// fn is_mine(&self, script: Arc<Script>) -> bool {
// self.get_wallet().is_mine(&script.inner)
// }
}

// /// A Bitcoin wallet.
Expand Down

0 comments on commit 413ec98

Please sign in to comment.