diff --git a/bdk-ffi/src/bdk.udl b/bdk-ffi/src/bdk.udl index 89eaeca6..1c716777 100644 --- a/bdk-ffi/src/bdk.udl +++ b/bdk-ffi/src/bdk.udl @@ -375,8 +375,14 @@ interface Wallet { [Name=load, Throws=LoadWithPersistError] constructor(Descriptor descriptor, Descriptor change_descriptor, Connection connection); + void cancel_tx([ByRef] Transaction tx); + u32? derivation_index(KeychainKind keychain); + LocalOutput? get_utxo(OutPoint op); + + KeychainAndIndex? derivation_of_spk(Script spk); + AddressInfo reveal_next_address(KeychainKind keychain); AddressInfo peek_address(KeychainKind keychain, u32 index); @@ -629,6 +635,11 @@ dictionary SentAndReceivedValues { Amount received; }; +dictionary KeychainAndIndex { + KeychainKind keychain; + u32 index; +}; + // ------------------------------------------------------------------------ // bdk_wallet crate - bitcoin re-exports // ------------------------------------------------------------------------ diff --git a/bdk-ffi/src/lib.rs b/bdk-ffi/src/lib.rs index 110b21cc..b8db0d78 100644 --- a/bdk-ffi/src/lib.rs +++ b/bdk-ffi/src/lib.rs @@ -55,6 +55,7 @@ use crate::types::ConfirmationBlockTime; use crate::types::FullScanRequest; use crate::types::FullScanRequestBuilder; use crate::types::FullScanScriptInspector; +use crate::types::KeychainAndIndex; use crate::types::LocalOutput; use crate::types::ScriptAmount; use crate::types::SentAndReceivedValues; diff --git a/bdk-ffi/src/types.rs b/bdk-ffi/src/types.rs index 9191c930..eaf3a2ac 100644 --- a/bdk-ffi/src/types.rs +++ b/bdk-ffi/src/types.rs @@ -232,3 +232,8 @@ pub struct SentAndReceivedValues { pub sent: Arc, pub received: Arc, } + +pub struct KeychainAndIndex { + pub keychain: KeychainKind, + pub index: u32, +} diff --git a/bdk-ffi/src/wallet.rs b/bdk-ffi/src/wallet.rs index bdb506d0..fd8d4b75 100644 --- a/bdk-ffi/src/wallet.rs +++ b/bdk-ffi/src/wallet.rs @@ -6,11 +6,11 @@ use crate::error::{ }; use crate::store::Connection; use crate::types::{ - AddressInfo, Balance, CanonicalTx, FullScanRequestBuilder, LocalOutput, SentAndReceivedValues, - SyncRequestBuilder, Update, + AddressInfo, Balance, CanonicalTx, FullScanRequestBuilder, KeychainAndIndex, LocalOutput, + SentAndReceivedValues, 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; @@ -72,6 +72,25 @@ impl Wallet { self.inner_mutex.lock().expect("wallet") } + pub fn derivation_of_spk(&self, spk: Arc