From fdcf68eb6fe25924f6c4f7589f2656b8a6cae0fb Mon Sep 17 00:00:00 2001 From: itorod Date: Thu, 19 Jun 2025 10:56:45 +0000 Subject: [PATCH] feat: expose public_descriptor in wallet impl --- bdk-ffi/src/wallet.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bdk-ffi/src/wallet.rs b/bdk-ffi/src/wallet.rs index cfdc8146..87406832 100644 --- a/bdk-ffi/src/wallet.rs +++ b/bdk-ffi/src/wallet.rs @@ -433,6 +433,15 @@ impl Wallet { .tx_details(txid.0) .map(|details| details.into()) } + + /// Returns the descriptor used to create addresses for a particular `keychain`. + /// + /// It's the "public" version of the wallet's descriptor, meaning a new descriptor that has + /// the same structure but with the all secret keys replaced by their corresponding public key. + /// This can be used to build a watch-only version of a wallet. + pub fn public_descriptor(&self, keychain: KeychainKind) -> String { + self.get_wallet().public_descriptor(keychain).to_string() + } } impl Wallet {