-
Notifications
You must be signed in to change notification settings - Fork 97
/
Copy pathclient_config.rs
40 lines (35 loc) · 1.03 KB
/
client_config.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
// Copyright 2021 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
//! cargo run --example client_config --release
//! In this example we will create a client from a JSON config.
use iota_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()?;
let info = client.get_info().await?;
println!("Node Info: {info:?}");
Ok(())
}