feat: expose commit method on wallet type

This commit is contained in:
thunderbiscuit
2024-05-08 11:33:35 -04:00
parent 72b5bfd4c9
commit e9a76287c8
10 changed files with 36 additions and 21 deletions

View File

@@ -267,6 +267,9 @@ interface Wallet {
[Throws=CannotConnectError]
void apply_update(Update update);
[Throws=PersistenceError]
boolean commit();
boolean is_mine([ByRef] Script script);
[Throws=SignerError]

View File

@@ -69,18 +69,13 @@ impl Wallet {
.map_err(CannotConnectError::from)
}
// TODO: This is the fallible version of get_internal_address; should I rename it to get_internal_address?
// It's a slight change of the API, the other option is to rename the get_address to try_get_address
// pub fn try_get_internal_address(
// &self,
// address_index: AddressIndex,
// ) -> Result<AddressInfo, PersistenceError> {
// let address_info = self
// .get_wallet()
// .try_get_internal_address(address_index.into())?
// .into();
// Ok(address_info)
// }
pub fn commit(&self) -> Result<bool, PersistenceError> {
self.get_wallet()
.commit()
.map_err(|e| PersistenceError::Write {
error_message: e.to_string(),
})
}
pub fn network(&self) -> Network {
self.get_wallet().network()