fn process_send_tari<'a, I: Iterator<Item = &'a str>>(&mut self, mut args: I) {
        if let Some(wallet_transaction_service) = self.wallet_transaction_service.clone() {
            let amount = args.next().and_then(|v| MicroTari::from_str(v).ok());
            if amount.is_none() {
                println!("Please enter a valid amount of tari");
                return;
            }
            let amount: MicroTari = amount.unwrap();

            let key = match args.next() {
                Some(k) => k.to_string(),
                None => {
                    println!("Command entered incorrectly, please use the following format: ");
                    println!(
                        "send_tari [amount of tari to send] [public key or emoji id to send to] [optional message]"
                    );
                    return;
                },
            };

            let dest_pubkey = match parse_emoji_id_or_public_key(&key) {
                Some(v) => v,
                None => {
                    println!("Please enter a valid destination public key or emoji id");
                    return;
                },
            };

            // Use the rest of the command line as the message
            let msg = args.collect::<Vec<&str>>().join(" ");

            self.executor.spawn(async move {
                send_tari(amount, dest_pubkey.clone(), msg.clone(), wallet_transaction_service).await;
            });
        } else {
            println!("Cannot complete command, Wallet is disabled");
        }
    }
/// Function to process the send transaction command
Function to process the send transaction command
Function to process the send transaction command
fn process_send_tari<'a, I: Iterator<Item = &'a str>>(&mut self, mut args: I) {
        if let Some(wallet_transaction_service) = self.wallet_transaction_service.clone() {
            let amount = args.next().and_then(|v| MicroTari::from_str(v).ok());
            if amount.is_none() {
                println!("Please enter a valid amount of tari");
                return;
            }
            let amount: MicroTari = amount.unwrap();
            let key = match args.next() {
                Some(k) => k.to_string(),
                None => {
                    println!("Command entered incorrectly, please use the following format: ");
                    println!(
                        "send_tari [amount of tari to send] [public key or emoji id to send to] [optional message]"
                    );
                    return;
                },
            };
            let dest_pubkey = match parse_emoji_id_or_public_key(&key) {
                Some(v) => v,
                None => {
                    println!("Please enter a valid destination public key or emoji id");
                    return;
                },
            };
            // Use the rest of the command line as the message
            let msg = args.collect::<Vec<&str>>().join(" ");
            self.executor.spawn(async move {
                send_tari(amount, dest_pubkey.clone(), msg.clone(), wallet_transaction_service).await;
            });
        } else {
            println!("Cannot complete command, Wallet is disabled");
        }
    }
fn process_send_tari < ' a , I : Iterator < Item = & ' a str > > ( & mut self , mut args : I ) { if let Some ( wallet_transaction_service ) = self . wallet_transaction_service . clone ( ) { let amount = args . next ( ) . and_then ( | v | MicroTari :: from_str ( v ) . ok ( ) ) ; if amount . is_none ( ) { println ! ( " " ) ; return ; } let amount : MicroTari = amount . unwrap ( ) ; let key = match args . next ( ) { Some ( k ) => k . to_string ( ) , None => { println ! ( " " ) ; println ! ( " " ) ; return ; } , } ; let dest_pubkey = match parse_emoji_id_or_public_key ( & key ) { Some ( v ) => v , None => { println ! ( " " ) ; return ; } , } ; // Use the rest of the command line as the message let msg = args . collect :: < Vec < & str > > ( ) . join ( " " ) ; self . executor . spawn ( async move { send_tari ( amount , dest_pubkey . clone ( ) , msg . clone ( ) , wallet_transaction_service ) . await ; } ) ; } else { println ! ( " " ) ; } }
Function to process the send transaction command
Function to process the send transaction command
&mut self
args
I
&mut self
args
I