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
69
70
71
72
73
74
75
76
77
//! ABCI framework for building [Tendermint] applications in Rust.
//!
//! [Tendermint]: https://tendermint.com
//!
//! ## Example
//!
//! The following example is adapted from our integration test suite to
//! demonstrate how to instantiate an ABCI application, server and client and
//! have them interact. In practice, the client interaction will be performed
//! by a full Tendermint node.
//!
//! ```rust
//! use tendermint_abci::{KeyValueStoreApp, ServerBuilder, ClientBuilder};
//! use tendermint_proto::abci::{RequestEcho, RequestDeliverTx, RequestQuery};
//!
//! // Create our key/value store application
//! let (app, driver) = KeyValueStoreApp::new();
//! // Create our server, binding it to TCP port 26658 on localhost and
//! // supplying it with our key/value store application
//! let server = ServerBuilder::default().bind("127.0.0.1:26658", app).unwrap();
//! let server_addr = server.local_addr();
//!
//! // We want the driver and the server to run in the background while we
//! // interact with them via the client in the foreground
//! std::thread::spawn(move || driver.run());
//! std::thread::spawn(move || server.listen());
//!
//! let mut client = ClientBuilder::default().connect(server_addr).unwrap();
//! let res = client
//! .echo(RequestEcho {
//! message: "Hello ABCI!".to_string(),
//! })
//! .unwrap();
//! assert_eq!(res.message, "Hello ABCI!");
//!
//! // Deliver a transaction and then commit the transaction
//! client
//! .deliver_tx(RequestDeliverTx {
//! tx: "test-key=test-value".as_bytes().to_owned(),
//! })
//! .unwrap();
//! client.commit().unwrap();
//!
//! // We should be able to query for the data we just delivered above
//! let res = client
//! .query(RequestQuery {
//! data: "test-key".as_bytes().to_owned(),
//! path: "".to_string(),
//! height: 0,
//! prove: false,
//! })
//! .unwrap();
//! assert_eq!(res.value, "test-value".as_bytes().to_owned());
//! ```
// Re-exported
pub use Result;
// Common exports
pub use Application;
pub use ;
pub use Error;
pub use ;
// Example applications
pub use EchoApp;
pub use ;