forked from Guilospanck/murray-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
blockchain.rs
68 lines (53 loc) · 2.22 KB
/
blockchain.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
use murray_rs::{
BlockchainError, GetAddressParams, GetBlockParams, GetTransactionParams, Murray, PostTransactionParams
};
fn blockchain_example() -> std::result::Result<(), BlockchainError> {
let murray = Murray::default();
let a = murray.blockchain.get_block(GetBlockParams {
hash: None,
height: Some(500000),
})?;
println!("{:?}\n", a);
let b = murray.blockchain.get_block2time(GetBlockParams {
hash: None,
height: Some(500000),
})?;
println!("{:?}\n", b);
let c = murray.blockchain.get_fees_recommended()?;
println!("{:?}\n", c);
let d = murray.blockchain.get_fees_mempool_blocks()?;
println!("{:?}\n", d);
let e = murray.blockchain.get_address_details(GetAddressParams {
address: "1F1tAaz5x1HUXrCNLbtMDqcw6o5GNn4xqX".to_string(),
})?;
println!("{:?}\n", e);
let f = murray
.blockchain
.get_address_transactions(GetAddressParams {
address: "3Brz916o2Ng2s6iYT9bgCpAxTRqd9b3GGW".to_string(),
})?;
println!("{:?}\n", f);
let g = murray.blockchain.get_address_utxos(GetAddressParams {
address: "3Brz916o2Ng2s6iYT9bgCpAxTRqd9b3GGW".to_string(),
})?;
println!("{:?}\n", g);
let h = murray.blockchain.get_hashrate()?;
println!("{:?}\n", h);
let i = murray.blockchain.get_health()?;
println!("{:?}\n", i);
let j = murray.blockchain.get_mempool()?;
println!("{:?}\n", j);
let k = murray.blockchain.get_transaction(GetTransactionParams {
txid: "15e10745f15593a899cef391191bdd3d7c12412cc4696b7bcb669d0feadc8521".to_string(),
})?;
println!("{:?}\n", k);
let tx_hex = "0200000001fd5b5fcd1cb066c27cfc9fda5428b9be850b81ac440ea51f1ddba2f987189ac1010000008a4730440220686a40e9d2dbffeab4ca1ff66341d06a17806767f12a1fc4f55740a7af24c6b5022049dd3c9a85ac6c51fecd5f4baff7782a518781bbdd94453c8383755e24ba755c01410436d554adf4a3eb03a317c77aa4020a7bba62999df633bba0ea8f83f48b9e01b0861d3b3c796840f982ee6b14c3c4b7ad04fcfcc3774f81bff9aaf52a15751fedfdffffff02416c00000000000017a914bc791b2afdfe1e1b5650864a9297b20d74c61f4787d71d0000000000001976a9140a59837ccd4df25adc31cdad39be6a8d97557ed688ac00000000".to_owned();
let l = murray
.blockchain
.post_transaction(PostTransactionParams { tx_hex })?;
println!("{:?}\n", l);
Ok(())
}
fn main() {
let _ = blockchain_example();
}