|
30 | 30 | //! ``` |
31 | 31 | //! |
32 | 32 | //! # HWISigner Example: |
33 | | -//! ## Add custom HWI signer to [`bdk_wallet`] |
| 33 | +//! ## Add custom [`HWISigner`] to [`Wallet`] |
34 | 34 | //! ```no_run |
35 | | -//! # use bdk_wallet::bitcoin::Network; |
36 | | -//! # use bdk_wallet::descriptor::Descriptor; |
37 | | -//! # use bdk_wallet::signer::SignerOrdering; |
38 | | -//! # use hwi::{HWIClient, HWISigner}; |
39 | | -//! # use bdk_wallet::{KeychainKind, SignOptions, Wallet}; |
40 | | -//! # use std::sync::Arc; |
41 | | -//! # use std::str::FromStr; |
42 | | -//! # |
43 | | -//! # fn main() -> Result<(), Box<dyn std::error::Error>> { |
| 35 | +//! # #[cfg(feature = "signer")] |
| 36 | +//! # { |
| 37 | +//! use bdk_wallet::bitcoin::Network; |
| 38 | +//! use bdk_wallet::descriptor::Descriptor; |
| 39 | +//! use bdk_wallet::signer::SignerOrdering; |
| 40 | +//! use bdk_wallet::{KeychainKind, SignOptions, Wallet}; |
| 41 | +//! use hwi::{HWIClient, HWISigner}; |
| 42 | +//! use std::sync::Arc; |
| 43 | +//! use std::str::FromStr; |
| 44 | +//! |
| 45 | +//! fn main() -> Result<(), Box<dyn std::error::Error>> { |
44 | 46 | //! let mut devices = HWIClient::enumerate()?; |
45 | 47 | //! if devices.is_empty() { |
46 | 48 | //! panic!("No devices found!"); |
47 | 49 | //! } |
48 | 50 | //! let first_device = devices.remove(0)?; |
49 | 51 | //! let custom_signer = HWISigner::from_device(&first_device, Network::Testnet.into())?; |
50 | 52 | //! |
51 | | -//! # let mut wallet = Wallet::create("", "").network(Network::Testnet).create_wallet_no_persist()?; |
52 | | -//! # |
| 53 | +//! let mut wallet = Wallet::create("", "").network(Network::Testnet).create_wallet_no_persist()?; |
| 54 | +//! |
53 | 55 | //! // Adding the hardware signer to the BDK wallet |
54 | 56 | //! wallet.add_signer( |
55 | 57 | //! KeychainKind::External, |
56 | 58 | //! SignerOrdering(200), |
57 | 59 | //! Arc::new(custom_signer), |
58 | 60 | //! ); |
59 | 61 | //! |
60 | | -//! # Ok(()) |
| 62 | +//! Ok(()) |
| 63 | +//! } |
61 | 64 | //! # } |
62 | 65 | //! ``` |
63 | 66 | //! |
64 | | -//! [`TransactionSigner`]: bdk_wallet::signer::TransactionSigner |
| 67 | +//! [`TransactionSigner`]: https://docs.rs/bdk_wallet/latest/bdk_wallet/signer/trait.TransactionSigner.html |
| 68 | +//! [`Wallet`]: https://docs.rs/bdk_wallet/1.0.0-beta.1/bdk_wallet/struct.Wallet.html |
65 | 69 |
|
66 | 70 | #[cfg(test)] |
67 | 71 | #[macro_use] |
68 | 72 | extern crate serial_test; |
69 | 73 | extern crate core; |
70 | 74 |
|
71 | 75 | pub use interface::HWIClient; |
| 76 | +#[cfg(feature = "signer")] |
72 | 77 | pub use signer::HWISigner; |
73 | 78 |
|
74 | 79 | #[cfg(feature = "doctest")] |
75 | 80 | pub mod doctest; |
76 | 81 | pub mod error; |
77 | 82 | pub mod interface; |
| 83 | +#[cfg(feature = "signer")] |
78 | 84 | pub mod signer; |
79 | 85 | pub mod types; |
80 | 86 |
|
|
0 commit comments