mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 10:57:56 +00:00
Display warning on try-runtime spec_name mismatch (#9593)
* Display warning on try-runtime version mismatch * detect spec-name mismatch in try-runtime * Update utils/frame/try-runtime/cli/src/lib.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update utils/frame/try-runtime/cli/src/lib.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update utils/frame/remote-externalities/src/rpc_api.rs Co-authored-by: Chevdor <chevdor@users.noreply.github.com> * remove unused import Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Chevdor <chevdor@users.noreply.github.com>
This commit is contained in:
@@ -88,3 +88,24 @@ async fn build_client<S: AsRef<str>>(from: S) -> Result<WsClient, String> {
|
||||
.await
|
||||
.map_err(|e| format!("`WsClientBuilder` failed to build: {:?}", e))
|
||||
}
|
||||
|
||||
/// Get the runtime version of a given chain.
|
||||
pub async fn get_runtime_version<Block, S>(
|
||||
from: S,
|
||||
at: Option<Block::Hash>,
|
||||
) -> Result<sp_version::RuntimeVersion, String>
|
||||
where
|
||||
S: AsRef<str>,
|
||||
Block: BlockT + serde::de::DeserializeOwned,
|
||||
Block::Header: HeaderT,
|
||||
{
|
||||
let params = if let Some(at) = at { vec![hash_to_json::<Block>(at)?] } else { vec![] };
|
||||
let client = build_client(from).await?;
|
||||
client
|
||||
.request::<sp_version::RuntimeVersion>(
|
||||
"state_getRuntimeVersion",
|
||||
JsonRpcParams::Array(params),
|
||||
)
|
||||
.await
|
||||
.map_err(|e| format!("state_getRuntimeVersion request failed: {:?}", e))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user