arloader icon indicating copy to clipboard operation
arloader copied to clipboard

Cannot create w2w transaction

Open ghost opened this issue 3 years ago • 0 comments

I'm trying to create an data-empty transaction with target and quantity other than 0, a wallet 2 wallet transaction. Is this even supported? Is there a way of doing this?

Here is my attempt:

async fn main() {
    let path = PathBuf::from_str("wallet.json").unwrap();
    let arweave = 
        Arweave::from_keypair_path(path, Url::from_str("https://arweave.net").unwrap())
        .await
        .unwrap();
    
    let price_terms = arweave
        .get_price_terms(1.0)
        .await
        .unwrap();
    println!("{:?}", price_terms);
    
    let mut tx = arweave.create_transaction(vec![10], None, None, price_terms, false).await.unwrap();
    tx.target = Base64::from_str("PAgdonEn9f5xd-UbYdCX40Sj28eltQVnxz6bbUijeVY").unwrap();
    tx.quantity = 100000;
    dbg!(json!(&tx));


    let sig_tx = arweave
        .sign_transaction(tx)
        .unwrap();

    dbg!(json!(&sig_tx));
    
    let res = arweave
        .post_transaction(&sig_tx)
        .await;

    dbg!(res);
}

Apparently, the merkle generated when the target is present and quantity is different from zero is not being generated correctly.

ghost avatar Sep 19 '22 13:09 ghost