Skip to content

Commit 7c7adf5

Browse files
committed
refactor(signer)!: add signer behind a non-default feature
1 parent b25168a commit 7c7adf5

File tree

3 files changed

+27
-18
lines changed

3 files changed

+27
-18
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ jobs:
4242
matrix:
4343
rust:
4444
- version: stable # STABLE
45-
features: miniscript
4645
- version: 1.63.0 # MSRV
47-
features: miniscript
46+
features:
47+
- miniscript
48+
- signer
4849
emulator:
4950
- name: trezor
5051
- name: ledger
@@ -77,7 +78,7 @@ jobs:
7778
- name: Update toolchain
7879
run: rustup update
7980
- name: Test
80-
run: cargo test --features ${{ matrix.rust.features }}
81+
run: cargo test --features ${{ matrix.features }}
8182
- name: Wipe
8283
run: cargo test test_wipe_device -- --ignored
8384
test-readme-examples:

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,18 @@ readme = "README.md"
1111
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1212

1313
[dependencies]
14-
bdk_wallet = { version = "1.0.0-beta.1" }
1514
bitcoin = { version = "0.32", features = ["serde", "base64"] }
1615
pyo3 = { version = "0.21.2", features = ["auto-initialize"] }
1716
serde = { version = "^1.0", features = ["derive"] }
1817
serde_json = { version = "^1.0" }
1918

19+
bdk_wallet = { version = "1.0.0-beta.1", optional = true }
2020
miniscript = { version = "12.0", features = ["serde"], optional = true }
2121

2222
[dev-dependencies]
2323
serial_test = "0.6.0"
2424

2525
[features]
2626
doctest = []
27+
signer = ["dep:bdk_wallet"]
28+
miniscript = ["dep:miniscript"]

src/lib.rs

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,51 +30,57 @@
3030
//! ```
3131
//!
3232
//! # HWISigner Example:
33-
//! ## Add custom HWI signer to [`bdk_wallet`]
33+
//! ## Add custom [`HWISigner`] to [`Wallet`]
3434
//! ```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>> {
4446
//! let mut devices = HWIClient::enumerate()?;
4547
//! if devices.is_empty() {
4648
//! panic!("No devices found!");
4749
//! }
4850
//! let first_device = devices.remove(0)?;
4951
//! let custom_signer = HWISigner::from_device(&first_device, Network::Testnet.into())?;
5052
//!
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+
//!
5355
//! // Adding the hardware signer to the BDK wallet
5456
//! wallet.add_signer(
5557
//! KeychainKind::External,
5658
//! SignerOrdering(200),
5759
//! Arc::new(custom_signer),
5860
//! );
5961
//!
60-
//! # Ok(())
62+
//! Ok(())
63+
//! }
6164
//! # }
6265
//! ```
6366
//!
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
6569
6670
#[cfg(test)]
6771
#[macro_use]
6872
extern crate serial_test;
6973
extern crate core;
7074

7175
pub use interface::HWIClient;
76+
#[cfg(feature = "signer")]
7277
pub use signer::HWISigner;
7378

7479
#[cfg(feature = "doctest")]
7580
pub mod doctest;
7681
pub mod error;
7782
pub mod interface;
83+
#[cfg(feature = "signer")]
7884
pub mod signer;
7985
pub mod types;
8086

0 commit comments

Comments
 (0)