feat: expose get_internal_address
This commit is contained in:
parent
f5d4750ae4
commit
b854c78dde
@ -212,6 +212,9 @@ interface Wallet {
|
|||||||
[Throws=BdkError]
|
[Throws=BdkError]
|
||||||
AddressInfo get_address(AddressIndex address_index);
|
AddressInfo get_address(AddressIndex address_index);
|
||||||
|
|
||||||
|
[Throws=BdkError]
|
||||||
|
AddressInfo get_internal_address(AddressIndex address_index);
|
||||||
|
|
||||||
[Throws=BdkError]
|
[Throws=BdkError]
|
||||||
Balance get_balance();
|
Balance get_balance();
|
||||||
|
|
||||||
|
@ -88,6 +88,22 @@ impl Wallet {
|
|||||||
.map(AddressInfo::from)
|
.map(AddressInfo::from)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Return a derived address using the internal (change) descriptor.
|
||||||
|
///
|
||||||
|
/// If the wallet doesn't have an internal descriptor it will use the external descriptor.
|
||||||
|
///
|
||||||
|
/// see [`AddressIndex`] for available address index selection strategies. If none of the keys
|
||||||
|
/// in the descriptor are derivable (i.e. does not end with /*) then the same address will always
|
||||||
|
/// be returned for any [`AddressIndex`].
|
||||||
|
pub(crate) fn get_internal_address(
|
||||||
|
&self,
|
||||||
|
address_index: AddressIndex,
|
||||||
|
) -> Result<AddressInfo, BdkError> {
|
||||||
|
self.get_wallet()
|
||||||
|
.get_internal_address(address_index.into())
|
||||||
|
.map(AddressInfo::from)
|
||||||
|
}
|
||||||
|
|
||||||
/// Return the balance, meaning the sum of this wallet’s unspent outputs’ values. Note that this method only operates
|
/// Return the balance, meaning the sum of this wallet’s unspent outputs’ values. Note that this method only operates
|
||||||
/// on the internal database, which first needs to be Wallet.sync manually.
|
/// on the internal database, which first needs to be Wallet.sync manually.
|
||||||
pub(crate) fn get_balance(&self) -> Result<Balance, BdkError> {
|
pub(crate) fn get_balance(&self) -> Result<Balance, BdkError> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user