To query Polkadot node with subxt this is the code I used and that works fine.
use subxt::{OnlineClient, SubstrateConfig};
#[subxt::subxt(runtime_metadata_path = "metadata.scale")]
pub mod runtime {}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let api = OnlineClient::<SubstrateConfig>::from_url("wss://rpc.polkadot.io:443").await?;
let address = runtime::constants().balances().existential_deposit();
let existential_deposit = api.constants().at(&address)?;
println!("Existential Deposit: {}", existential_deposit);
Ok(())
}
The metadata should be the same for common pallets and I used local Astar dev node to fetch metadata with:
subxt metadata -f bytes > metadata.scale
However, when I change rpc url to connect to Kusama, Shiden or Astar I get rpc timeout.
OnlineClient::<SubstrateConfig>::from_url("wss://kusama-rpc.polkadot.io:433").await?;
Error printout:
Error: Rpc(RpcError("Networking or low-level protocol error: Connection timeout exceeded: 10s"))
What is it that I'm doing wrong?