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