diff --git a/CHANGELOG.md b/CHANGELOG.md index 3491cb6dc59..97963ec6792 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Added + +- Add `system_chain_type()` RPC method to `LegacyRpcMethods` + ## [0.44.0] - 2025-08-28 This small release primarily fixes a few issues, but also adds the code for a prelease of `subxt-historic`, a new crate (at the moment) for working with historic blocks and state. Future releases will aim to stabilize this crate to the level of other `subxt` crates or otherwise merge the logic into `subxt` itself. diff --git a/rpcs/src/methods/legacy.rs b/rpcs/src/methods/legacy.rs index a28aff728fe..b7844f3ff7d 100644 --- a/rpcs/src/methods/legacy.rs +++ b/rpcs/src/methods/legacy.rs @@ -126,6 +126,11 @@ impl LegacyRpcMethods { self.client.request("system_version", rpc_params![]).await } + /// Fetch system chain type + pub async fn system_chain_type(&self) -> Result { + self.client.request("system_chainType", rpc_params![]).await + } + /// Fetch system properties pub async fn system_properties(&self) -> Result { self.client diff --git a/testing/integration-tests/src/full_client/client/legacy_rpcs.rs b/testing/integration-tests/src/full_client/client/legacy_rpcs.rs index 77a2bf5487e..b00e4d5d7ed 100644 --- a/testing/integration-tests/src/full_client/client/legacy_rpcs.rs +++ b/testing/integration-tests/src/full_client/client/legacy_rpcs.rs @@ -118,6 +118,15 @@ async fn system_version() { let _ = rpc.system_version().await.unwrap(); } +#[subxt_test] +async fn system_chain_type() { + let ctx = test_context().await; + let rpc = ctx.legacy_rpc_methods().await; + + let chain_type = rpc.system_chain_type().await.unwrap(); + assert_eq!(chain_type, "Development"); +} + #[subxt_test] async fn system_properties() { let ctx = test_context().await;