Skip to content

Commit

Permalink
feat: expose Wallet::get_utxo method
Browse files Browse the repository at this point in the history
  • Loading branch information
thunderbiscuit committed Oct 9, 2024
1 parent 8c8875e commit f6a0b36
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions bdk-ffi/src/bdk.udl
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 7 additions & 1 deletion bdk-ffi/src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -76,6 +76,12 @@ impl Wallet {
self.get_wallet().cancel_tx(&tx.into())
}

pub fn get_utxo(&self, op: OutPoint) -> Option<LocalOutput> {
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()
}
Expand Down

0 comments on commit f6a0b36

Please sign in to comment.