fn process_list_unspent_outputs(&mut self) {
        if let Some(mut handler2) = self.wallet_output_service.clone() {
            let mut handler1 = self.node_service.clone();

            self.executor.spawn(async move {
                let current_height = match handler1.get_metadata().await {
                    Err(err) => {
                        println!("Failed to retrieve chain metadata: {:?}", err);
                        warn!(target: LOG_TARGET, "Error communicating with base node: {:?}", err);
                        return;
                    },
                    Ok(data) => data.height_of_longest_chain.unwrap() as i64,
                };
                match handler2.get_unspent_outputs().await {
                    Err(e) => {
                        println!("Something went wrong");
                        warn!(target: LOG_TARGET, "Error communicating with wallet: {:?}", e);
                        return;
                    },
                    Ok(unspent_outputs) => {
                        if !unspent_outputs.is_empty() {
                            println!(
                                "\nYou have {} UTXOs: (value, commitment, mature in ? blocks, flags)",
                                unspent_outputs.len()
                            );
                            let factory = PedersenCommitmentFactory::default();
                            for uo in unspent_outputs.iter() {
                                let mature_in = std::cmp::max(uo.features.maturity as i64 - current_height, 0);
                                println!(
                                    "   {}, {}, {:>3}, {:?}",
                                    uo.value,
                                    uo.as_transaction_input(&factory, OutputFeatures::default())
                                        .commitment
                                        .to_hex(),
                                    mature_in,
                                    uo.features.flags
                                );
                            }
                            println!();
                        } else {
                            println!("\nNo valid UTXOs found at this time\n");
                        }
                    },
                };
            });
        } else {
            println!("Cannot complete command, Wallet is disabled");
        }
    }
/// Function to process the list utxos command
Function to process the list utxos command
Function to process the list utxos command
fn process_list_unspent_outputs(&mut self) {
        if let Some(mut handler2) = self.wallet_output_service.clone() {
            let mut handler1 = self.node_service.clone();
            self.executor.spawn(async move {
                let current_height = match handler1.get_metadata().await {
                    Err(err) => {
                        println!("Failed to retrieve chain metadata: {:?}", err);
                        warn!(target: LOG_TARGET, "Error communicating with base node: {:?}", err);
                        return;
                    },
                    Ok(data) => data.height_of_longest_chain.unwrap() as i64,
                };
                match handler2.get_unspent_outputs().await {
                    Err(e) => {
                        println!("Something went wrong");
                        warn!(target: LOG_TARGET, "Error communicating with wallet: {:?}", e);
                        return;
                    },
                    Ok(unspent_outputs) => {
                        if !unspent_outputs.is_empty() {
                            println!(
                                "\nYou have {} UTXOs: (value, commitment, mature in ? blocks, flags)",
                                unspent_outputs.len()
                            );
                            let factory = PedersenCommitmentFactory::default();
                            for uo in unspent_outputs.iter() {
                                let mature_in = std::cmp::max(uo.features.maturity as i64 - current_height, 0);
                                println!(
                                    "   {}, {}, {:>3}, {:?}",
                                    uo.value,
                                    uo.as_transaction_input(&factory, OutputFeatures::default())
                                        .commitment
                                        .to_hex(),
                                    mature_in,
                                    uo.features.flags
                                );
                            }
                            println!();
                        } else {
                            println!("\nNo valid UTXOs found at this time\n");
                        }
                    },
                };
            });
        } else {
            println!("Cannot complete command, Wallet is disabled");
        }
    }
fn process_list_unspent_outputs ( & mut self ) { if let Some ( mut handler2 ) = self . wallet_output_service . clone ( ) { let mut handler1 = self . node_service . clone ( ) ; self . executor . spawn ( async move { let current_height = match handler1 . get_metadata ( ) . await { Err ( err ) => { println ! ( " " err ) ; warn ! ( target LOG_TARGET " " err ) ; return ; } , Ok ( data ) => data . height_of_longest_chain . unwrap ( ) as i64 , } ; match handler2 . get_unspent_outputs ( ) . await { Err ( e ) => { println ! ( " " ) ; warn ! ( target LOG_TARGET " " e ) ; return ; } , Ok ( unspent_outputs ) => { if ! unspent_outputs . is_empty ( ) { println ! ( " \n " unspent_outputs len ( ) ) ; let factory = PedersenCommitmentFactory :: default ( ) ; for uo in unspent_outputs . iter ( ) { let mature_in = std :: cmp :: max ( uo . features . maturity as i64 - current_height , 0 ) ; println ! ( " " uo value uo as_transaction_input ( factory OutputFeatures default ( ) ) commitment to_hex ( ) mature_in uo features flags ) ; } println ! ( ) ; } else { println ! ( " \n \n " ) ; } } , } ; } ) ; } else { println ! ( " " ) ; } }
Function to process the list utxos command
Function to process the list utxos command
&mut self
&mut self