feat(wallet): add back TxBuilder finish() and sort_tx() with thread_rng()

This commit is contained in:
Steve Myers
2024-06-19 16:35:04 -05:00
committed by Rob N
parent 45c0cae0a4
commit 4bddb0de62
19 changed files with 243 additions and 240 deletions

View File

@@ -8,4 +8,3 @@ bdk_wallet = { path = "../../crates/wallet" }
bdk_electrum = { path = "../../crates/electrum" }
bdk_file_store = { path = "../../crates/file_store" }
anyhow = "1"
rand = "0.8.0"

View File

@@ -14,7 +14,6 @@ use bdk_wallet::bitcoin::{Address, Amount};
use bdk_wallet::chain::collections::HashSet;
use bdk_wallet::{bitcoin::Network, Wallet};
use bdk_wallet::{KeychainKind, SignOptions};
use rand::thread_rng;
fn main() -> Result<(), anyhow::Error> {
let db_path = std::env::temp_dir().join("bdk-electrum-example");
@@ -97,7 +96,7 @@ fn main() -> Result<(), anyhow::Error> {
.add_recipient(faucet_address.script_pubkey(), SEND_AMOUNT)
.enable_rbf();
let mut psbt = tx_builder.finish_with_aux_rand(&mut thread_rng())?;
let mut psbt = tx_builder.finish()?;
let finalized = wallet.sign(&mut psbt, SignOptions::default())?;
assert!(finalized);

View File

@@ -11,4 +11,3 @@ bdk_esplora = { path = "../../crates/esplora", features = ["async-https"] }
bdk_sqlite = { path = "../../crates/sqlite" }
tokio = { version = "1", features = ["rt", "rt-multi-thread", "macros"] }
anyhow = "1"
rand = "0.8.0"

View File

@@ -5,7 +5,6 @@ use bdk_wallet::{
bitcoin::{Address, Amount, Network, Script},
KeychainKind, SignOptions, Wallet,
};
use rand::thread_rng;
use bdk_sqlite::{rusqlite::Connection, Store};
@@ -104,7 +103,7 @@ async fn main() -> Result<(), anyhow::Error> {
.add_recipient(faucet_address.script_pubkey(), SEND_AMOUNT)
.enable_rbf();
let mut psbt = tx_builder.finish_with_aux_rand(&mut thread_rng())?;
let mut psbt = tx_builder.finish()?;
let finalized = wallet.sign(&mut psbt, SignOptions::default())?;
assert!(finalized);

View File

@@ -11,4 +11,3 @@ bdk_wallet = { path = "../../crates/wallet" }
bdk_esplora = { path = "../../crates/esplora", features = ["blocking"] }
bdk_file_store = { path = "../../crates/file_store" }
anyhow = "1"
rand = "0.8.0"

View File

@@ -11,7 +11,6 @@ use bdk_wallet::{
bitcoin::{Address, Amount, Network},
KeychainKind, SignOptions, Wallet,
};
use rand::thread_rng;
fn main() -> Result<(), anyhow::Error> {
let db_path = std::env::temp_dir().join("bdk-esplora-example");
@@ -81,7 +80,7 @@ fn main() -> Result<(), anyhow::Error> {
.add_recipient(faucet_address.script_pubkey(), SEND_AMOUNT)
.enable_rbf();
let mut psbt = tx_builder.finish_with_aux_rand(&mut thread_rng())?;
let mut psbt = tx_builder.finish()?;
let finalized = wallet.sign(&mut psbt, SignOptions::default())?;
assert!(finalized);