@@ -26,7 +26,6 @@ use bdk::{database::BatchDatabase, wallet::AddressIndex, Error, FeeRate, Keychai
2626
2727use clap:: Parser ;
2828
29-
3029use bdk:: bitcoin:: consensus:: encode:: { deserialize, serialize, serialize_hex} ;
3130#[ cfg( any(
3231 feature = "electrum" ,
@@ -88,9 +87,9 @@ use rustyline::error::ReadlineError;
8887use rustyline:: Editor ;
8988use serde_json:: json;
9089use std:: str:: FromStr ;
91- // Import some modules for payjoin functionality from payjoin crate
90+ // Import some modules for payjoin functionality
9291
93- /// Execute an offline wallet sub-command
92+ // Execute an offline wallet sub-command
9493///
9594/// Offline wallet sub-commands are described in [`OfflineWalletSubCommand`].
9695pub fn handle_offline_wallet_subcommand < D > (
@@ -323,7 +322,11 @@ where
323322 B : Blockchain ,
324323 D : BatchDatabase ,
325324{
326- use bdk:: { signer:: InputSigner , wallet:: tx_builder, SyncOptions } ;
325+ use crate :: bitcoin:: psbt:: Input ;
326+ use bdk:: SyncOptions ;
327+ use payjoin:: PjUriExt ;
328+ use payjoin:: UriExt ;
329+ use std:: convert:: TryFrom ;
327330
328331 match online_subcommand {
329332 Sync => {
@@ -396,6 +399,7 @@ where
396399 Ok ( json ! ( { "spendable" : spendable } ) )
397400 }
398401
402+ #[ cfg( not( feature = "async-interface" ) ) ]
399403 // Payjoin Logic goes here
400404 SendPayjoin { uri } => {
401405 // convert the bip21 uri into a payjoin uri, and handle error if necessary
@@ -406,7 +410,7 @@ where
406410 // ensure uri is payjoin capable
407411 let uri = uri
408412 . check_pj_supported ( )
409- . map_err ( |e| Error :: Generic ( format ! ( "Payjoin not supported: {}" , e) ) ) ?;
413+ . map_err ( |e| Error :: Generic ( format ! ( "Payjoin not supported: {}" , e. to_string ( ) ) ) ) ?;
410414
411415 // ensure amount of satoshis is specified in uri, handle error if not
412416 let sats = match uri. amount {
@@ -483,7 +487,7 @@ where
483487 // get original inputs from original psbt clone (ocean_psbt)
484488 let mut original_inputs = input_pairs ( & mut ocean_psbt) . peekable ( ) ;
485489
486- for ( proposed_txin, mut proposed_psbtin) in input_pairs ( & mut payjoin_psbt) {
490+ for ( proposed_txin, proposed_psbtin) in input_pairs ( & mut payjoin_psbt) {
487491 if let Some ( ( original_txin, original_psbtin) ) = original_inputs. peek ( ) {
488492 if proposed_txin. previous_output == original_txin. previous_output {
489493 proposed_psbtin. witness_utxo = original_psbtin. witness_utxo . clone ( ) ;
0 commit comments