pub async fn command_upload_with_sol(
    arweave: &Arweave,
    glob_str: &str,
    log_dir: Option<String>,
    _tags: Option<Vec<Tag<Base64>>>,
    reward_mult: f32,
    sol_keypair_path: &str,
    output_format: Option<&str>,
    buffer: usize,
) -> CommandResult {
    let paths_iter = glob(glob_str)?.filter_map(Result::ok);
    let log_dir = log_dir.map(|s| PathBuf::from(s));
    let output_format = get_output_format(output_format.unwrap_or(""));
    let solana_url = "https://api.mainnet-beta.solana.com/".parse::<Url>()?;
    let sol_ar_url = SOL_AR_BASE_URL.parse::<Url>()?.join("sol")?;
    let from_keypair = keypair::read_keypair_file(sol_keypair_path)?;

    let price_terms = arweave.get_price_terms(reward_mult).await?;

    let mut stream = upload_files_with_sol_stream(
        arweave,
        paths_iter,
        log_dir.clone(),
        None,
        price_terms,
        solana_url,
        sol_ar_url,
        &from_keypair,
        buffer,
    );

    let mut counter = 0;
    while let Some(result) = stream.next().await {
        match result {
            Ok(status) => {
                if counter == 0 {
                    if let Some(log_dir) = &log_dir {
                        println!("Logging statuses to {}", &log_dir.display());
                    }
                    println!("{}", status.header_string(&output_format));
                }
                print!("{}", output_format.formatted_string(&status));
                counter += 1;
            }
            Err(e) => println!("{:#?}", e),
        }
    }

    if counter == 0 {
        println!("The pattern \"{}\" didn't match any files.", glob_str);
    } else {
        println!(
            "Uploaded {} files. Run `arloader update-status \"{}\" --log-dir \"{}\"` to confirm transaction(s).",
            counter,
            glob_str,
            &log_dir.unwrap_or(PathBuf::from("")).display()
        );
    }

    Ok(())
}
/// Uploads files to Arweave, paying with SOL.
Uploads files to Arweave, paying with SOL.
Uploads files to Arweave paying with SOL .
pub async fn command_upload_with_sol(
    arweave: &Arweave,
    glob_str: &str,
    log_dir: Option<String>,
    _tags: Option<Vec<Tag<Base64>>>,
    reward_mult: f32,
    sol_keypair_path: &str,
    output_format: Option<&str>,
    buffer: usize,
) -> CommandResult {
    let paths_iter = glob(glob_str)?.filter_map(Result::ok);
    let log_dir = log_dir.map(|s| PathBuf::from(s));
    let output_format = get_output_format(output_format.unwrap_or(""));
    let solana_url = "https://api.mainnet-beta.solana.com/".parse::<Url>()?;
    let sol_ar_url = SOL_AR_BASE_URL.parse::<Url>()?.join("sol")?;
    let from_keypair = keypair::read_keypair_file(sol_keypair_path)?;
    let price_terms = arweave.get_price_terms(reward_mult).await?;
    let mut stream = upload_files_with_sol_stream(
        arweave,
        paths_iter,
        log_dir.clone(),
        None,
        price_terms,
        solana_url,
        sol_ar_url,
        &from_keypair,
        buffer,
    );
    let mut counter = 0;
    while let Some(result) = stream.next().await {
        match result {
            Ok(status) => {
                if counter == 0 {
                    if let Some(log_dir) = &log_dir {
                        println!("Logging statuses to {}", &log_dir.display());
                    }
                    println!("{}", status.header_string(&output_format));
                }
                print!("{}", output_format.formatted_string(&status));
                counter += 1;
            }
            Err(e) => println!("{:#?}", e),
        }
    }
    if counter == 0 {
        println!("The pattern \"{}\" didn't match any files.", glob_str);
    } else {
        println!(
            "Uploaded {} files. Run `arloader update-status \"{}\" --log-dir \"{}\"` to confirm transaction(s).",
            counter,
            glob_str,
            &log_dir.unwrap_or(PathBuf::from("")).display()
        );
    }
    Ok(())
}
pub async fn command_upload_with_sol ( arweave : & Arweave , glob_str : & str , log_dir : Option < String > , _tags : Option < Vec < Tag < Base64 > > > , reward_mult : f32 , sol_keypair_path : & str , output_format : Option < & str > , buffer : usize , ) -> CommandResult { let paths_iter = glob ( glob_str ) ? . filter_map ( Result :: ok ) ; let log_dir = log_dir . map ( | s | PathBuf :: from ( s ) ) ; let output_format = get_output_format ( output_format . unwrap_or ( " " ) ) ; let solana_url = " " . parse :: < Url > ( ) ? ; let sol_ar_url = SOL_AR_BASE_URL . parse :: < Url > ( ) ? . join ( " " ) ? ; let from_keypair = keypair :: read_keypair_file ( sol_keypair_path ) ? ; let price_terms = arweave . get_price_terms ( reward_mult ) . await ? ; let mut stream = upload_files_with_sol_stream ( arweave , paths_iter , log_dir . clone ( ) , None , price_terms , solana_url , sol_ar_url , & from_keypair , buffer , ) ; let mut counter = 0 ; while let Some ( result ) = stream . next ( ) . await { match result { Ok ( status ) => { if counter == 0 { if let Some ( log_dir ) = & log_dir { println ! ( " " log_dir display ( ) ) ; } println ! ( " " status header_string ( output_format ) ) ; } print ! ( " " output_format formatted_string ( status ) ) ; counter += 1 ; } Err ( e ) => println ! ( " " e ) , } } if counter == 0 { println ! ( " \" \" " glob_str ) ; } else { println ! ( " \" \" \" \" " counter glob_str log_dir unwrap_or ( PathBuf from ( " " ) ) display ( ) ) ; } Ok ( ( ) ) }
Uploads files to Arweave, paying with SOL.
Uploads files to Arweave paying with SOL .
arweave
&Arweave
glob_str
&str
log_dir
Option<String>
_tags
Option<Vec<Tag<Base64>>>
reward_mult
f32
sol_keypair_path
&str
output_format
Option<&str>
buffer
usize
arweave
&Arweave
glob_str
&str
log_dir
Option<String>
_tags
Option<Vec<Tag<Base64>>>
reward_mult
f32
sol_keypair_path
&str
output_format
Option<&str>
buffer
usize