Refactor: Fix up imports

This commit is contained in:
thunderbiscuit 2023-01-17 15:47:48 -05:00
parent 202dcfa2b5
commit aadc622006
No known key found for this signature in database
GPG Key ID: 88253696EB836462
2 changed files with 9 additions and 3 deletions

View File

@ -11,9 +11,10 @@ use bdk::blockchain::{
electrum::ElectrumBlockchainConfig, esplora::EsploraBlockchainConfig,
rpc::RpcConfig as BdkRpcConfig, ConfigurableBlockchain,
};
use bdk::FeeRate;
use std::convert::{From, TryFrom};
use std::path::PathBuf;
use std::sync::{Mutex, MutexGuard};
use std::sync::{Arc, Mutex, MutexGuard};
pub(crate) struct Blockchain {
blockchain_mutex: Mutex<AnyBlockchain>,
@ -64,6 +65,12 @@ impl Blockchain {
self.get_blockchain().broadcast(&tx)
}
pub(crate) fn estimate_fee(&self, target: u64) -> Result<Arc<FeeRate>, BdkError> {
let result: Result<FeeRate, bdk::Error> =
self.get_blockchain().estimate_fee(target as usize);
result.map(Arc::new)
}
pub(crate) fn get_height(&self) -> Result<u32, BdkError> {
self.get_blockchain().get_height()
}

View File

@ -24,9 +24,8 @@ use bdk::wallet::AddressInfo as BdkAddressInfo;
use bdk::{Balance as BdkBalance, BlockTime, Error as BdkError, FeeRate, KeychainKind};
use std::convert::From;
use std::fmt;
use std::ops::Deref;
use std::str::FromStr;
use std::sync::{Arc, Mutex};
use std::sync::Arc;
uniffi_macros::include_scaffolding!("bdk");