Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use jsonrpsee_ws_client::WsClientBuilder;
- use std::time::Duration;
- use subxt::ClientBuilder;
- #[subxt::subxt(runtime_metadata_path = "polkadot_metadata.scale")]
- pub mod polkadot {}
- #[async_std::main]
- async fn main() -> Result<(), Box<dyn std::error::Error>> {
- env_logger::init();
- // let connection_timeout_secs = Duration::new(secs: 60, nanos: 0);
- let connection_timeout_duration = Duration::new(600, 0);
- let url = "wss://moonriver.api.onfinality.io:9944/public-ws";
- let client = WsClientBuilder::default()
- .connection_timeout(connection_timeout_duration)
- .build(url)
- .await
- .ok();
- println!("Client established.");
- let client = client.unwrap();
- // let api = ClientBuilder::new()
- // .set_client(client)
- // // .set_url("wss://pub.elara.patract.io:9944/statemine")
- // .build()
- // .await?
- // .to_runtime_api::<polkadot::RuntimeApi<polkadot::DefaultConfig>>();
- // let mut iter = api.storage().system().account_iter(None).await?;
- // while let Some((key, account)) = iter.next().await? {
- // println!("{}: {}", hex::encode(key), account.data.free);
- // }
- Ok(())
- }
Advertisement
Add Comment
Please, Sign In to add comment