mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 17:01:09 +00:00
@@ -166,10 +166,29 @@ async fn light_client_testing() -> Result<(), subxt::Error> {
|
||||
tracing_subscriber::fmt::init();
|
||||
let now = std::time::Instant::now();
|
||||
|
||||
println!("Init lightclient");
|
||||
// let chainspec = subxt::utils::fetch_chainspec_from_rpc_node("wss://rpc.polkadot.io:443")
|
||||
|
||||
// let chainspec = subxt::utils::fetch_chainspec_from_rpc_node("ws://127.0.0.1:9944")
|
||||
// .await
|
||||
// .unwrap();
|
||||
// println!("Fetch spec took {:?}\n", now.elapsed());
|
||||
// let bootnode = format!(
|
||||
// "/ip4/127.0.0.1/tcp/30333/p2p/12D3KooWHdiAxVd8uMQR1hGWXccidmfCwLqcMpGwR6QcTP6QRMuD",
|
||||
// );
|
||||
// let chain_config = subxt::lightclient::ChainConfig::chain_spec(chainspec.get())
|
||||
// .set_bootnodes([bootnode.as_str()])
|
||||
// .map_err(|e| format!("Light client: cannot update boot nodes: {e}"))?;
|
||||
|
||||
let chainspec = subxt::utils::fetch_chainspec_from_rpc_node("wss://rpc.polkadot.io:443")
|
||||
.await
|
||||
.unwrap();
|
||||
let (_lc, rpc) = LightClient::relay_chain(chainspec.get())?;
|
||||
|
||||
println!("Chain Spec: {:?}", chainspec);
|
||||
|
||||
let chain_config = chainspec.get();
|
||||
|
||||
let (_lc, rpc) = LightClient::relay_chain(chain_config)?;
|
||||
let api = Client::from_rpc_client(rpc).await?;
|
||||
|
||||
println!("Light client initialization took {:?}\n", now.elapsed());
|
||||
|
||||
Reference in New Issue
Block a user