use std::str::FromStr;
use web3::{
ethabi::ethereum_types::U256,
types::{Address, TransactionRequest},
};
#[tokio::main]
async fn main() -> web3::Result {
let transport = web3::transports::Http::new("http://localhost:7545")?;
let web3 = web3::Web3::new(transport);
let from = Address::from_str("0xC48ad5fd060e1400a41bcf51db755251AD5A2475").unwrap();
let to = Address::from_str("0xCd550E94040cEC1b33589eB99B0E1241Baa75D19").unwrap();
let tx_object = TransactionRequest {
from,
to: Some(to),
value: Some(U256::exp10(17)), ..Default::default()
};
let result = web3.eth().send_transaction(tx_object).await?;
println!("Tx succeeded with hash: {}", result);
Ok(())
}