diff --git a/bdk-ffi/src/bdk.udl b/bdk-ffi/src/bdk.udl index 95f921d3..26270309 100644 --- a/bdk-ffi/src/bdk.udl +++ b/bdk-ffi/src/bdk.udl @@ -173,6 +173,10 @@ interface Wallet { [Throws=CalculateFeeError] FeeRate calculate_fee_rate([ByRef] Transaction tx); + + sequence list_unspent(); + + sequence list_output(); }; interface Update {}; diff --git a/bdk-ffi/src/wallet.rs b/bdk-ffi/src/wallet.rs index 987d7bee..4a9e5a55 100644 --- a/bdk-ffi/src/wallet.rs +++ b/bdk-ffi/src/wallet.rs @@ -3,7 +3,7 @@ use crate::descriptor::Descriptor; use crate::error::{ Alpha3Error, CalculateFeeError, PersistenceError, TxidParseError, WalletCreationError, }; -use crate::types::{AddressIndex, AddressInfo, Balance, CanonicalTx, FeeRate, ScriptAmount}; +use crate::types::{AddressIndex, AddressInfo, Balance, CanonicalTx, FeeRate, LocalOutput, ScriptAmount}; use bdk::bitcoin::blockdata::script::ScriptBuf as BdkScriptBuf; use bdk::bitcoin::psbt::PartiallySignedTransaction as BdkPartiallySignedTransaction; @@ -128,6 +128,20 @@ impl Wallet { .map(|bdk_fee_rate| Arc::new(FeeRate(bdk_fee_rate))) .map_err(|e| e.into()) } + + pub fn list_unspent(&self) -> Vec { + self.get_wallet() + .list_unspent() + .map(|o| o.into()) + .collect() + } + + pub fn list_output(&self) -> Vec { + self.get_wallet() + .list_output() + .map(|o| o.into()) + .collect() + } } pub struct SentAndReceivedValues {