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

@@ -15,7 +15,6 @@ use bdk_wallet::descriptor::IntoWalletDescriptor;
use bdk_wallet::keys::bip39::{Language, Mnemonic, WordCount};
use bdk_wallet::keys::{GeneratableKey, GeneratedKey};
use bdk_wallet::miniscript::Tap;
use rand::thread_rng;
use std::str::FromStr;
/// This example demonstrates how to generate a mnemonic phrase
@@ -26,9 +25,8 @@ fn main() -> Result<(), anyhow::Error> {
// In this example we are generating a 12 words mnemonic phrase
// but it is also possible generate 15, 18, 21 and 24 words
// using their respective `WordCount` variant.
let mut rng = thread_rng();
let mnemonic: GeneratedKey<_, Tap> =
Mnemonic::generate((WordCount::Words12, Language::English), &mut rng)
Mnemonic::generate((WordCount::Words12, Language::English))
.map_err(|_| anyhow!("Mnemonic generation error"))?;
println!("Mnemonic phrase: {}", *mnemonic);