|
1 | 1 | # Waves |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
2 | 6 | A Rust interface to the Waves blockchain |
3 | 7 |
|
4 | 8 | # Usage |
5 | 9 | ```rust |
6 | | -extern crate base58; |
7 | | -extern crate waves; |
8 | | - |
9 | 10 | use base58::*; |
10 | 11 | use std::time::{SystemTime, UNIX_EPOCH}; |
11 | | -use waves::account::{PrivateKeyAccount, TESTNET}; |
12 | | -use waves::transaction::*; |
| 12 | +use wavesplatform::account::{PrivateKeyAccount, TESTNET}; |
| 13 | +use wavesplatform::seed::*; |
| 14 | +use wavesplatform::transaction::*; |
13 | 15 |
|
14 | 16 | fn main() { |
15 | | - let account = PrivateKeyAccount::from_seed("seed"); |
16 | | - println!("my address: {}", account.public_key().to_address(TESTNET).to_string()); |
| 17 | + let phrase = generate_phrase(); |
| 18 | + let account = PrivateKeyAccount::from_seed(phrase); |
| 19 | + println!("My TESTNET address: {}", account.public_key().to_address(TESTNET).to_string()); |
17 | 20 |
|
18 | 21 | let ts = SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs() * 1000; |
19 | 22 | let tx = Transaction::new_alias(&account.public_key(), "rhino", TESTNET, 100000, ts); |
20 | | - println!("id is {}", tx.id().to_string()); |
| 23 | + println!("ID is {}", tx.id().to_string()); |
21 | 24 | let ptx = account.sign_transaction(tx); |
22 | | - println!("proofs are {:?}", ptx.proofs.iter().map(|p| p.to_base58()).collect::<Vec<String>>()); |
| 25 | + println!("Proofs are {:?}", ptx.proofs.iter().map(|p| p.to_base58()).collect::<Vec<String>>()); |
23 | 26 | } |
24 | | -``` |
| 27 | +``` |
0 commit comments