Skip to content

Commit

Permalink
refactor(wallet): use walleterror for error handling in try_get_inter…
Browse files Browse the repository at this point in the history
…nal_address
  • Loading branch information
reez committed Apr 2, 2024
1 parent 9a996b1 commit f597fa4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion bdk-ffi/src/bdk.udl
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ interface Wallet {

AddressInfo get_address(AddressIndex address_index);

[Throws=Alpha3Error]
[Throws=WalletCreationError]
AddressInfo try_get_internal_address(AddressIndex address_index);

Network network();
Expand Down
8 changes: 3 additions & 5 deletions bdk-ffi/src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,11 @@ impl Wallet {
pub fn try_get_internal_address(
&self,
address_index: AddressIndex,
) -> Result<AddressInfo, Alpha3Error> {
) -> Result<AddressInfo, WalletCreationError> {
self.get_wallet()
.try_get_internal_address(address_index.into())
.map_or_else(
|_| Err(Alpha3Error::Generic),
|address_info| Ok(address_info.into()),
)
.map_err(|_| WalletCreationError::Write)
.map(|address_info| address_info.into())
}

pub fn network(&self) -> Network {
Expand Down

0 comments on commit f597fa4

Please sign in to comment.