diff --git a/bdk-ffi/src/lib.rs b/bdk-ffi/src/lib.rs index 87dcdde..48a541c 100644 --- a/bdk-ffi/src/lib.rs +++ b/bdk-ffi/src/lib.rs @@ -2,11 +2,10 @@ mod psbt; mod wallet; use crate::psbt::PartiallySignedTransaction; -use crate::wallet::Wallet; +use crate::wallet::{BumpFeeTxBuilder, TxBuilder, Wallet}; use bdk::bitcoin::blockdata::script::Script as BdkScript; use bdk::bitcoin::secp256k1::Secp256k1; use bdk::bitcoin::util::bip32::{DerivationPath as BdkDerivationPath, Fingerprint}; -use bdk::bitcoin::Sequence; use bdk::bitcoin::{Address as BdkAddress, Network, OutPoint as BdkOutPoint, Txid}; use bdk::blockchain::any::{AnyBlockchain, AnyBlockchainConfig}; use bdk::blockchain::rpc::Auth as BdkAuth; @@ -29,11 +28,9 @@ use bdk::miniscript::BareCtx; use bdk::template::{ Bip44, Bip44Public, Bip49, Bip49Public, Bip84, Bip84Public, DescriptorTemplate, }; -use bdk::wallet::tx_builder::ChangeSpendPolicy; use bdk::wallet::AddressIndex as BdkAddressIndex; use bdk::wallet::AddressInfo as BdkAddressInfo; use bdk::{Balance as BdkBalance, BlockTime, Error as BdkError, FeeRate, KeychainKind}; -use std::collections::HashSet; use std::convert::{From, TryFrom}; use std::fmt; use std::ops::Deref; @@ -474,328 +471,6 @@ pub struct TxBuilderResult { pub transaction_details: TransactionDetails, } -/// 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)] -struct TxBuilder { - recipients: Vec<(BdkScript, u64)>, - utxos: Vec, - unspendable: HashSet, - change_policy: ChangeSpendPolicy, - manually_selected_only: bool, - fee_rate: Option, - fee_absolute: Option, - drain_wallet: bool, - drain_to: Option, - rbf: Option, - data: Vec, -} - -impl TxBuilder { - fn new() -> Self { - TxBuilder { - recipients: Vec::new(), - utxos: Vec::new(), - unspendable: HashSet::new(), - change_policy: ChangeSpendPolicy::ChangeAllowed, - manually_selected_only: false, - fee_rate: None, - fee_absolute: None, - drain_wallet: false, - drain_to: None, - rbf: None, - data: Vec::new(), - } - } - - /// Add a recipient to the internal list. - fn add_recipient(&self, script: Arc