From f6a0b36697a1e495e12a1cc406b65c2f653c86ed Mon Sep 17 00:00:00 2001 From: thunderbiscuit Date: Mon, 7 Oct 2024 11:43:21 -0400 Subject: [PATCH] feat: expose Wallet::get_utxo method --- bdk-ffi/src/bdk.udl | 2 ++ bdk-ffi/src/wallet.rs | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/bdk-ffi/src/bdk.udl b/bdk-ffi/src/bdk.udl index 97b3ff22..29d0a136 100644 --- a/bdk-ffi/src/bdk.udl +++ b/bdk-ffi/src/bdk.udl @@ -379,6 +379,8 @@ interface Wallet { u32? derivation_index(KeychainKind keychain); + LocalOutput? get_utxo(OutPoint op); + AddressInfo reveal_next_address(KeychainKind keychain); AddressInfo peek_address(KeychainKind keychain, u32 index); diff --git a/bdk-ffi/src/wallet.rs b/bdk-ffi/src/wallet.rs index 10bd31bc..060bb747 100644 --- a/bdk-ffi/src/wallet.rs +++ b/bdk-ffi/src/wallet.rs @@ -10,7 +10,7 @@ use crate::types::{ SyncRequestBuilder, Update, }; -use bitcoin_ffi::{Amount, FeeRate, Script}; +use bitcoin_ffi::{Amount, FeeRate, OutPoint, Script}; use bdk_wallet::bitcoin::{Network, Txid}; use bdk_wallet::rusqlite::Connection as BdkConnection; @@ -76,6 +76,12 @@ impl Wallet { self.get_wallet().cancel_tx(&tx.into()) } + pub fn get_utxo(&self, op: OutPoint) -> Option { + self.get_wallet() + .get_utxo(op) + .map(|local_output| local_output.into()) + } + pub fn reveal_next_address(&self, keychain: KeychainKind) -> AddressInfo { self.get_wallet().reveal_next_address(keychain).into() }