66// You may not use this file except in accordance with one or both of these
77// licenses.
88
9+ use anyhow:: anyhow;
910use bdk:: bitcoin:: bip32:: DerivationPath ;
1011use bdk:: bitcoin:: secp256k1:: Secp256k1 ;
1112use bdk:: bitcoin:: Network ;
@@ -14,21 +15,19 @@ use bdk::descriptor::IntoWalletDescriptor;
1415use bdk:: keys:: bip39:: { Language , Mnemonic , WordCount } ;
1516use bdk:: keys:: { GeneratableKey , GeneratedKey } ;
1617use bdk:: miniscript:: Tap ;
17- use bdk:: Error as BDK_Error ;
18- use std:: error:: Error ;
1918use std:: str:: FromStr ;
2019
2120/// This example demonstrates how to generate a mnemonic phrase
2221/// using BDK and use that to generate a descriptor string.
23- fn main ( ) -> Result < ( ) , Box < dyn Error > > {
22+ fn main ( ) -> Result < ( ) , anyhow :: Error > {
2423 let secp = Secp256k1 :: new ( ) ;
2524
2625 // In this example we are generating a 12 words mnemonic phrase
2726 // but it is also possible generate 15, 18, 21 and 24 words
2827 // using their respective `WordCount` variant.
2928 let mnemonic: GeneratedKey < _ , Tap > =
3029 Mnemonic :: generate ( ( WordCount :: Words12 , Language :: English ) )
31- . map_err ( |_| BDK_Error :: Generic ( "Mnemonic generation error" . to_string ( ) ) ) ?;
30+ . map_err ( |_| anyhow ! ( "Mnemonic generation error" ) ) ?;
3231
3332 println ! ( "Mnemonic phrase: {}" , * mnemonic) ;
3433 let mnemonic_with_passphrase = ( mnemonic, None ) ;
0 commit comments