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
// Copyright 2021 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
//! In this example we will create a client from a JSON config.
//!
//! Rename `.env.example` to `.env` first, then run the command:
//! ```sh
//! cargo run --release --example client_config
//! ```
use iota_sdk::client::{Client, Result};
#[tokio::main]
async fn main() -> Result<()> {
// Create a client instance
let client = Client::builder()
.from_json(
r#"{
"nodes":[
{
"url":"http://localhost:14265/",
"auth":null,
"disabled":false
},
{
"url":"https://api.testnet.shimmer.network",
"auth":null,
"disabled":false
}
],
"localPow":true,
"apiTimeout":{
"secs":20,
"nanos":0
}
}"#,
)?
.finish()
.await?;
let info = client.get_info().await?;
println!("{info:#?}");
Ok(())
}