diff --git a/.github/workflows/cont_integration.yml b/.github/workflows/cont_integration.yml index f793f7ad6..ef6fc8da1 100644 --- a/.github/workflows/cont_integration.yml +++ b/.github/workflows/cont_integration.yml @@ -130,3 +130,32 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} args: --all-features --all-targets -- -D warnings + + build-examples: + name: Build Examples + runs-on: ubuntu-latest + strategy: + matrix: + example-dir: + - example_cli + - example_bitcoind_rpc_polling + - example_electrum + - example_esplora + - wallet_electrum + - wallet_esplora_async + - wallet_esplora_blocking + - wallet_rpc + steps: + - name: checkout + uses: actions/checkout@v2 + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + profile: minimal + - name: Rust Cache + uses: Swatinem/rust-cache@v2.2.1 + - name: Build + working-directory: example-crates/${{ matrix.example-dir }} + run: cargo build diff --git a/example-crates/example_cli/Cargo.toml b/example-crates/example_cli/Cargo.toml index 9b8c4debb..09f093ebf 100644 --- a/example-crates/example_cli/Cargo.toml +++ b/example-crates/example_cli/Cargo.toml @@ -9,8 +9,10 @@ edition = "2021" bdk_chain = { path = "../../crates/chain", features = ["serde", "miniscript"]} bdk_coin_select = "0.3.0" bdk_file_store = { path = "../../crates/file_store" } +bitcoin = { version = "0.32.0", features = ["base64"], default-features = false } anyhow = "1" clap = { version = "3.2.23", features = ["derive", "env"] } +rand = "0.8" serde = { version = "1", features = ["derive"] } serde_json = "1.0" diff --git a/example-crates/example_cli/src/lib.rs b/example-crates/example_cli/src/lib.rs index ee0c9b376..393f9d3fb 100644 --- a/example-crates/example_cli/src/lib.rs +++ b/example-crates/example_cli/src/lib.rs @@ -10,14 +10,9 @@ use std::sync::Mutex; use anyhow::bail; use anyhow::Context; use bdk_chain::bitcoin::{ - absolute, - address::NetworkUnchecked, - bip32, consensus, constants, - hex::DisplayHex, - relative, - secp256k1::{rand::prelude::*, Secp256k1}, - transaction, Address, Amount, Network, NetworkKind, PrivateKey, Psbt, PublicKey, Sequence, - Transaction, TxIn, TxOut, + absolute, address::NetworkUnchecked, bip32, consensus, constants, hex::DisplayHex, relative, + secp256k1::Secp256k1, transaction, Address, Amount, Network, NetworkKind, PrivateKey, Psbt, + PublicKey, Sequence, Transaction, TxIn, TxOut, }; use bdk_chain::miniscript::{ descriptor::{DescriptorSecretKey, SinglePubKey}, @@ -37,6 +32,7 @@ use bdk_coin_select::{ }; use bdk_file_store::Store; use clap::{Parser, Subcommand}; +use rand::prelude::*; pub use anyhow; pub use clap; @@ -675,7 +671,7 @@ pub fn handle_commands( Ok(()) } PsbtCmd::Sign { psbt, descriptor } => { - let mut psbt = Psbt::from_str(&psbt.unwrap_or_default())?; + let mut psbt = Psbt::from_str(psbt.unwrap_or_default().as_str())?; let desc_str = match descriptor { Some(s) => s, @@ -717,7 +713,7 @@ pub fn handle_commands( chain_specific, psbt, } => { - let mut psbt = Psbt::from_str(&psbt)?; + let mut psbt = Psbt::from_str(psbt.as_str())?; psbt.finalize_mut(&Secp256k1::new()) .map_err(|errors| anyhow::anyhow!("failed to finalize PSBT {errors:?}"))?;