Remove callback interface
This commit is contained in:
parent
925d92c4b8
commit
f04c1f7fa8
@ -120,10 +120,6 @@ interface BlockchainConfig {
|
||||
Esplora(EsploraConfig config);
|
||||
};
|
||||
|
||||
callback interface BdkProgress {
|
||||
void update(f32 progress, string? message);
|
||||
};
|
||||
|
||||
interface OnlineWallet {
|
||||
[Throws=BdkError]
|
||||
constructor(string descriptor, string? change_descriptor, Network network, DatabaseConfig database_config, BlockchainConfig blockchain_config);
|
||||
@ -140,7 +136,7 @@ interface OnlineWallet {
|
||||
// OnlineWalletInterface
|
||||
Network get_network();
|
||||
[Throws=BdkError]
|
||||
void sync(BdkProgress progress_update, u32? max_address_param);
|
||||
void sync(u32? max_address_param);
|
||||
[Throws=BdkError]
|
||||
string broadcast([ByRef] PartiallySignedBitcoinTransaction psbt);
|
||||
};
|
||||
|
16
src/lib.rs
16
src/lib.rs
@ -154,13 +154,10 @@ pub trait BdkProgress: Send + Sync {
|
||||
fn update(&self, progress: f32, message: Option<String>);
|
||||
}
|
||||
|
||||
struct BdkProgressHolder {
|
||||
progress_update: Box<dyn BdkProgress>,
|
||||
}
|
||||
struct BdkProgressHolder {}
|
||||
|
||||
impl Progress for BdkProgressHolder {
|
||||
fn update(&self, progress: f32, message: Option<String>) -> Result<(), Error> {
|
||||
self.progress_update.update(progress, message);
|
||||
fn update(&self, _progress: f32, _message: Option<String>) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@ -238,16 +235,11 @@ impl OnlineWallet {
|
||||
self.wallet.lock().unwrap().network()
|
||||
}
|
||||
|
||||
fn sync(
|
||||
&self,
|
||||
progress_update: Box<dyn BdkProgress>,
|
||||
max_address_param: Option<u32>,
|
||||
) -> Result<(), BdkError> {
|
||||
progress_update.update(21.0, Some("message".to_string()));
|
||||
fn sync(&self, max_address_param: Option<u32>) -> Result<(), BdkError> {
|
||||
self.wallet
|
||||
.lock()
|
||||
.unwrap()
|
||||
.sync(BdkProgressHolder { progress_update }, max_address_param)
|
||||
.sync(BdkProgressHolder {}, max_address_param)
|
||||
}
|
||||
|
||||
fn broadcast<'a>(&self, psbt: &'a PartiallySignedBitcoinTransaction) -> Result<String, Error> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user