From 17911cece18ee2a2edd21b1dec62fb0356a6f80f Mon Sep 17 00:00:00 2001 From: willowens14 Date: Mon, 28 Aug 2023 15:29:32 -0500 Subject: [PATCH] added psbt::input crate --- .github/workflows/cont_integration.yml | 1 + Cargo.toml | 3 +-- README.md | 3 +++ src/commands.rs | 1 + src/handlers.rs | 16 ++++++++++------ 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cont_integration.yml b/.github/workflows/cont_integration.yml index 94b14b2..2695e3b 100644 --- a/.github/workflows/cont_integration.yml +++ b/.github/workflows/cont_integration.yml @@ -61,6 +61,7 @@ jobs: cargo update -p flate2 --precise 1.0.26 cargo update -p reqwest --precise "0.11.18" cargo update -p h2 --precise "0.3.20" + cargo update -p rustls --precise "0.20.8" - name: Build run: cargo build --no-default-features --features repl,${{ matrix.features }} diff --git a/Cargo.toml b/Cargo.toml index 3109f30..1d15bb3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,6 @@ readme = "README.md" license = "MIT" [dependencies] -# right here set path bdk = { version = "0.27.1", default-features = false, features = ["all-keys"] } bdk-macros = "0.6" clap = { version = "3.2.22", features = ["derive"] } @@ -25,7 +24,7 @@ base64 = "^0.13" # payjoin dependencies payjoin = { version = "=0.8.2", features = ["send"] } # reqwest -reqwest = { version = "0.11.4", features = ["blocking"] } +reqwest = { version = "0.10.10", features = ["blocking"] } diff --git a/README.md b/README.md index abd33b8..0349504 100644 --- a/README.md +++ b/README.md @@ -143,6 +143,9 @@ cargo update -p flate2 --precise 1.0.26 cargo update -p reqwest --precise "0.11.18" # h2 0.3.21 has MSRV 1.63.0+ cargo update -p h2 --precise "0.3.20" +# rustls 0.20.9 has MSRV 1.60.0+ +cargo update -p rustls --precise "0.20.8" + ``` ## Resources diff --git a/src/commands.rs b/src/commands.rs index 981488e..e391b12 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -527,6 +527,7 @@ pub enum OnlineWalletSubCommand { #[clap(name = "CONFIRMATIONS", long = "confirmations", default_value = "6")] confirmations: u32, }, + #[cfg(not(feature = "async-interface"))] /// Sends a Payjoin Transaction. Takes a valid payjoin bip21 uri. SendPayjoin { /// Sets the bip21 uri to send to. diff --git a/src/handlers.rs b/src/handlers.rs index e8b359a..2582366 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -26,7 +26,6 @@ use bdk::{database::BatchDatabase, wallet::AddressIndex, Error, FeeRate, Keychai use clap::Parser; - use bdk::bitcoin::consensus::encode::{deserialize, serialize, serialize_hex}; #[cfg(any( feature = "electrum", @@ -88,9 +87,9 @@ use rustyline::error::ReadlineError; use rustyline::Editor; use serde_json::json; use std::str::FromStr; -// Import some modules for payjoin functionality from payjoin crate +// Import some modules for payjoin functionality -/// Execute an offline wallet sub-command +// Execute an offline wallet sub-command /// /// Offline wallet sub-commands are described in [`OfflineWalletSubCommand`]. pub fn handle_offline_wallet_subcommand( @@ -323,7 +322,11 @@ where B: Blockchain, D: BatchDatabase, { - use bdk::{signer::InputSigner, wallet::tx_builder, SyncOptions}; + use crate::bitcoin::psbt::Input; + use bdk::SyncOptions; + use payjoin::PjUriExt; + use payjoin::UriExt; + use std::convert::TryFrom; match online_subcommand { Sync => { @@ -396,6 +399,7 @@ where Ok(json!({ "spendable": spendable })) } + #[cfg(not(feature = "async-interface"))] // Payjoin Logic goes here SendPayjoin { uri } => { // convert the bip21 uri into a payjoin uri, and handle error if necessary @@ -406,7 +410,7 @@ where // ensure uri is payjoin capable let uri = uri .check_pj_supported() - .map_err(|e| Error::Generic(format!("Payjoin not supported: {}", e)))?; + .map_err(|e| Error::Generic(format!("Payjoin not supported: {}", e.to_string())))?; // ensure amount of satoshis is specified in uri, handle error if not let sats = match uri.amount { @@ -483,7 +487,7 @@ where // get original inputs from original psbt clone (ocean_psbt) let mut original_inputs = input_pairs(&mut ocean_psbt).peekable(); - for (proposed_txin, mut proposed_psbtin) in input_pairs(&mut payjoin_psbt) { + for (proposed_txin, proposed_psbtin) in input_pairs(&mut payjoin_psbt) { if let Some((original_txin, original_psbtin)) = original_inputs.peek() { if proposed_txin.previous_output == original_txin.previous_output { proposed_psbtin.witness_utxo = original_psbtin.witness_utxo.clone();