-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
150 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
extern crate web3; | ||
|
||
use web3::futures::Future; | ||
use web3::types::{TransactionRequest, U256}; | ||
|
||
fn main() { | ||
let (_eloop, transport) = web3::transports::Http::new("http://localhost:8545").unwrap(); | ||
|
||
let web3 = web3::Web3::new(transport); | ||
let accounts = web3.eth().accounts().wait().unwrap(); | ||
|
||
let balance_before = web3.eth().balance(accounts[1], None).wait().unwrap(); | ||
|
||
let tx = TransactionRequest { | ||
from: accounts[0], | ||
to: Some(accounts[1]), | ||
gas: None, | ||
gas_price: None, | ||
value: Some(U256::from(10000)), | ||
data: None, | ||
nonce: None, | ||
condition: None | ||
}; | ||
|
||
let tx_hash = web3.eth().send_transaction(tx).wait().unwrap(); | ||
|
||
let balance_after = web3.eth().balance(accounts[1], None).wait().unwrap(); | ||
|
||
println!("TX Hash: {:?}", tx_hash); | ||
println!("Balance before: {}", balance_before); | ||
println!("Balance after: {}", balance_after); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters