docs: remove 0.x api docs

This commit is contained in:
thunderbiscuit 2023-12-15 09:42:03 -05:00
parent bcb77c45f4
commit cdec63efa3
No known key found for this signature in database
GPG Key ID: 88253696EB836462
6 changed files with 2 additions and 191 deletions

View File

@ -14,7 +14,6 @@ use std::io::Cursor;
use std::str::FromStr; use std::str::FromStr;
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
/// A Bitcoin script.
#[derive(Clone, Debug, PartialEq, Eq)] #[derive(Clone, Debug, PartialEq, Eq)]
pub struct Script(pub(crate) BdkScriptBuf); pub struct Script(pub(crate) BdkScriptBuf);
@ -36,13 +35,9 @@ impl From<BdkScriptBuf> for Script {
} }
pub enum Network { pub enum Network {
/// Mainnet Bitcoin.
Bitcoin, Bitcoin,
/// Bitcoin's testnet network.
Testnet, Testnet,
/// Bitcoin's signet network.
Signet, Signet,
/// Bitcoin's regtest network.
Regtest, Regtest,
} }
@ -69,7 +64,6 @@ impl From<BdkNetwork> for Network {
} }
} }
/// A Bitcoin address.
#[derive(Debug, PartialEq, Eq)] #[derive(Debug, PartialEq, Eq)]
pub struct Address { pub struct Address {
inner: BdkAddress<NetworkChecked>, inner: BdkAddress<NetworkChecked>,
@ -141,7 +135,6 @@ impl From<BdkAddress> for Address {
} }
} }
/// A Bitcoin transaction.
#[derive(Debug, Clone, PartialEq, Eq)] #[derive(Debug, Clone, PartialEq, Eq)]
pub struct Transaction { pub struct Transaction {
inner: BdkTransaction, inner: BdkTransaction,
@ -242,7 +235,6 @@ impl PartiallySignedTransaction {
// txid.to_hex() // txid.to_hex()
// } // }
/// Return the transaction.
pub(crate) fn extract_tx(&self) -> Arc<Transaction> { pub(crate) fn extract_tx(&self) -> Arc<Transaction> {
let tx = self.inner.lock().unwrap().clone().extract_tx(); let tx = self.inner.lock().unwrap().clone().extract_tx();
Arc::new(tx.into()) Arc::new(tx.into())
@ -293,12 +285,9 @@ impl From<BdkPartiallySignedTransaction> for PartiallySignedTransaction {
} }
} }
/// A reference to a transaction output.
#[derive(Clone, Debug, PartialEq, Eq, Hash)] #[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct OutPoint { pub struct OutPoint {
/// The referenced transaction's txid.
pub txid: String, pub txid: String,
/// The index of the referenced output in its transaction's vout.
pub vout: u32, pub vout: u32,
} }
@ -311,12 +300,9 @@ impl From<&OutPoint> for BdkOutPoint {
} }
} }
/// A transaction output, which defines new coins to be created from old ones.
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct TxOut { pub struct TxOut {
/// The value of the output, in satoshis.
pub value: u64, pub value: u64,
/// The address of the output.
pub script_pubkey: Arc<Script>, pub script_pubkey: Arc<Script>,
} }

View File

@ -276,9 +276,6 @@ impl Descriptor {
} }
} }
// // The goal of these tests to to ensure `bdk-ffi` intermediate code correctly calls `bdk` APIs.
// // These tests should not be used to verify `bdk` behavior that is already tested in the `bdk`
// // crate.
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use crate::*; use crate::*;

View File

@ -18,14 +18,11 @@ use std::ops::Deref;
use std::str::FromStr; use std::str::FromStr;
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
/// Mnemonic phrases are a human-readable version of the private keys.
/// Supported number of words are 12, 15, 18, 21 and 24.
pub(crate) struct Mnemonic { pub(crate) struct Mnemonic {
inner: BdkMnemonic, inner: BdkMnemonic,
} }
impl Mnemonic { impl Mnemonic {
/// Generates Mnemonic with a random entropy
pub(crate) fn new(word_count: WordCount) -> Self { pub(crate) fn new(word_count: WordCount) -> Self {
// TODO 4: I DON'T KNOW IF THIS IS A DECENT WAY TO GENERATE ENTROPY PLEASE CONFIRM // TODO 4: I DON'T KNOW IF THIS IS A DECENT WAY TO GENERATE ENTROPY PLEASE CONFIRM
let mut rng = rand::thread_rng(); let mut rng = rand::thread_rng();
@ -38,22 +35,18 @@ impl Mnemonic {
Mnemonic { inner: mnemonic } Mnemonic { inner: mnemonic }
} }
/// Parse a Mnemonic with given string
pub(crate) fn from_string(mnemonic: String) -> Result<Self, BdkError> { pub(crate) fn from_string(mnemonic: String) -> Result<Self, BdkError> {
BdkMnemonic::from_str(&mnemonic) BdkMnemonic::from_str(&mnemonic)
.map(|m| Mnemonic { inner: m }) .map(|m| Mnemonic { inner: m })
.map_err(|e| BdkError::Generic(e.to_string())) .map_err(|e| BdkError::Generic(e.to_string()))
} }
/// Create a new Mnemonic in the specified language from the given entropy.
/// Entropy must be a multiple of 32 bits (4 bytes) and 128-256 bits in length.
pub(crate) fn from_entropy(entropy: Vec<u8>) -> Result<Self, BdkError> { pub(crate) fn from_entropy(entropy: Vec<u8>) -> Result<Self, BdkError> {
BdkMnemonic::from_entropy(entropy.as_slice()) BdkMnemonic::from_entropy(entropy.as_slice())
.map(|m| Mnemonic { inner: m }) .map(|m| Mnemonic { inner: m })
.map_err(|e| BdkError::Generic(e.to_string())) .map_err(|e| BdkError::Generic(e.to_string()))
} }
/// Returns Mnemonic as string
pub(crate) fn as_string(&self) -> String { pub(crate) fn as_string(&self) -> String {
self.inner.to_string() self.inner.to_string()
} }
@ -164,7 +157,6 @@ impl DescriptorSecretKey {
}) })
} }
/// Get the private key as bytes.
pub(crate) fn secret_bytes(&self) -> Vec<u8> { pub(crate) fn secret_bytes(&self) -> Vec<u8> {
let inner = &self.inner; let inner = &self.inner;
let secret_bytes: Vec<u8> = match inner { let secret_bytes: Vec<u8> = match inner {
@ -262,9 +254,6 @@ impl DescriptorPublicKey {
} }
} }
// // The goal of these tests to to ensure `bdk-ffi` intermediate code correctly calls `bdk` APIs.
// // These tests should not be used to verify `bdk` behavior that is already tested in the `bdk`
// // crate.
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use crate::keys::{DerivationPath, DescriptorPublicKey, DescriptorSecretKey, Mnemonic}; use crate::keys::{DerivationPath, DescriptorPublicKey, DescriptorSecretKey, Mnemonic};

View File

@ -36,86 +36,4 @@ use bdk::KeychainKind;
uniffi::include_scaffolding!("bdk"); uniffi::include_scaffolding!("bdk");
// #[derive(Debug, Clone)] // TODO: TxIn, Payload
// pub struct TxIn {
// pub previous_output: OutPoint,
// pub script_sig: Arc<Script>,
// pub sequence: u32,
// pub witness: Vec<Vec<u8>>,
// }
//
// impl From<&BdkTxIn> for TxIn {
// fn from(tx_in: &BdkTxIn) -> Self {
// TxIn {
// previous_output: OutPoint {
// txid: tx_in.previous_output.txid.to_string(),
// vout: tx_in.previous_output.vout,
// },
// script_sig: Arc::new(Script {
// inner: tx_in.script_sig.clone(),
// }),
// sequence: tx_in.sequence.0,
// witness: tx_in.witness.to_vec(),
// }
// }
// }
// /// The method used to produce an address.
// #[derive(Debug)]
// pub enum Payload {
// /// P2PKH address.
// PubkeyHash { pubkey_hash: Vec<u8> },
// /// P2SH address.
// ScriptHash { script_hash: Vec<u8> },
// /// Segwit address.
// WitnessProgram {
// /// The witness program version.
// version: WitnessVersion,
// /// The witness program.
// program: Vec<u8>,
// },
// }
// /// The result after calling the TxBuilder finish() function. Contains unsigned PSBT and
// /// transaction details.
// pub struct TxBuilderResult {
// pub(crate) psbt: Arc<PartiallySignedTransaction>,
// pub transaction_details: TransactionDetails,
// }
//
// uniffi::deps::static_assertions::assert_impl_all!(Wallet: Sync, Send);
//
// // The goal of these tests to to ensure `bdk-ffi` intermediate code correctly calls `bdk` APIs.
// // These tests should not be used to verify `bdk` behavior that is already tested in the `bdk`
// // crate.
// #[cfg(test)]
// mod test {
// use super::Transaction;
// use crate::Network::Regtest;
// use crate::{Address, Payload};
// use assert_matches::assert_matches;
// use bdk::bitcoin::hashes::hex::FromHex;
// use bdk::bitcoin::util::address::WitnessVersion;
//
// // Verify that bdk-ffi Transaction can be created from valid bytes and serialized back into the same bytes.
// #[test]
// fn test_transaction_serde() {
// let test_tx_bytes = Vec::from_hex("020000000001031cfbc8f54fbfa4a33a30068841371f80dbfe166211242213188428f437445c91000000006a47304402206fbcec8d2d2e740d824d3d36cc345b37d9f65d665a99f5bd5c9e8d42270a03a8022013959632492332200c2908459547bf8dbf97c65ab1a28dec377d6f1d41d3d63e012103d7279dfb90ce17fe139ba60a7c41ddf605b25e1c07a4ddcb9dfef4e7d6710f48feffffff476222484f5e35b3f0e43f65fc76e21d8be7818dd6a989c160b1e5039b7835fc00000000171600140914414d3c94af70ac7e25407b0689e0baa10c77feffffffa83d954a62568bbc99cc644c62eb7383d7c2a2563041a0aeb891a6a4055895570000000017160014795d04cc2d4f31480d9a3710993fbd80d04301dffeffffff06fef72f000000000017a91476fd7035cd26f1a32a5ab979e056713aac25796887a5000f00000000001976a914b8332d502a529571c6af4be66399cd33379071c588ac3fda0500000000001976a914fc1d692f8de10ae33295f090bea5fe49527d975c88ac522e1b00000000001976a914808406b54d1044c429ac54c0e189b0d8061667e088ac6eb68501000000001976a914dfab6085f3a8fb3e6710206a5a959313c5618f4d88acbba20000000000001976a914eb3026552d7e3f3073457d0bee5d4757de48160d88ac0002483045022100bee24b63212939d33d513e767bc79300051f7a0d433c3fcf1e0e3bf03b9eb1d70220588dc45a9ce3a939103b4459ce47500b64e23ab118dfc03c9caa7d6bfc32b9c601210354fd80328da0f9ae6eef2b3a81f74f9a6f66761fadf96f1d1d22b1fd6845876402483045022100e29c7e3a5efc10da6269e5fc20b6a1cb8beb92130cc52c67e46ef40aaa5cac5f0220644dd1b049727d991aece98a105563416e10a5ac4221abac7d16931842d5c322012103960b87412d6e169f30e12106bdf70122aabb9eb61f455518322a18b920a4dfa887d30700").unwrap();
// let new_tx_from_bytes = Transaction::new(test_tx_bytes.clone()).unwrap();
// let serialized_tx_to_bytes = new_tx_from_bytes.serialize();
// assert_eq!(test_tx_bytes, serialized_tx_to_bytes);
// }
//
// // Verify that bdk-ffi Address.payload includes expected WitnessProgram variant, version and program bytes.
// #[test]
// fn test_address_witness_program() {
// let address =
// Address::new("bcrt1qqjn9gky9mkrm3c28e5e87t5akd3twg6xezp0tv".to_string()).unwrap();
// let payload = address.payload();
// assert_matches!(payload, Payload::WitnessProgram { version, program } => {
// assert_eq!(version,WitnessVersion::V0);
// assert_eq!(program, Vec::from_hex("04a6545885dd87b8e147cd327f2e9db362b72346").unwrap());
// });
// assert_eq!(address.network(), Regtest);
// }
// }

View File

@ -9,19 +9,14 @@ use bdk::LocalUtxo as BdkLocalUtxo;
use std::sync::Arc; use std::sync::Arc;
/// A output script and an amount of satoshis.
pub struct ScriptAmount { pub struct ScriptAmount {
pub script: Arc<Script>, pub script: Arc<Script>,
pub amount: u64, pub amount: u64,
} }
/// A derived address and the index it was found at.
pub struct AddressInfo { pub struct AddressInfo {
/// Child index of this address.
pub index: u32, pub index: u32,
/// Address.
pub address: Arc<Address>, pub address: Arc<Address>,
/// Type of keychain.
pub keychain: KeychainKind, pub keychain: KeychainKind,
} }
@ -35,22 +30,9 @@ impl From<BdkAddressInfo> for AddressInfo {
} }
} }
/// The address index selection strategy to use to derived an address from the wallet's external
/// descriptor.
pub enum AddressIndex { pub enum AddressIndex {
/// Return a new address after incrementing the current descriptor index.
New, New,
/// Return the address for the current descriptor index if it has not been used in a received
/// transaction. Otherwise return a new address as with AddressIndex::New.
/// Use with caution, if the wallet has not yet detected an address has been used it could
/// return an already used address. This function is primarily meant for situations where the
/// caller is untrusted; for example when deriving donation addresses on-demand for a public
/// web page.
LastUnused, LastUnused,
/// Return the address for a specific descriptor index. Does not change the current descriptor
/// index used by `AddressIndex::New` and `AddressIndex::LastUsed`.
/// Use with caution, if an index is given that is less than the current descriptor index
/// then the returned address may have already been used.
Peek { index: u32 }, Peek { index: u32 },
} }
@ -96,17 +78,11 @@ impl From<&BdkAddressIndex> for AddressIndex {
} }
pub struct Balance { pub struct Balance {
// All coinbase outputs not yet matured
pub immature: u64, pub immature: u64,
/// Unconfirmed UTXOs generated by a wallet tx
pub trusted_pending: u64, pub trusted_pending: u64,
/// Unconfirmed UTXOs received from an external wallet
pub untrusted_pending: u64, pub untrusted_pending: u64,
/// Confirmed and immediately spendable balance
pub confirmed: u64, pub confirmed: u64,
/// Get sum of trusted_pending and confirmed coins
pub trusted_spendable: u64, pub trusted_spendable: u64,
/// Get the whole balance visible to the wallet
pub total: u64, pub total: u64,
} }

View File

@ -76,14 +76,6 @@ impl Wallet {
// self.get_wallet().is_mine(script.0.clone().as_script()) // self.get_wallet().is_mine(script.0.clone().as_script())
} }
/// Sign a transaction with all the wallet's signers, in the order specified by every signer's
/// [`SignerOrdering`]. This function returns the `Result` type with an encapsulated `bool` that
/// has the value true if the PSBT was finalized, or false otherwise.
///
/// The [`SignOptions`] can be used to tweak the behavior of the software signers, and the way
/// the transaction is finalized at the end. Note that it can't be guaranteed that *every*
/// signers will follow the options, but the "software signers" (WIF keys and `xprv`) defined
/// in this library will.
pub(crate) fn sign( pub(crate) fn sign(
&self, &self,
psbt: Arc<PartiallySignedTransaction>, psbt: Arc<PartiallySignedTransaction>,
@ -295,10 +287,7 @@ pub struct Update(pub(crate) BdkUpdate);
// } // }
// } // }
// } // }
//
/// A transaction builder.
/// After creating the TxBuilder, you set options on it until finally calling finish to consume the builder and generate the transaction.
/// Each method on the TxBuilder returns an instance of a new TxBuilder with the option set/added.
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct TxBuilder { pub struct TxBuilder {
pub(crate) recipients: Vec<(BdkScriptBuf, u64)>, pub(crate) recipients: Vec<(BdkScriptBuf, u64)>,
@ -331,7 +320,6 @@ impl TxBuilder {
} }
} }
/// Add a recipient to the internal list.
pub(crate) fn add_recipient(&self, script: &Script, amount: u64) -> Arc<Self> { pub(crate) fn add_recipient(&self, script: &Script, amount: u64) -> Arc<Self> {
let mut recipients: Vec<(BdkScriptBuf, u64)> = self.recipients.clone(); let mut recipients: Vec<(BdkScriptBuf, u64)> = self.recipients.clone();
recipients.append(&mut vec![(script.0.clone(), amount)]); recipients.append(&mut vec![(script.0.clone(), amount)]);
@ -353,8 +341,6 @@ impl TxBuilder {
}) })
} }
/// Add a utxo to the internal list of unspendable utxos. Its important to note that the "must-be-spent"
/// utxos added with [TxBuilder.addUtxo] have priority over this. See the Rust docs of the two linked methods for more details.
pub(crate) fn add_unspendable(&self, unspendable: OutPoint) -> Arc<Self> { pub(crate) fn add_unspendable(&self, unspendable: OutPoint) -> Arc<Self> {
let mut unspendable_hash_set = self.unspendable.clone(); let mut unspendable_hash_set = self.unspendable.clone();
unspendable_hash_set.insert(unspendable); unspendable_hash_set.insert(unspendable);
@ -364,8 +350,6 @@ impl TxBuilder {
}) })
} }
/// Replace the internal list of unspendable utxos with a new list. Its important to note that the "must-be-spent" utxos added with
/// TxBuilder.addUtxo have priority over these. See the Rust docs of the two linked methods for more details.
pub(crate) fn unspendable(&self, unspendable: Vec<OutPoint>) -> Arc<Self> { pub(crate) fn unspendable(&self, unspendable: Vec<OutPoint>) -> Arc<Self> {
Arc::new(TxBuilder { Arc::new(TxBuilder {
unspendable: unspendable.into_iter().collect(), unspendable: unspendable.into_iter().collect(),
@ -373,15 +357,10 @@ impl TxBuilder {
}) })
} }
/// Add an outpoint to the internal list of UTXOs that must be spent. These have priority over the "unspendable"
/// utxos, meaning that if a utxo is present both in the "utxos" and the "unspendable" list, it will be spent.
pub(crate) fn add_utxo(&self, outpoint: OutPoint) -> Arc<Self> { pub(crate) fn add_utxo(&self, outpoint: OutPoint) -> Arc<Self> {
self.add_utxos(vec![outpoint]) self.add_utxos(vec![outpoint])
} }
/// Add the list of outpoints to the internal list of UTXOs that must be spent. If an error occurs while adding
/// any of the UTXOs then none of them are added and the error is returned. These have priority over the "unspendable"
/// utxos, meaning that if a utxo is present both in the "utxos" and the "unspendable" list, it will be spent.
pub(crate) fn add_utxos(&self, mut outpoints: Vec<OutPoint>) -> Arc<Self> { pub(crate) fn add_utxos(&self, mut outpoints: Vec<OutPoint>) -> Arc<Self> {
let mut utxos = self.utxos.to_vec(); let mut utxos = self.utxos.to_vec();
utxos.append(&mut outpoints); utxos.append(&mut outpoints);
@ -398,7 +377,6 @@ impl TxBuilder {
}) })
} }
/// Do not spend change outputs. This effectively adds all the change outputs to the "unspendable" list. See TxBuilder.unspendable.
pub(crate) fn do_not_spend_change(&self) -> Arc<Self> { pub(crate) fn do_not_spend_change(&self) -> Arc<Self> {
Arc::new(TxBuilder { Arc::new(TxBuilder {
change_policy: ChangeSpendPolicy::ChangeForbidden, change_policy: ChangeSpendPolicy::ChangeForbidden,
@ -406,7 +384,6 @@ impl TxBuilder {
}) })
} }
/// Only spend change outputs. This effectively adds all the non-change outputs to the "unspendable" list. See TxBuilder.unspendable.
pub(crate) fn only_spend_change(&self) -> Arc<Self> { pub(crate) fn only_spend_change(&self) -> Arc<Self> {
Arc::new(TxBuilder { Arc::new(TxBuilder {
change_policy: ChangeSpendPolicy::OnlyChange, change_policy: ChangeSpendPolicy::OnlyChange,
@ -414,8 +391,6 @@ impl TxBuilder {
}) })
} }
/// Only spend utxos added by [add_utxo]. The wallet will not add additional utxos to the transaction even if they are
/// needed to make the transaction valid.
pub(crate) fn manually_selected_only(&self) -> Arc<Self> { pub(crate) fn manually_selected_only(&self) -> Arc<Self> {
Arc::new(TxBuilder { Arc::new(TxBuilder {
manually_selected_only: true, manually_selected_only: true,
@ -423,7 +398,6 @@ impl TxBuilder {
}) })
} }
/// Set a custom fee rate.
pub(crate) fn fee_rate(&self, sat_per_vb: f32) -> Arc<Self> { pub(crate) fn fee_rate(&self, sat_per_vb: f32) -> Arc<Self> {
Arc::new(TxBuilder { Arc::new(TxBuilder {
fee_rate: Some(sat_per_vb), fee_rate: Some(sat_per_vb),
@ -431,7 +405,6 @@ impl TxBuilder {
}) })
} }
/// Set an absolute fee.
pub(crate) fn fee_absolute(&self, fee_amount: u64) -> Arc<Self> { pub(crate) fn fee_absolute(&self, fee_amount: u64) -> Arc<Self> {
Arc::new(TxBuilder { Arc::new(TxBuilder {
fee_absolute: Some(fee_amount), fee_absolute: Some(fee_amount),
@ -439,7 +412,6 @@ impl TxBuilder {
}) })
} }
/// Spend all the available inputs. This respects filters like TxBuilder.unspendable and the change policy.
pub(crate) fn drain_wallet(&self) -> Arc<Self> { pub(crate) fn drain_wallet(&self) -> Arc<Self> {
Arc::new(TxBuilder { Arc::new(TxBuilder {
drain_wallet: true, drain_wallet: true,
@ -447,14 +419,6 @@ impl TxBuilder {
}) })
} }
/// Sets the address to drain excess coins to. Usually, when there are excess coins they are sent to a change address
/// generated by the wallet. This option replaces the usual change address with an arbitrary ScriptPubKey of your choosing.
/// Just as with a change output, if the drain output is not needed (the excess coins are too small) it will not be included
/// in the resulting transaction. The only difference is that it is valid to use drain_to without setting any ordinary recipients
/// with add_recipient (but it is perfectly fine to add recipients as well). If you choose not to set any recipients, you should
/// either provide the utxos that the transaction should spend via add_utxos, or set drain_wallet to spend all of them.
/// When bumping the fees of a transaction made with this option, you probably want to use BumpFeeTxBuilder.allow_shrinking
/// to allow this output to be reduced to pay for the extra fees.
pub(crate) fn drain_to(&self, script: &Script) -> Arc<Self> { pub(crate) fn drain_to(&self, script: &Script) -> Arc<Self> {
Arc::new(TxBuilder { Arc::new(TxBuilder {
drain_to: Some(script.0.clone()), drain_to: Some(script.0.clone()),
@ -462,7 +426,6 @@ impl TxBuilder {
}) })
} }
/// Enable signaling RBF. This will use the default `nsequence` value of `0xFFFFFFFD`.
pub(crate) fn enable_rbf(&self) -> Arc<Self> { pub(crate) fn enable_rbf(&self) -> Arc<Self> {
Arc::new(TxBuilder { Arc::new(TxBuilder {
rbf: Some(RbfValue::Default), rbf: Some(RbfValue::Default),
@ -470,9 +433,6 @@ impl TxBuilder {
}) })
} }
/// Enable signaling RBF with a specific nSequence value. This can cause conflicts if the wallet's descriptors contain an
/// "older" (OP_CSV) operator and the given `nsequence` is lower than the CSV value. If the `nsequence` is higher than `0xFFFFFFFD`
/// an error will be thrown, since it would not be a valid nSequence to signal RBF.
pub(crate) fn enable_rbf_with_sequence(&self, nsequence: u32) -> Arc<Self> { pub(crate) fn enable_rbf_with_sequence(&self, nsequence: u32) -> Arc<Self> {
Arc::new(TxBuilder { Arc::new(TxBuilder {
rbf: Some(RbfValue::Value(nsequence)), rbf: Some(RbfValue::Value(nsequence)),
@ -488,7 +448,6 @@ impl TxBuilder {
// }) // })
// } // }
/// Finish building the transaction. Returns the BIP174 PSBT.
pub(crate) fn finish( pub(crate) fn finish(
&self, &self,
wallet: &Wallet, wallet: &Wallet,
@ -545,7 +504,6 @@ impl TxBuilder {
} }
} }
// /// The BumpFeeTxBuilder is used to bump the fee on a transaction that has been broadcast and has its RBF flag set to true.
#[derive(Clone)] #[derive(Clone)]
pub(crate) struct BumpFeeTxBuilder { pub(crate) struct BumpFeeTxBuilder {
pub(crate) txid: String, pub(crate) txid: String,
@ -564,11 +522,6 @@ impl BumpFeeTxBuilder {
} }
} }
/// Explicitly tells the wallet that it is allowed to reduce the amount of the output matching this script_pubkey
/// in order to bump the transaction fee. Without specifying this the wallet will attempt to find a change output to
/// shrink instead. Note that the output may shrink to below the dust limit and therefore be removed. If it is preserved
/// then it is currently not guaranteed to be in the same position as it was originally. Returns an error if script_pubkey
/// cant be found among the recipients of the transaction we are bumping.
pub(crate) fn allow_shrinking(&self, script_pubkey: Arc<Script>) -> Arc<Self> { pub(crate) fn allow_shrinking(&self, script_pubkey: Arc<Script>) -> Arc<Self> {
Arc::new(Self { Arc::new(Self {
allow_shrinking: Some(script_pubkey), allow_shrinking: Some(script_pubkey),
@ -576,7 +529,6 @@ impl BumpFeeTxBuilder {
}) })
} }
/// Enable signaling RBF. This will use the default `nsequence` value of `0xFFFFFFFD`.
pub(crate) fn enable_rbf(&self) -> Arc<Self> { pub(crate) fn enable_rbf(&self) -> Arc<Self> {
Arc::new(Self { Arc::new(Self {
rbf: Some(RbfValue::Default), rbf: Some(RbfValue::Default),
@ -584,9 +536,6 @@ impl BumpFeeTxBuilder {
}) })
} }
/// Enable signaling RBF with a specific nSequence value. This can cause conflicts if the wallet's descriptors contain an
/// "older" (OP_CSV) operator and the given `nsequence` is lower than the CSV value. If the `nsequence` is higher than `0xFFFFFFFD`
/// an error will be thrown, since it would not be a valid nSequence to signal RBF.
pub(crate) fn enable_rbf_with_sequence(&self, nsequence: u32) -> Arc<Self> { pub(crate) fn enable_rbf_with_sequence(&self, nsequence: u32) -> Arc<Self> {
Arc::new(Self { Arc::new(Self {
rbf: Some(RbfValue::Value(nsequence)), rbf: Some(RbfValue::Value(nsequence)),
@ -594,7 +543,6 @@ impl BumpFeeTxBuilder {
}) })
} }
/// Finish building the transaction. Returns the BIP174 PSBT.
pub(crate) fn finish( pub(crate) fn finish(
&self, &self,
wallet: &Wallet, wallet: &Wallet,
@ -631,9 +579,6 @@ pub enum RbfValue {
Value(u32), Value(u32),
} }
// // The goal of these tests to to ensure `bdk-ffi` intermediate code correctly calls `bdk` APIs.
// // These tests should not be used to verify `bdk` behavior that is already tested in the `bdk`
// // crate.
// #[cfg(test)] // #[cfg(test)]
// mod test { // mod test {
// use crate::database::DatabaseConfig; // use crate::database::DatabaseConfig;