Skip to content

Commit 37af9eb

Browse files
committed
Move psbt Params to src/psbt/params.rs
1 parent de8f203 commit 37af9eb

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

wallet/examples/psbt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::sync::Arc;
88
use bdk_chain::BlockId;
99
use bdk_chain::ConfirmationBlockTime;
1010
use bdk_chain::TxUpdate;
11-
use bdk_wallet::psbt_params::{Params, SelectionStrategy::*};
11+
use bdk_wallet::psbt::params::{Params, SelectionStrategy::*};
1212
use bdk_wallet::test_utils::*;
1313
use bdk_wallet::{KeychainKind::*, Update, Wallet};
1414
use bitcoin::FeeRate;

wallet/src/psbt/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ use bitcoin::FeeRate;
1717
use bitcoin::Psbt;
1818
use bitcoin::TxOut;
1919

20+
#[allow(unused)]
21+
pub mod params;
22+
2023
// TODO upstream the functions here to `rust-bitcoin`?
2124

2225
/// Trait to add functions to extract utxos and calculate fees.

wallet/src/wallet/psbt_params.rs renamed to wallet/src/psbt/params.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ use miniscript::plan::Assets;
1111
pub struct Params {
1212
// Inputs
1313
pub(crate) utxos: Vec<OutPoint>,
14-
pub(crate) assets: Option<Assets>,
1514

1615
// Outputs
1716
pub(crate) recipients: Vec<(ScriptBuf, Amount)>,
1817
pub(crate) change_descriptor: Option<DefiniteDescriptor>,
1918

2019
// Coin Selection
20+
pub(crate) assets: Option<Assets>,
2121
pub(crate) feerate: FeeRate,
2222
pub(crate) longterm_feerate: FeeRate,
2323
pub(crate) drain_wallet: bool,
@@ -96,6 +96,12 @@ impl Params {
9696
self.coin_selection = strategy;
9797
self
9898
}
99+
100+
/// Set the definite descriptor used for generating the change output.
101+
pub fn change_descriptor(&mut self, desc: DefiniteDescriptor) -> &mut Self {
102+
self.change_descriptor = Some(desc);
103+
self
104+
}
99105
}
100106

101107
/// Coin select strategy.

wallet/src/wallet/mod.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ pub mod error;
5656
pub mod export;
5757
mod params;
5858
mod persisted;
59-
#[allow(unused)]
60-
pub mod psbt_params;
6159
pub mod signer;
6260
pub mod tx_builder;
6361
pub(crate) mod utils;
@@ -2640,9 +2638,8 @@ use bdk_tx::{
26402638
Output, PsbtParams, Selector, SelectorParams, TxStatus,
26412639
};
26422640
use miniscript::plan::{Assets, Plan};
2643-
use psbt_params::SelectionStrategy;
26442641

2645-
use crate::wallet::psbt_params::AssetsExt;
2642+
use crate::psbt::params::{self as psbt_params, AssetsExt, SelectionStrategy};
26462643

26472644
/// Maps a chain position to tx confirmation status, if `pos` is the confirmed
26482645
/// variant.

0 commit comments

Comments
 (0)