You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -49,56 +48,112 @@ Mithril Client Library can be used by Rust developers to use the Mithril Network
49
48
50
49
## Installation
51
50
52
-
In your project crate, use `cargo` to add [mithril-client](https://crates.io/crates/mithril-client) as a dependency:
51
+
:::caution
52
+
53
+
Mithril client library has not yet been published on [crates.io](https://crates.io/), so you won't be able to follow the procedure below. The crate will be published soon.
54
+
55
+
For now, you can experiment it by adding the dependency manually in the Cargo.toml of your project:
In your project, use `cargo` to add [mithril-client](https://crates.io/crates/mithril-client) crate as a dependency:
53
64
54
65
```bash
55
66
cargo add mithril-client
56
67
```
57
68
58
-
It will add the latest version of the Mithril client library.
69
+
:::info
59
70
60
-
Mithril client is an asynchronous library. It has been tested with the crate [tokio](https://crates.io/crates/tokio), In the Cargo.toml of your project, add the following dependency:
71
+
Mithril client is an asynchronous library, you will need a runtime to execute your futures. We recommend to use the crate [tokio](https://crates.io/crates/tokio), as the library has been tested with it.
61
72
62
-
```toml
63
-
tokio = { version = "1.32.0", features = ["full"] }
64
-
``````
73
+
:::
65
74
66
-
## Using Mithril Client Library
75
+
## Using Mithril client library
67
76
68
-
If the goal is just to use the existing certificates, it is easier to use the `Client` structure:
77
+
Below is a basic example of how to use most of the functions exposed by the Mithril client library:
Here is an example of the code for the release-preprod network:
113
+
:::info
88
114
89
-
```rust
90
-
usemithril_client::client::Client;
91
-
usemithril_client::common::*;
115
+
Snapshot download and certificate chain validation can take quite some time even with a fast computer and network. We have implemented a feedback mechanism for them, more details on it are available in the [feedback sub-module](https://mithril.network/rust-doc/mithril_client/feedback/index.html).
An example of implementation with the crate [indicatif](https://crates.io/crates/indicatif) is available in the [Mithril repository](https://github.com/input-output-hk/mithril/tree/main/mithril-client/examples/snapshot_list_get_show_download_verify.rs). To run it, execute the following command:
118
+
119
+
```bash
120
+
cargo run --example snapshot_list_get_show_download_verify
121
+
```
122
+
123
+
:::
124
+
125
+
Here is a working example of the code using the configuration parameters of the `release-preprod` network:
97
126
98
-
formithril_stake_distributioninresponse {
99
-
println!("Stake distribution hash = '{}'.", mithril_stake_distribution.hash);
0 commit comments