Support v16 metadata and use it by default if it's available (#1999)

* Support v16 metadata and use it by default if it's available

* lockfile

* fix blocks test; new transaction extension in kitchensink runtime

* Bump scale-typegen to 0.11.1 to cater for Duration prelude type

* fmt

* Fix no-std test building

* Cargo update and bump substrate deps

* Update test and no-std deps

* fmt

* fix test
This commit is contained in:
James Wilson
2025-05-08 14:44:44 +01:00
committed by GitHub
parent 4524590821
commit 9ba89e3ed7
16 changed files with 1674 additions and 1223 deletions
+7 -8
View File
@@ -195,15 +195,14 @@ impl<T: Config> OnlineClient<T> {
backend: &dyn Backend<T>,
block_hash: HashFor<T>,
) -> Result<Metadata, Error> {
// This is the latest stable metadata that subxt can utilize.
const V15_METADATA_VERSION: u32 = 15;
// The metadata versions we support in Subxt, from newest to oldest.
use subxt_metadata::SUPPORTED_METADATA_VERSIONS;
// Try to fetch the metadata version.
if let Ok(bytes) = backend
.metadata_at_version(V15_METADATA_VERSION, block_hash)
.await
{
return Ok(bytes);
// Try to fetch each version that we support in order from newest to oldest.
for version in SUPPORTED_METADATA_VERSIONS {
if let Ok(bytes) = backend.metadata_at_version(version, block_hash).await {
return Ok(bytes);
}
}
// If that fails, fetch the metadata V14 using the old API.