diff --git a/Cargo.toml b/Cargo.toml index ca36ea9297..82ae63559a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,6 +5,7 @@ members = [ "codegen", "examples", "macro", + "metadata", "subxt", "test-runtime" ] diff --git a/RELEASING.md b/RELEASING.md index 9399b308d8..b8a0ec42d7 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -67,7 +67,8 @@ We also assume that ongoing work done is being merged directly to the `master` b a little time in between each to let crates.io catch up with what we've published). ``` - (cd codegen && cargo publish) && \ + (cd metadata && cargo publish) && \ + (cd codegen && cargo publish) && \ sleep 10 && \ (cd macro && cargo publish) && \ sleep 10 && \ diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 5bd11622a0..6e8db8ff3a 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -17,6 +17,10 @@ path = "src/main.rs" [dependencies] # perform subxt codegen subxt-codegen = { version = "0.20.0", path = "../codegen" } +# perform node compatibility +subxt-metadata = { version = "0.20.0", path = "../metadata" } +# information of portable registry +scale-info = "2.0.0" # parse command line args structopt = "0.3.25" # make the request to a substrate node to get the metadata diff --git a/cli/src/main.rs b/cli/src/main.rs index 465755b573..bffdfde52d 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -18,12 +18,22 @@ use color_eyre::eyre::{ self, WrapErr, }; -use frame_metadata::RuntimeMetadataPrefixed; +use frame_metadata::{ + RuntimeMetadata, + RuntimeMetadataPrefixed, + RuntimeMetadataV14, + META_RESERVED, +}; use scale::{ Decode, Input, }; +use serde::{ + Deserialize, + Serialize, +}; use std::{ + collections::HashMap, fs, io::{ self, @@ -34,6 +44,10 @@ use std::{ }; use structopt::StructOpt; use subxt_codegen::GeneratedTypeDerives; +use subxt_metadata::{ + get_metadata_hash, + get_pallet_hash, +}; /// Utilities for working with substrate metadata for subxt. #[derive(Debug, StructOpt)] @@ -75,6 +89,18 @@ enum Command { #[structopt(long = "derive")] derives: Vec, }, + /// Verify metadata compatibility between substrate nodes. + Compatibility { + /// Urls of the substrate nodes to verify for metadata compatibility. + #[structopt(name = "nodes", long, use_delimiter = true, parse(try_from_str))] + nodes: Vec, + /// Check the compatibility of metadata for a particular pallet. + /// + /// ### Note + /// The validation will omit the full metadata check and focus instead on the pallet. + #[structopt(long, parse(try_from_str))] + pallet: Option, + }, } fn main() -> color_eyre::Result<()> { @@ -126,6 +152,105 @@ fn main() -> color_eyre::Result<()> { codegen(&mut &bytes[..], derives)?; Ok(()) } + Command::Compatibility { nodes, pallet } => { + match pallet { + Some(pallet) => handle_pallet_metadata(nodes.as_slice(), pallet.as_str()), + None => handle_full_metadata(nodes.as_slice()), + } + } + } +} + +fn handle_pallet_metadata(nodes: &[url::Url], name: &str) -> color_eyre::Result<()> { + #[derive(Serialize, Deserialize, Default)] + #[serde(rename_all = "camelCase")] + struct CompatibilityPallet { + pallet_present: HashMap>, + pallet_not_found: Vec, + } + + let mut compatibility: CompatibilityPallet = Default::default(); + for node in nodes.iter() { + let metadata = fetch_runtime_metadata(node)?; + + match metadata.pallets.iter().find(|pallet| pallet.name == name) { + Some(pallet_metadata) => { + let hash = get_pallet_hash(&metadata.types, pallet_metadata); + let hex_hash = hex::encode(hash); + println!( + "Node {:?} has pallet metadata hash {:?}", + node.as_str(), + hex_hash + ); + + compatibility + .pallet_present + .entry(hex_hash) + .or_insert_with(Vec::new) + .push(node.as_str().to_string()); + } + None => { + compatibility + .pallet_not_found + .push(node.as_str().to_string()); + } + } + } + + println!( + "\nCompatible nodes by pallet\n{}", + serde_json::to_string_pretty(&compatibility) + .context("Failed to parse compatibility map")? + ); + + Ok(()) +} + +fn handle_full_metadata(nodes: &[url::Url]) -> color_eyre::Result<()> { + let mut compatibility_map: HashMap> = HashMap::new(); + for node in nodes.iter() { + let metadata = fetch_runtime_metadata(node)?; + let hash = get_metadata_hash(&metadata); + let hex_hash = hex::encode(hash); + println!("Node {:?} has metadata hash {:?}", node.as_str(), hex_hash,); + + compatibility_map + .entry(hex_hash) + .or_insert_with(Vec::new) + .push(node.as_str().to_string()); + } + + println!( + "\nCompatible nodes\n{}", + serde_json::to_string_pretty(&compatibility_map) + .context("Failed to parse compatibility map")? + ); + + Ok(()) +} + +fn fetch_runtime_metadata(url: &url::Url) -> color_eyre::Result { + let (_, bytes) = fetch_metadata(url)?; + + let metadata = ::decode(&mut &bytes[..])?; + if metadata.0 != META_RESERVED { + return Err(eyre::eyre!( + "Node {:?} has invalid metadata prefix: {:?} expected prefix: {:?}", + url.as_str(), + metadata.0, + META_RESERVED + )) + } + + match metadata.1 { + RuntimeMetadata::V14(v14) => Ok(v14), + _ => { + Err(eyre::eyre!( + "Node {:?} with unsupported metadata version: {:?}", + url.as_str(), + metadata.1 + )) + } } } diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index a50280d5cc..393e7c160a 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -22,6 +22,8 @@ proc-macro-error = "1.0.4" quote = "1.0.8" syn = "1.0.58" scale-info = { version = "2.0.0", features = ["bit-vec"] } +sp-core = { version = "6.0.0" } +subxt-metadata = { version = "0.20.0", path = "../metadata" } [dev-dependencies] bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] } diff --git a/codegen/src/api/calls.rs b/codegen/src/api/calls.rs index 80e79564b5..aa58dbcf6e 100644 --- a/codegen/src/api/calls.rs +++ b/codegen/src/api/calls.rs @@ -19,6 +19,7 @@ use crate::types::{ TypeGenerator, }; use frame_metadata::{ + v14::RuntimeMetadataV14, PalletCallMetadata, PalletMetadata, }; @@ -35,6 +36,7 @@ use quote::{ use scale_info::form::PortableForm; pub fn generate_calls( + metadata: &RuntimeMetadataV14, type_gen: &TypeGenerator, pallet: &PalletMetadata, call: &PalletCallMetadata, @@ -48,7 +50,7 @@ pub fn generate_calls( ); let (call_structs, call_fns): (Vec<_>, Vec<_>) = struct_defs .iter_mut() - .map(|struct_def| { + .map(|(variant_name, struct_def)| { let (call_fn_args, call_args): (Vec<_>, Vec<_>) = match struct_def.fields { CompositeDefFields::Named(ref named_fields) => { @@ -74,10 +76,12 @@ pub fn generate_calls( }; let pallet_name = &pallet.name; - let call_struct_name = &struct_def.name; - let function_name = struct_def.name.to_string().to_snake_case(); - let fn_name = format_ident!("{}", function_name); + let call_name = &variant_name; + let struct_name = &struct_def.name; + let call_hash = subxt_metadata::get_call_hash(metadata, pallet_name, call_name) + .unwrap_or_else(|_| abort_call_site!("Metadata information for the call {}_{} could not be found", pallet_name, call_name)); + let fn_name = format_ident!("{}", variant_name.to_snake_case()); // Propagate the documentation just to `TransactionApi` methods, while // draining the documentation of inner call structures. let docs = struct_def.docs.take(); @@ -85,9 +89,9 @@ pub fn generate_calls( let call_struct = quote! { #struct_def - impl ::subxt::Call for #call_struct_name { + impl ::subxt::Call for #struct_name { const PALLET: &'static str = #pallet_name; - const FUNCTION: &'static str = #function_name; + const FUNCTION: &'static str = #call_name; } }; let client_fn = quote! { @@ -95,9 +99,13 @@ pub fn generate_calls( pub fn #fn_name( &self, #( #call_fn_args, )* - ) -> ::subxt::SubmittableExtrinsic<'a, T, X, #call_struct_name, DispatchError, root_mod::Event> { - let call = #call_struct_name { #( #call_args, )* }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result<::subxt::SubmittableExtrinsic<'a, T, X, #struct_name, DispatchError, root_mod::Event>, ::subxt::BasicError> { + if self.client.metadata().call_hash::<#struct_name>()? == [#(#call_hash,)*] { + let call = #struct_name { #( #call_args, )* }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } }; (call_struct, client_fn) diff --git a/codegen/src/api/constants.rs b/codegen/src/api/constants.rs index 68ed8a12a1..a6fba29979 100644 --- a/codegen/src/api/constants.rs +++ b/codegen/src/api/constants.rs @@ -16,11 +16,13 @@ use crate::types::TypeGenerator; use frame_metadata::{ + v14::RuntimeMetadataV14, PalletConstantMetadata, PalletMetadata, }; use heck::ToSnakeCase as _; use proc_macro2::TokenStream as TokenStream2; +use proc_macro_error::abort_call_site; use quote::{ format_ident, quote, @@ -28,6 +30,7 @@ use quote::{ use scale_info::form::PortableForm; pub fn generate_constants( + metadata: &RuntimeMetadataV14, type_gen: &TypeGenerator, pallet: &PalletMetadata, constants: &[PalletConstantMetadata], @@ -37,16 +40,23 @@ pub fn generate_constants( let fn_name = format_ident!("{}", constant.name.to_snake_case()); let pallet_name = &pallet.name; let constant_name = &constant.name; + let constant_hash = subxt_metadata::get_constant_hash(metadata, pallet_name, constant_name) + .unwrap_or_else(|_| abort_call_site!("Metadata information for the constant {}_{} could not be found", pallet_name, constant_name)); + let return_ty = type_gen.resolve_type_path(constant.ty.id(), &[]); let docs = &constant.docs; quote! { #( #[doc = #docs ] )* pub fn #fn_name(&self) -> ::core::result::Result<#return_ty, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet(#pallet_name)?; - let constant = pallet.constant(#constant_name)?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self.client.metadata().constant_hash(#pallet_name, #constant_name)? == [#(#constant_hash,)*] { + let pallet = self.client.metadata().pallet(#pallet_name)?; + let constant = pallet.constant(#constant_name)?; + let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } }); diff --git a/codegen/src/api/events.rs b/codegen/src/api/events.rs index 6c2389b52b..05a0eaef18 100644 --- a/codegen/src/api/events.rs +++ b/codegen/src/api/events.rs @@ -35,10 +35,10 @@ pub fn generate_events( |name| name.into(), "Event", ); - let event_structs = struct_defs.iter().map(|struct_def| { + let event_structs = struct_defs.iter().map(|(variant_name, struct_def)| { let pallet_name = &pallet.name; let event_struct = &struct_def.name; - let event_name = struct_def.name.to_string(); + let event_name = variant_name; quote! { #struct_def diff --git a/codegen/src/api/mod.rs b/codegen/src/api/mod.rs index 949a530fc4..91e1d944bd 100644 --- a/codegen/src/api/mod.rs +++ b/codegen/src/api/mod.rs @@ -37,6 +37,8 @@ mod errors; mod events; mod storage; +use subxt_metadata::get_metadata_per_pallet_hash; + use super::GeneratedTypeDerives; use crate::{ ir, @@ -181,9 +183,28 @@ impl RuntimeGenerator { }) .collect::>(); + // Pallet names and their length are used to create PALLETS array. + // The array is used to identify the pallets composing the metadata for + // validation of just those pallets. + let pallet_names: Vec<_> = self + .metadata + .pallets + .iter() + .map(|pallet| &pallet.name) + .collect(); + let pallet_names_len = pallet_names.len(); + + let metadata_hash = get_metadata_per_pallet_hash(&self.metadata, &pallet_names); + let modules = pallets_with_mod_names.iter().map(|(pallet, mod_name)| { let calls = if let Some(ref calls) = pallet.calls { - calls::generate_calls(&type_gen, pallet, calls, types_mod_ident) + calls::generate_calls( + &self.metadata, + &type_gen, + pallet, + calls, + types_mod_ident, + ) } else { quote!() }; @@ -195,13 +216,20 @@ impl RuntimeGenerator { }; let storage_mod = if let Some(ref storage) = pallet.storage { - storage::generate_storage(&type_gen, pallet, storage, types_mod_ident) + storage::generate_storage( + &self.metadata, + &type_gen, + pallet, + storage, + types_mod_ident, + ) } else { quote!() }; let constants_mod = if !pallet.constants.is_empty() { constants::generate_constants( + &self.metadata, &type_gen, pallet, &pallet.constants, @@ -244,24 +272,26 @@ impl RuntimeGenerator { }; let mod_ident = item_mod_ir.ident; - let pallets_with_constants = - pallets_with_mod_names - .iter() - .filter_map(|(pallet, pallet_mod_name)| { - (!pallet.constants.is_empty()).then(|| pallet_mod_name) - }); - let pallets_with_storage = - pallets_with_mod_names - .iter() - .filter_map(|(pallet, pallet_mod_name)| { - pallet.storage.as_ref().map(|_| pallet_mod_name) - }); - let pallets_with_calls = - pallets_with_mod_names - .iter() - .filter_map(|(pallet, pallet_mod_name)| { - pallet.calls.as_ref().map(|_| pallet_mod_name) - }); + let pallets_with_constants: Vec<_> = pallets_with_mod_names + .iter() + .filter_map(|(pallet, pallet_mod_name)| { + (!pallet.constants.is_empty()).then(|| pallet_mod_name) + }) + .collect(); + + let pallets_with_storage: Vec<_> = pallets_with_mod_names + .iter() + .filter_map(|(pallet, pallet_mod_name)| { + pallet.storage.as_ref().map(|_| pallet_mod_name) + }) + .collect(); + + let pallets_with_calls: Vec<_> = pallets_with_mod_names + .iter() + .filter_map(|(pallet, pallet_mod_name)| { + pallet.calls.as_ref().map(|_| pallet_mod_name) + }) + .collect(); let has_module_error_impl = errors::generate_has_module_error_impl(&self.metadata, types_mod_ident); @@ -271,6 +301,8 @@ impl RuntimeGenerator { pub mod #mod_ident { // Make it easy to access the root via `root_mod` at different levels: use super::#mod_ident as root_mod; + // Identify the pallets composing the static metadata by name. + pub static PALLETS: [&str; #pallet_names_len] = [ #(#pallet_names,)* ]; #outer_event #( #modules )* @@ -301,6 +333,14 @@ impl RuntimeGenerator { T: ::subxt::Config, X: ::subxt::extrinsic::ExtrinsicParams, { + pub fn validate_metadata(&'a self) -> Result<(), ::subxt::MetadataError> { + if self.client.metadata().metadata_hash(&PALLETS) != [ #(#metadata_hash,)* ] { + Err(::subxt::MetadataError::IncompatibleMetadata) + } else { + Ok(()) + } + } + pub fn constants(&'a self) -> ConstantsApi<'a, T> { ConstantsApi { client: &self.client } } @@ -384,12 +424,13 @@ impl RuntimeGenerator { } } +/// Return a vector of tuples of variant names and corresponding struct definitions. pub fn generate_structs_from_variants<'a, F>( type_gen: &'a TypeGenerator, type_id: u32, variant_to_struct_name: F, error_message_type_name: &str, -) -> Vec +) -> Vec<(String, CompositeDef)> where F: Fn(&str) -> std::borrow::Cow, { @@ -406,14 +447,15 @@ where &[], type_gen, ); - CompositeDef::struct_def( + let struct_def = CompositeDef::struct_def( struct_name.as_ref(), Default::default(), fields, Some(parse_quote!(pub)), type_gen, var.docs(), - ) + ); + (var.name().to_string(), struct_def) }) .collect() } else { diff --git a/codegen/src/api/storage.rs b/codegen/src/api/storage.rs index 544a78e909..5bc2ffa989 100644 --- a/codegen/src/api/storage.rs +++ b/codegen/src/api/storage.rs @@ -16,6 +16,7 @@ use crate::types::TypeGenerator; use frame_metadata::{ + v14::RuntimeMetadataV14, PalletMetadata, PalletStorageMetadata, StorageEntryMetadata, @@ -36,6 +37,7 @@ use scale_info::{ }; pub fn generate_storage( + metadata: &RuntimeMetadataV14, type_gen: &TypeGenerator, pallet: &PalletMetadata, storage: &PalletStorageMetadata, @@ -44,7 +46,7 @@ pub fn generate_storage( let (storage_structs, storage_fns): (Vec<_>, Vec<_>) = storage .entries .iter() - .map(|entry| generate_storage_entry_fns(type_gen, pallet, entry)) + .map(|entry| generate_storage_entry_fns(metadata, type_gen, pallet, entry)) .unzip(); quote! { @@ -69,6 +71,7 @@ pub fn generate_storage( } fn generate_storage_entry_fns( + metadata: &RuntimeMetadataV14, type_gen: &TypeGenerator, pallet: &PalletMetadata, storage_entry: &StorageEntryMetadata, @@ -205,8 +208,19 @@ fn generate_storage_entry_fns( } } }; + let pallet_name = &pallet.name; let storage_name = &storage_entry.name; + let storage_hash = + subxt_metadata::get_storage_hash(metadata, pallet_name, storage_name) + .unwrap_or_else(|_| { + abort_call_site!( + "Metadata information for the storage entry {}_{} could not be found", + pallet_name, + storage_name + ) + }); + let fn_name = format_ident!("{}", storage_entry.name.to_snake_case()); let fn_name_iter = format_ident!("{}_iter", fn_name); let storage_entry_ty = match storage_entry.ty { @@ -255,9 +269,13 @@ fn generate_storage_entry_fns( #docs_token pub async fn #fn_name_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::subxt::KeyIter<'a, T, #entry_struct_ident #lifetime_param>, ::subxt::BasicError> { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::<#entry_struct_ident>()? == [#(#storage_hash,)*] { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } ) } else { @@ -280,10 +298,14 @@ fn generate_storage_entry_fns( pub async fn #fn_name( &self, #( #key_args, )* - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<#return_ty, ::subxt::BasicError> { - let entry = #constructor; - self.client.storage().#fetch(&entry, hash).await + if self.client.metadata().storage_hash::<#entry_struct_ident>()? == [#(#storage_hash,)*] { + let entry = #constructor; + self.client.storage().#fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #client_iter_fn diff --git a/examples/examples/balance_transfer.rs b/examples/examples/balance_transfer.rs index 9f3d8477e5..5d5accda0a 100644 --- a/examples/examples/balance_transfer.rs +++ b/examples/examples/balance_transfer.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with subxt. If not, see . -//! To run this example, a local polkadot node should be running. Example verified against polkadot 0.9.18-f6d6ab005d-aarch64-macos. +//! To run this example, a local polkadot node should be running. Example verified against polkadot 0.9.18-4542a603cc-aarch64-macos. //! //! E.g. //! ```bash @@ -47,7 +47,7 @@ async fn main() -> Result<(), Box> { let hash = api .tx() .balances() - .transfer(dest, 123_456_789_012_345) + .transfer(dest, 123_456_789_012_345)? .sign_and_submit_default(&signer) .await?; diff --git a/examples/examples/balance_transfer_with_params.rs b/examples/examples/balance_transfer_with_params.rs index db1384d63e..41150e3d89 100644 --- a/examples/examples/balance_transfer_with_params.rs +++ b/examples/examples/balance_transfer_with_params.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with subxt. If not, see . -//! To run this example, a local polkadot node should be running. Example verified against polkadot 0.9.18-f6d6ab005d-aarch64-macos. +//! To run this example, a local polkadot node should be running. Example verified against polkadot 0.9.18-4542a603cc-aarch64-macos. //! //! E.g. //! ```bash @@ -59,7 +59,7 @@ async fn main() -> Result<(), Box> { let hash = api .tx() .balances() - .transfer(dest, 123_456_789_012_345) + .transfer(dest, 123_456_789_012_345)? .sign_and_submit(&signer, tx_params) .await?; diff --git a/examples/examples/custom_config.rs b/examples/examples/custom_config.rs index af4f84fad5..a28eff9515 100644 --- a/examples/examples/custom_config.rs +++ b/examples/examples/custom_config.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with subxt. If not, see . -//! To run this example, a local polkadot node should be running. Example verified against polkadot 0.9.18-f6d6ab005d-aarch64-macos. +//! To run this example, a local polkadot node should be running. Example verified against polkadot 0.9.18-4542a603cc-aarch64-macos. //! //! E.g. //! ```bash @@ -68,7 +68,7 @@ async fn main() -> Result<(), Box> { let hash = api .tx() .balances() - .transfer(dest, 10_000) + .transfer(dest, 10_000)? .sign_and_submit_default(&signer) .await?; diff --git a/examples/examples/custom_type_derives.rs b/examples/examples/custom_type_derives.rs index fbd5787135..2812fca268 100644 --- a/examples/examples/custom_type_derives.rs +++ b/examples/examples/custom_type_derives.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with subxt. If not, see . -//! Example verified against polkadot 0.9.18-f6d6ab005d-aarch64-macos. +//! Example verified against polkadot 0.9.18-4542a603cc-aarch64-macos. #![allow(clippy::redundant_clone)] diff --git a/examples/examples/fetch_all_accounts.rs b/examples/examples/fetch_all_accounts.rs index 46d37469f8..bffb6fb134 100644 --- a/examples/examples/fetch_all_accounts.rs +++ b/examples/examples/fetch_all_accounts.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with subxt. If not, see . -//! To run this example, a local polkadot node should be running. Example verified against polkadot 0.9.18-f6d6ab005d-aarch64-macos. +//! To run this example, a local polkadot node should be running. Example verified against polkadot 0.9.18-4542a603cc-aarch64-macos. //! //! E.g. //! ```bash diff --git a/examples/examples/fetch_staking_details.rs b/examples/examples/fetch_staking_details.rs index 82478f67eb..eec0d85fce 100644 --- a/examples/examples/fetch_staking_details.rs +++ b/examples/examples/fetch_staking_details.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with subxt. If not, see . -//! To run this example, a local polkadot node should be running. Example verified against polkadot 0.9.13-d96d3bea85-aarch64-macos. +//! To run this example, a local polkadot node should be running. Example verified against polkadot 0.9.18-4542a603cc-aarch64-macos. //! //! E.g. //! ```bash diff --git a/examples/examples/metadata_compatibility.rs b/examples/examples/metadata_compatibility.rs new file mode 100644 index 0000000000..7318582226 --- /dev/null +++ b/examples/examples/metadata_compatibility.rs @@ -0,0 +1,52 @@ +// Copyright 2019-2022 Parity Technologies (UK) Ltd. +// This file is part of subxt. +// +// subxt is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// subxt is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with subxt. If not, see . + +//! To run this example, a local polkadot node should be running. Example verified against polkadot 0.9.18-4542a603cc-aarch64-macos. +//! +//! E.g. +//! ```bash +//! curl "https://github.com/paritytech/polkadot/releases/download/v0.9.13/polkadot" --output /usr/local/bin/polkadot --location +//! polkadot --dev --tmp +//! ``` + +use subxt::{ + ClientBuilder, + DefaultConfig, + PolkadotExtrinsicParams, +}; + +#[subxt::subxt(runtime_metadata_path = "examples/polkadot_metadata.scale")] +pub mod polkadot {} + +#[tokio::main] +async fn main() -> Result<(), Box> { + env_logger::init(); + + let api = ClientBuilder::new() + .build() + .await? + .to_runtime_api::>>(); + + // Full metadata validation is not enabled by default; instead, the individual calls, + // storage requests and constant accesses are runtime type checked against the node + // metadata to ensure that they are compatible with the generated code. + // + // To make sure that all of our statically generated pallets are compatible with the + // runtime node, we can run this check: + api.validate_metadata()?; + + Ok(()) +} diff --git a/examples/examples/polkadot_metadata.scale b/examples/examples/polkadot_metadata.scale index a9bb72cf6a..ba710c06e2 100644 Binary files a/examples/examples/polkadot_metadata.scale and b/examples/examples/polkadot_metadata.scale differ diff --git a/examples/examples/rpc_call.rs b/examples/examples/rpc_call.rs index b62561ae76..e24c07005d 100644 --- a/examples/examples/rpc_call.rs +++ b/examples/examples/rpc_call.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with subxt. If not, see . -//! To run this example, a local polkadot node should be running. Example verified against polkadot 0.9.18-f6d6ab005d-aarch64-macos. +//! To run this example, a local polkadot node should be running. Example verified against polkadot 0.9.18-4542a603cc-aarch64-macos. //! //! E.g. //! ```bash diff --git a/examples/examples/submit_and_watch.rs b/examples/examples/submit_and_watch.rs index 3b2518a7f9..a5e9cda9b6 100644 --- a/examples/examples/submit_and_watch.rs +++ b/examples/examples/submit_and_watch.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with subxt. If not, see . -//! To run this example, a local polkadot node should be running. Example verified against polkadot 0.9.18-f6d6ab005d-aarch64-macos. +//! To run this example, a local polkadot node should be running. Example verified against polkadot 0.9.18-4542a603cc-aarch64-macos. //! //! E.g. //! ```bash @@ -60,7 +60,7 @@ async fn simple_transfer() -> Result<(), Box> { let balance_transfer = api .tx() .balances() - .transfer(dest, 10_000) + .transfer(dest, 10_000)? .sign_and_submit_then_watch_default(&signer) .await? .wait_for_finalized_success() @@ -92,7 +92,7 @@ async fn simple_transfer_separate_events() -> Result<(), Box Result<(), Box> { let mut balance_transfer_progress = api .tx() .balances() - .transfer(dest, 10_000) + .transfer(dest, 10_000)? .sign_and_submit_then_watch_default(&signer) .await?; diff --git a/examples/examples/subscribe_all_events.rs b/examples/examples/subscribe_all_events.rs index de6928b236..9dd0b48e07 100644 --- a/examples/examples/subscribe_all_events.rs +++ b/examples/examples/subscribe_all_events.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with subxt. If not, see . -//! To run this example, a local polkadot node should be running. Example verified against polkadot 0.9.18-f6d6ab005d-aarch64-macos. +//! To run this example, a local polkadot node should be running. Example verified against polkadot 0.9.18-4542a603cc-aarch64-macos. //! //! E.g. //! ```bash @@ -69,6 +69,7 @@ async fn main() -> Result<(), Box> { api.tx() .balances() .transfer(AccountKeyring::Bob.to_account_id().into(), transfer_amount) + .expect("compatible transfer call on runtime node") .sign_and_submit_default(&signer) .await .unwrap(); diff --git a/examples/examples/subscribe_one_event.rs b/examples/examples/subscribe_one_event.rs index 020beffa97..4864825787 100644 --- a/examples/examples/subscribe_one_event.rs +++ b/examples/examples/subscribe_one_event.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with subxt. If not, see . -//! To run this example, a local polkadot node should be running. Example verified against polkadot 0.9.18-f6d6ab005d-aarch64-macos. +//! To run this example, a local polkadot node should be running. Example verified against polkadot 0.9.18-4542a603cc-aarch64-macos. //! //! E.g. //! ```bash @@ -73,6 +73,7 @@ async fn main() -> Result<(), Box> { api.tx() .balances() .transfer(AccountKeyring::Bob.to_account_id().into(), 1_000_000_000) + .expect("compatible transfer call on runtime node") .sign_and_submit_default(&signer) .await .unwrap(); diff --git a/examples/examples/subscribe_some_events.rs b/examples/examples/subscribe_some_events.rs index 114bc999e2..4585d06314 100644 --- a/examples/examples/subscribe_some_events.rs +++ b/examples/examples/subscribe_some_events.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with subxt. If not, see . -//! To run this example, a local polkadot node should be running. Example verified against polkadot 0.9.18-f6d6ab005d-aarch64-macos. +//! To run this example, a local polkadot node should be running. Example verified against polkadot 0.9.18-4542a603cc-aarch64-macos. //! //! E.g. //! ```bash @@ -74,6 +74,7 @@ async fn main() -> Result<(), Box> { api.tx() .balances() .transfer(AccountKeyring::Bob.to_account_id().into(), 1_000_000_000) + .expect("compatible transfer call on runtime node") .sign_and_submit_default(&signer) .await .unwrap(); diff --git a/metadata/Cargo.toml b/metadata/Cargo.toml new file mode 100644 index 0000000000..b51ac458eb --- /dev/null +++ b/metadata/Cargo.toml @@ -0,0 +1,32 @@ +[package] +name = "subxt-metadata" +version = "0.20.0" +authors = ["Parity Technologies "] +edition = "2021" +autotests = false + +license = "GPL-3.0" +repository = "https://github.com/paritytech/subxt" +documentation = "https://docs.rs/subxt" +homepage = "https://www.parity.io/" +description = "Command line utilities for checking metadata compatibility between nodes." + +[dependencies] +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "full"] } +frame-metadata = "15.0.0" +scale-info = "2.0.0" +sp-core = { version = "6.0.0" } + +[dev-dependencies] +bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] } +criterion = "0.3" +scale-info = { version = "2.0.0", features = ["bit-vec"] } +test-runtime = { path = "../test-runtime" } + +[lib] +# Without this, libtest cli opts interfere with criteron benches: +bench = false + +[[bench]] +name = "bench" +harness = false diff --git a/metadata/benches/bench.rs b/metadata/benches/bench.rs new file mode 100644 index 0000000000..09c866a1b1 --- /dev/null +++ b/metadata/benches/bench.rs @@ -0,0 +1,145 @@ +// Copyright 2019-2022 Parity Technologies (UK) Ltd. +// This file is part of subxt. +// +// subxt is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// subxt is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with subxt. If not, see . + +use codec::Decode; +use criterion::*; +use frame_metadata::{ + RuntimeMetadata::V14, + RuntimeMetadataPrefixed, + RuntimeMetadataV14, +}; +use scale_info::{ + form::PortableForm, + TypeDef, + TypeDefVariant, +}; +use subxt_metadata::{ + get_call_hash, + get_constant_hash, + get_metadata_hash, + get_pallet_hash, + get_storage_hash, +}; + +fn load_metadata() -> RuntimeMetadataV14 { + let bytes = test_runtime::METADATA; + let meta: RuntimeMetadataPrefixed = + Decode::decode(&mut &*bytes).expect("Cannot decode scale metadata"); + + match meta.1 { + V14(v14) => v14, + _ => panic!("Unsupported metadata version {:?}", meta.1), + } +} + +fn expect_variant(def: &TypeDef) -> &TypeDefVariant { + match def { + TypeDef::Variant(variant) => variant, + _ => panic!("Expected a variant type, got {def:?}"), + } +} + +fn bench_get_metadata_hash(c: &mut Criterion) { + let metadata = load_metadata(); + + c.bench_function("get_metadata_hash", |b| { + b.iter(|| get_metadata_hash(&metadata)) + }); +} + +fn bench_get_pallet_hash(c: &mut Criterion) { + let metadata = load_metadata(); + let mut group = c.benchmark_group("get_pallet_hash"); + + for pallet in metadata.pallets.iter() { + let pallet_name = &pallet.name; + group.bench_function(pallet_name, |b| { + b.iter(|| get_pallet_hash(&metadata.types, pallet)) + }); + } +} + +fn bench_get_call_hash(c: &mut Criterion) { + let metadata = load_metadata(); + let mut group = c.benchmark_group("get_call_hash"); + + for pallet in metadata.pallets.iter() { + let pallet_name = &pallet.name; + let call_type_id = match &pallet.calls { + Some(calls) => calls.ty.id(), + None => continue, + }; + let call_type = metadata.types.resolve(call_type_id).unwrap(); + let variants = expect_variant(call_type.type_def()); + + for variant in variants.variants() { + let call_name = variant.name(); + let bench_name = format!("{pallet_name}/{call_name}"); + group.bench_function(&bench_name, |b| { + b.iter(|| get_call_hash(&metadata, &pallet.name, call_name)) + }); + } + } +} + +fn bench_get_constant_hash(c: &mut Criterion) { + let metadata = load_metadata(); + let mut group = c.benchmark_group("get_constant_hash"); + + for pallet in metadata.pallets.iter() { + let pallet_name = &pallet.name; + for constant in &pallet.constants { + let constant_name = &constant.name; + let bench_name = format!("{pallet_name}/{constant_name}"); + group.bench_function(&bench_name, |b| { + b.iter(|| get_constant_hash(&metadata, &pallet.name, constant_name)) + }); + } + } +} + +fn bench_get_storage_hash(c: &mut Criterion) { + let metadata = load_metadata(); + let mut group = c.benchmark_group("get_storage_hash"); + + for pallet in metadata.pallets.iter() { + let pallet_name = &pallet.name; + let storage_entries = match &pallet.storage { + Some(storage) => &storage.entries, + None => continue, + }; + + for storage in storage_entries { + let storage_name = &storage.name; + let bench_name = format!("{pallet_name}/{storage_name}"); + group.bench_function(&bench_name, |b| { + b.iter(|| get_storage_hash(&metadata, &pallet.name, storage_name)) + }); + } + } +} + +criterion_group!( + name = benches; + config = Criterion::default(); + targets = + bench_get_metadata_hash, + bench_get_pallet_hash, + bench_get_call_hash, + bench_get_constant_hash, + bench_get_storage_hash, +); +criterion_main!(benches); diff --git a/metadata/src/lib.rs b/metadata/src/lib.rs new file mode 100644 index 0000000000..4fc57f4c36 --- /dev/null +++ b/metadata/src/lib.rs @@ -0,0 +1,883 @@ +// Copyright 2019-2022 Parity Technologies (UK) Ltd. +// This file is part of subxt. +// +// subxt is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// subxt is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with subxt. If not, see . + +use frame_metadata::{ + ExtrinsicMetadata, + RuntimeMetadataV14, + StorageEntryMetadata, + StorageEntryType, +}; +use scale_info::{ + form::PortableForm, + Field, + PortableRegistry, + TypeDef, + Variant, +}; +use std::collections::HashSet; + +/// Internal byte representation for various metadata types utilized for +/// generating deterministic hashes between different rust versions. +#[repr(u8)] +enum TypeBeingHashed { + Composite, + Variant, + Sequence, + Array, + Tuple, + Primitive, + Compact, + BitSequence, +} + +/// Hashing function utilized internally. +fn hash(bytes: &[u8]) -> [u8; 32] { + sp_core::hashing::twox_256(bytes) +} + +/// XOR two hashes together. If we have two pseudorandom hashes, then this will +/// lead to another pseudorandom value. If there is potentially some pattern to +/// the hashes we are xoring (eg we might be xoring the same hashes a few times), +/// prefer `hash_hashes` to give us stronger pseudorandomness guarantees. +fn xor(a: [u8; 32], b: [u8; 32]) -> [u8; 32] { + let mut out = [0u8; 32]; + for (idx, (a, b)) in a.into_iter().zip(b).enumerate() { + out[idx] = a ^ b; + } + out +} + +/// Combine two hashes or hash-like sets of bytes together into a single hash. +/// `xor` is OK for one-off combinations of bytes, but if we are merging +/// potentially identical hashes, this is a safer way to ensure the result is +/// unique. +fn hash_hashes(a: [u8; 32], b: [u8; 32]) -> [u8; 32] { + let mut out = [0u8; 32 * 2]; + for (idx, byte) in a.into_iter().chain(b).enumerate() { + out[idx] = byte; + } + hash(&out) +} + +/// Obtain the hash representation of a `scale_info::Field`. +fn get_field_hash( + registry: &PortableRegistry, + field: &Field, + visited_ids: &mut HashSet, +) -> [u8; 32] { + let mut bytes = get_type_hash(registry, field.ty().id(), visited_ids); + + // XOR name and field name with the type hash if they exist + if let Some(name) = field.name() { + bytes = xor(bytes, hash(name.as_bytes())); + } + if let Some(name) = field.type_name() { + bytes = xor(bytes, hash(name.as_bytes())); + } + + bytes +} + +/// Obtain the hash representation of a `scale_info::Variant`. +fn get_variant_hash( + registry: &PortableRegistry, + var: &Variant, + visited_ids: &mut HashSet, +) -> [u8; 32] { + // Merge our hashes of the name and each field together using xor. + let mut bytes = hash(var.name().as_bytes()); + for field in var.fields() { + bytes = hash_hashes(bytes, get_field_hash(registry, field, visited_ids)) + } + + bytes +} + +/// Obtain the hash representation of a `scale_info::TypeDef`. +fn get_type_def_hash( + registry: &PortableRegistry, + ty_def: &TypeDef, + visited_ids: &mut HashSet, +) -> [u8; 32] { + match ty_def { + TypeDef::Composite(composite) => { + let mut bytes = hash(&[TypeBeingHashed::Composite as u8]); + for field in composite.fields() { + bytes = hash_hashes(bytes, get_field_hash(registry, field, visited_ids)); + } + bytes + } + TypeDef::Variant(variant) => { + let mut bytes = hash(&[TypeBeingHashed::Variant as u8]); + for var in variant.variants().iter() { + bytes = hash_hashes(bytes, get_variant_hash(registry, var, visited_ids)); + } + bytes + } + TypeDef::Sequence(sequence) => { + let bytes = hash(&[TypeBeingHashed::Sequence as u8]); + xor( + bytes, + get_type_hash(registry, sequence.type_param().id(), visited_ids), + ) + } + TypeDef::Array(array) => { + // Take length into account; different length must lead to different hash. + let len_bytes = array.len().to_be_bytes(); + let bytes = hash(&[ + TypeBeingHashed::Array as u8, + len_bytes[0], + len_bytes[1], + len_bytes[2], + len_bytes[3], + ]); + xor( + bytes, + get_type_hash(registry, array.type_param().id(), visited_ids), + ) + } + TypeDef::Tuple(tuple) => { + let mut bytes = hash(&[TypeBeingHashed::Tuple as u8]); + for field in tuple.fields() { + bytes = + hash_hashes(bytes, get_type_hash(registry, field.id(), visited_ids)); + } + bytes + } + TypeDef::Primitive(primitive) => { + // Cloning the 'primitive' type should essentially be a copy. + hash(&[TypeBeingHashed::Primitive as u8, primitive.clone() as u8]) + } + TypeDef::Compact(compact) => { + let bytes = hash(&[TypeBeingHashed::Compact as u8]); + xor( + bytes, + get_type_hash(registry, compact.type_param().id(), visited_ids), + ) + } + TypeDef::BitSequence(bitseq) => { + let mut bytes = hash(&[TypeBeingHashed::BitSequence as u8]); + bytes = xor( + bytes, + get_type_hash(registry, bitseq.bit_order_type().id(), visited_ids), + ); + bytes = xor( + bytes, + get_type_hash(registry, bitseq.bit_store_type().id(), visited_ids), + ); + bytes + } + } +} + +/// Obtain the hash representation of a `scale_info::Type` identified by id. +fn get_type_hash( + registry: &PortableRegistry, + id: u32, + visited_ids: &mut HashSet, +) -> [u8; 32] { + // Guard against recursive types and return a fixed arbitrary hash + if !visited_ids.insert(id) { + return hash(&[123u8]) + } + + let ty = registry.resolve(id).unwrap(); + get_type_def_hash(registry, ty.type_def(), visited_ids) +} + +/// Obtain the hash representation of a `frame_metadata::ExtrinsicMetadata`. +fn get_extrinsic_hash( + registry: &PortableRegistry, + extrinsic: &ExtrinsicMetadata, +) -> [u8; 32] { + let mut visited_ids = HashSet::::new(); + + let mut bytes = get_type_hash(registry, extrinsic.ty.id(), &mut visited_ids); + + bytes = xor(bytes, hash(&[extrinsic.version])); + for signed_extension in extrinsic.signed_extensions.iter() { + let mut ext_bytes = hash(signed_extension.identifier.as_bytes()); + ext_bytes = xor( + ext_bytes, + get_type_hash(registry, signed_extension.ty.id(), &mut visited_ids), + ); + ext_bytes = xor( + ext_bytes, + get_type_hash( + registry, + signed_extension.additional_signed.id(), + &mut visited_ids, + ), + ); + bytes = hash_hashes(bytes, ext_bytes); + } + + bytes +} + +/// Get the hash corresponding to a single storage entry. +fn get_storage_entry_hash( + registry: &PortableRegistry, + entry: &StorageEntryMetadata, + visited_ids: &mut HashSet, +) -> [u8; 32] { + let mut bytes = hash(entry.name.as_bytes()); + // Cloning 'entry.modifier' should essentially be a copy. + bytes = xor(bytes, hash(&[entry.modifier.clone() as u8])); + bytes = xor(bytes, hash(&entry.default)); + + match &entry.ty { + StorageEntryType::Plain(ty) => { + bytes = xor(bytes, get_type_hash(registry, ty.id(), visited_ids)); + } + StorageEntryType::Map { + hashers, + key, + value, + } => { + for hasher in hashers { + // Cloning the hasher should essentially be a copy. + bytes = hash_hashes(bytes, [hasher.clone() as u8; 32]); + } + bytes = xor(bytes, get_type_hash(registry, key.id(), visited_ids)); + bytes = xor(bytes, get_type_hash(registry, value.id(), visited_ids)); + } + } + + bytes +} + +/// Obtain the hash for a specific storage item, or an error if it's not found. +pub fn get_storage_hash( + metadata: &RuntimeMetadataV14, + pallet_name: &str, + storage_name: &str, +) -> Result<[u8; 32], NotFound> { + let pallet = metadata + .pallets + .iter() + .find(|p| p.name == pallet_name) + .ok_or(NotFound::Pallet)?; + + let storage = pallet.storage.as_ref().ok_or(NotFound::Item)?; + + let entry = storage + .entries + .iter() + .find(|s| s.name == storage_name) + .ok_or(NotFound::Item)?; + + let hash = get_storage_entry_hash(&metadata.types, entry, &mut HashSet::new()); + Ok(hash) +} + +/// Obtain the hash for a specific constant, or an error if it's not found. +pub fn get_constant_hash( + metadata: &RuntimeMetadataV14, + pallet_name: &str, + constant_name: &str, +) -> Result<[u8; 32], NotFound> { + let pallet = metadata + .pallets + .iter() + .find(|p| p.name == pallet_name) + .ok_or(NotFound::Pallet)?; + + let constant = pallet + .constants + .iter() + .find(|c| c.name == constant_name) + .ok_or(NotFound::Item)?; + + let mut bytes = get_type_hash(&metadata.types, constant.ty.id(), &mut HashSet::new()); + bytes = xor(bytes, hash(constant.name.as_bytes())); + bytes = xor(bytes, hash(&constant.value)); + + Ok(bytes) +} + +/// Obtain the hash for a specific call, or an error if it's not found. +pub fn get_call_hash( + metadata: &RuntimeMetadataV14, + pallet_name: &str, + call_name: &str, +) -> Result<[u8; 32], NotFound> { + let pallet = metadata + .pallets + .iter() + .find(|p| p.name == pallet_name) + .ok_or(NotFound::Pallet)?; + + let call_id = pallet.calls.as_ref().ok_or(NotFound::Item)?.ty.id(); + + let call_ty = metadata.types.resolve(call_id).ok_or(NotFound::Item)?; + + let call_variants = match call_ty.type_def() { + TypeDef::Variant(variant) => variant.variants(), + _ => return Err(NotFound::Item), + }; + + let variant = call_variants + .iter() + .find(|v| v.name() == call_name) + .ok_or(NotFound::Item)?; + + // hash the specific variant representing the call we are interested in. + let hash = get_variant_hash(&metadata.types, variant, &mut HashSet::new()); + Ok(hash) +} + +/// Obtain the hash representation of a `frame_metadata::PalletMetadata`. +pub fn get_pallet_hash( + registry: &PortableRegistry, + pallet: &frame_metadata::PalletMetadata, +) -> [u8; 32] { + // Begin with some arbitrary hash (we don't really care what it is). + let mut bytes = hash(&[19]); + let mut visited_ids = HashSet::::new(); + + if let Some(calls) = &pallet.calls { + bytes = xor( + bytes, + get_type_hash(registry, calls.ty.id(), &mut visited_ids), + ); + } + if let Some(ref event) = pallet.event { + bytes = xor( + bytes, + get_type_hash(registry, event.ty.id(), &mut visited_ids), + ); + } + for constant in pallet.constants.iter() { + bytes = xor(bytes, hash(constant.name.as_bytes())); + bytes = xor(bytes, hash(&constant.value)); + bytes = xor( + bytes, + get_type_hash(registry, constant.ty.id(), &mut visited_ids), + ); + } + if let Some(ref error) = pallet.error { + bytes = xor( + bytes, + get_type_hash(registry, error.ty.id(), &mut visited_ids), + ); + } + if let Some(ref storage) = pallet.storage { + bytes = xor(bytes, hash(storage.prefix.as_bytes())); + for entry in storage.entries.iter() { + bytes = hash_hashes( + bytes, + get_storage_entry_hash(registry, entry, &mut visited_ids), + ); + } + } + + bytes +} + +/// Obtain the hash representation of a `frame_metadata::RuntimeMetadataV14`. +pub fn get_metadata_hash(metadata: &RuntimeMetadataV14) -> [u8; 32] { + // Collect all pairs of (pallet name, pallet hash). + let mut pallets: Vec<(&str, [u8; 32])> = metadata + .pallets + .iter() + .map(|pallet| { + let hash = get_pallet_hash(&metadata.types, pallet); + (&*pallet.name, hash) + }) + .collect(); + + // Sort by pallet name to create a deterministic representation of the underlying metadata. + pallets.sort_by_key(|&(name, _hash)| name); + + // Note: pallet name is excluded from hashing. + // Each pallet has a hash of 32 bytes, and the vector is extended with + // extrinsic hash and metadata ty hash (2 * 32). + let mut bytes = Vec::with_capacity(pallets.len() * 32 + 64); + for (_, hash) in pallets.iter() { + bytes.extend(hash) + } + + bytes.extend(get_extrinsic_hash(&metadata.types, &metadata.extrinsic)); + + let mut visited_ids = HashSet::::new(); + bytes.extend(get_type_hash( + &metadata.types, + metadata.ty.id(), + &mut visited_ids, + )); + + hash(&bytes) +} + +/// Obtain the hash representation of a `frame_metadata::RuntimeMetadataV14` +/// hashing only the provided pallets. +/// +/// **Note:** This is similar to `get_metadata_hash`, but performs hashing only of the provided +/// pallets if they exist. There are cases where the runtime metadata contains a subset of +/// the pallets from the static metadata. In those cases, the static API can communicate +/// properly with the subset of pallets from the runtime node. +pub fn get_metadata_per_pallet_hash>( + metadata: &RuntimeMetadataV14, + pallets: &[T], +) -> [u8; 32] { + // Collect all pairs of (pallet name, pallet hash). + let mut pallets_hashed: Vec<(&str, [u8; 32])> = metadata + .pallets + .iter() + .filter_map(|pallet| { + // Make sure to filter just the pallets we are interested in. + let in_pallet = pallets + .iter() + .any(|pallet_ref| pallet_ref.as_ref() == pallet.name); + if in_pallet { + let hash = get_pallet_hash(&metadata.types, pallet); + Some((&*pallet.name, hash)) + } else { + None + } + }) + .collect(); + + // Sort by pallet name to create a deterministic representation of the underlying metadata. + pallets_hashed.sort_by_key(|&(name, _hash)| name); + + // Note: pallet name is excluded from hashing. + // Each pallet has a hash of 32 bytes, and the vector is extended with + // extrinsic hash and metadata ty hash (2 * 32). + let mut bytes = Vec::with_capacity(pallets_hashed.len() * 32); + for (_, hash) in pallets_hashed.iter() { + bytes.extend(hash) + } + + hash(&bytes) +} + +/// An error returned if we attempt to get the hash for a specific call, constant +/// or storage item that doesn't exist. +#[derive(Clone, Debug)] +pub enum NotFound { + Pallet, + Item, +} + +#[cfg(test)] +mod tests { + use super::*; + use bitvec::{ + order::Lsb0, + vec::BitVec, + }; + use frame_metadata::{ + ExtrinsicMetadata, + PalletCallMetadata, + PalletConstantMetadata, + PalletErrorMetadata, + PalletEventMetadata, + PalletMetadata, + PalletStorageMetadata, + RuntimeMetadataV14, + StorageEntryMetadata, + StorageEntryModifier, + }; + use scale_info::meta_type; + + // Define recursive types. + #[allow(dead_code)] + #[derive(scale_info::TypeInfo)] + struct A { + pub b: Box, + } + #[allow(dead_code)] + #[derive(scale_info::TypeInfo)] + struct B { + pub a: Box, + } + + // Define TypeDef supported types. + #[allow(dead_code)] + #[derive(scale_info::TypeInfo)] + // TypeDef::Composite with TypeDef::Array with Typedef::Primitive. + struct AccountId32([u8; 32]); + #[allow(dead_code)] + #[derive(scale_info::TypeInfo)] + // TypeDef::Variant. + enum DigestItem { + PreRuntime( + // TypeDef::Array with primitive. + [::core::primitive::u8; 4usize], + // TypeDef::Sequence. + ::std::vec::Vec<::core::primitive::u8>, + ), + Other(::std::vec::Vec<::core::primitive::u8>), + // Nested TypeDef::Tuple. + RuntimeEnvironmentUpdated(((i8, i16), (u32, u64))), + // TypeDef::Compact. + Index(#[codec(compact)] ::core::primitive::u8), + // TypeDef::BitSequence. + BitSeq(BitVec), + } + #[allow(dead_code)] + #[derive(scale_info::TypeInfo)] + // Ensure recursive types and TypeDef variants are captured. + struct MetadataTestType { + recursive: A, + composite: AccountId32, + type_def: DigestItem, + } + #[allow(dead_code)] + #[derive(scale_info::TypeInfo)] + // Simulate a PalletCallMetadata. + enum Call { + #[codec(index = 0)] + FillBlock { ratio: AccountId32 }, + #[codec(index = 1)] + Remark { remark: DigestItem }, + } + + fn build_default_extrinsic() -> ExtrinsicMetadata { + ExtrinsicMetadata { + ty: meta_type::<()>(), + version: 0, + signed_extensions: vec![], + } + } + + fn default_pallet() -> PalletMetadata { + PalletMetadata { + name: "Test", + storage: None, + calls: None, + event: None, + constants: vec![], + error: None, + index: 0, + } + } + + fn build_default_pallets() -> Vec { + vec![ + PalletMetadata { + name: "First", + calls: Some(PalletCallMetadata { + ty: meta_type::(), + }), + ..default_pallet() + }, + PalletMetadata { + name: "Second", + index: 1, + calls: Some(PalletCallMetadata { + ty: meta_type::<(DigestItem, AccountId32, A)>(), + }), + ..default_pallet() + }, + ] + } + + fn pallets_to_metadata(pallets: Vec) -> RuntimeMetadataV14 { + RuntimeMetadataV14::new(pallets, build_default_extrinsic(), meta_type::<()>()) + } + + #[test] + fn different_pallet_index() { + let pallets = build_default_pallets(); + let mut pallets_swap = pallets.clone(); + + let metadata = pallets_to_metadata(pallets); + + // Change the order in which pallets are registered. + pallets_swap.swap(0, 1); + pallets_swap[0].index = 0; + pallets_swap[1].index = 1; + let metadata_swap = pallets_to_metadata(pallets_swap); + + let hash = get_metadata_hash(&metadata); + let hash_swap = get_metadata_hash(&metadata_swap); + + // Changing pallet order must still result in a deterministic unique hash. + assert_eq!(hash, hash_swap); + } + + #[test] + fn recursive_type() { + let mut pallet = default_pallet(); + pallet.calls = Some(PalletCallMetadata { + ty: meta_type::(), + }); + let metadata = pallets_to_metadata(vec![pallet]); + + // Check hashing algorithm finishes on a recursive type. + get_metadata_hash(&metadata); + } + + #[test] + /// Ensure correctness of hashing when parsing the `metadata.types`. + /// + /// Having a recursive structure `A: { B }` and `B: { A }` registered in different order + /// `types: { { id: 0, A }, { id: 1, B } }` and `types: { { id: 0, B }, { id: 1, A } }` + /// must produce the same deterministic hashing value. + fn recursive_types_different_order() { + let mut pallets = build_default_pallets(); + pallets[0].calls = Some(PalletCallMetadata { + ty: meta_type::(), + }); + pallets[1].calls = Some(PalletCallMetadata { + ty: meta_type::(), + }); + pallets[1].index = 1; + let mut pallets_swap = pallets.clone(); + let metadata = pallets_to_metadata(pallets); + + pallets_swap.swap(0, 1); + pallets_swap[0].index = 0; + pallets_swap[1].index = 1; + let metadata_swap = pallets_to_metadata(pallets_swap); + + let hash = get_metadata_hash(&metadata); + let hash_swap = get_metadata_hash(&metadata_swap); + + // Changing pallet order must still result in a deterministic unique hash. + assert_eq!(hash, hash_swap); + } + + #[test] + fn pallet_hash_correctness() { + let compare_pallets_hash = |lhs: &PalletMetadata, rhs: &PalletMetadata| { + let metadata = pallets_to_metadata(vec![lhs.clone()]); + let hash = get_metadata_hash(&metadata); + + let metadata = pallets_to_metadata(vec![rhs.clone()]); + let new_hash = get_metadata_hash(&metadata); + + assert_ne!(hash, new_hash); + }; + + // Build metadata progressively from an empty pallet to a fully populated pallet. + let mut pallet = default_pallet(); + let pallet_lhs = pallet.clone(); + pallet.storage = Some(PalletStorageMetadata { + prefix: "Storage", + entries: vec![StorageEntryMetadata { + name: "BlockWeight", + modifier: StorageEntryModifier::Default, + ty: StorageEntryType::Plain(meta_type::()), + default: vec![], + docs: vec![], + }], + }); + compare_pallets_hash(&pallet_lhs, &pallet); + + let pallet_lhs = pallet.clone(); + // Calls are similar to: + // + // ``` + // pub enum Call { + // call_name_01 { arg01: type }, + // call_name_02 { arg01: type, arg02: type } + // } + // ``` + pallet.calls = Some(PalletCallMetadata { + ty: meta_type::(), + }); + compare_pallets_hash(&pallet_lhs, &pallet); + + let pallet_lhs = pallet.clone(); + // Events are similar to Calls. + pallet.event = Some(PalletEventMetadata { + ty: meta_type::(), + }); + compare_pallets_hash(&pallet_lhs, &pallet); + + let pallet_lhs = pallet.clone(); + pallet.constants = vec![PalletConstantMetadata { + name: "BlockHashCount", + ty: meta_type::(), + value: vec![96u8, 0, 0, 0], + docs: vec![], + }]; + compare_pallets_hash(&pallet_lhs, &pallet); + + let pallet_lhs = pallet.clone(); + pallet.error = Some(PalletErrorMetadata { + ty: meta_type::(), + }); + compare_pallets_hash(&pallet_lhs, &pallet); + } + + #[test] + fn metadata_per_pallet_hash_correctness() { + let pallets = build_default_pallets(); + + // Build metadata with just the first pallet. + let metadata_one = pallets_to_metadata(vec![pallets[0].clone()]); + // Build metadata with both pallets. + let metadata_both = pallets_to_metadata(pallets); + + // Hashing will ignore any non-existant pallet and return the same result. + let hash = get_metadata_per_pallet_hash(&metadata_one, &["First", "Second"]); + let hash_rhs = get_metadata_per_pallet_hash(&metadata_one, &["First"]); + assert_eq!(hash, hash_rhs, "hashing should ignore non-existant pallets"); + + // Hashing one pallet from metadata with 2 pallets inserted will ignore the second pallet. + let hash_second = get_metadata_per_pallet_hash(&metadata_both, &["First"]); + assert_eq!( + hash_second, hash, + "hashing one pallet should ignore the others" + ); + + // Check hashing with all pallets. + let hash_second = + get_metadata_per_pallet_hash(&metadata_both, &["First", "Second"]); + assert_ne!(hash_second, hash, "hashing both pallets should produce a different result from hashing just one pallet"); + } + + #[test] + fn field_semantic_changes() { + // Get a hash representation of the provided meta type, + // inserted in the context of pallet metadata call. + let to_hash = |meta_ty| { + let pallet = PalletMetadata { + calls: Some(PalletCallMetadata { ty: meta_ty }), + ..default_pallet() + }; + let metadata = pallets_to_metadata(vec![pallet]); + get_metadata_hash(&metadata) + }; + + #[allow(dead_code)] + #[derive(scale_info::TypeInfo)] + enum EnumFieldNotNamedA { + First(u8), + } + #[allow(dead_code)] + #[derive(scale_info::TypeInfo)] + enum EnumFieldNotNamedB { + First(u8), + } + // Semantic changes apply only to field names. + // This is considered to be a good tradeoff in hashing performance, as refactoring + // a structure / enum 's name is less likely to cause a breaking change. + // Even if the enums have different names, 'EnumFieldNotNamedA' and 'EnumFieldNotNamedB', + // they are equal in meaning (i.e, both contain `First(u8)`). + assert_eq!( + to_hash(meta_type::()), + to_hash(meta_type::()) + ); + + #[allow(dead_code)] + #[derive(scale_info::TypeInfo)] + struct StructFieldNotNamedA([u8; 32]); + #[allow(dead_code)] + #[derive(scale_info::TypeInfo)] + struct StructFieldNotNamedSecondB([u8; 32]); + // Similarly to enums, semantic changes apply only inside the structure fields. + assert_eq!( + to_hash(meta_type::()), + to_hash(meta_type::()) + ); + + #[allow(dead_code)] + #[derive(scale_info::TypeInfo)] + enum EnumFieldNotNamed { + First(u8), + } + #[allow(dead_code)] + #[derive(scale_info::TypeInfo)] + enum EnumFieldNotNamedSecond { + Second(u8), + } + // The enums are binary compatible, they contain a different semantic meaning: + // `First(u8)` and `Second(u8)`. + assert_ne!( + to_hash(meta_type::()), + to_hash(meta_type::()) + ); + + #[allow(dead_code)] + #[derive(scale_info::TypeInfo)] + enum EnumFieldNamed { + First { a: u8 }, + } + #[allow(dead_code)] + #[derive(scale_info::TypeInfo)] + enum EnumFieldNamedSecond { + First { b: u8 }, + } + // Named fields contain a different semantic meaning ('a' and 'b'). + assert_ne!( + to_hash(meta_type::()), + to_hash(meta_type::()) + ); + + #[allow(dead_code)] + #[derive(scale_info::TypeInfo)] + struct StructFieldNamed { + a: u32, + } + #[allow(dead_code)] + #[derive(scale_info::TypeInfo)] + struct StructFieldNamedSecond { + b: u32, + } + // Similar to enums, struct fields contain a different semantic meaning ('a' and 'b'). + assert_ne!( + to_hash(meta_type::()), + to_hash(meta_type::()) + ); + + #[allow(dead_code)] + #[derive(scale_info::TypeInfo)] + enum EnumField { + First, + // Field is unnamed, but has type name `u8`. + Second(u8), + // File is named and has type name `u8`. + Third { named: u8 }, + } + + #[allow(dead_code)] + #[derive(scale_info::TypeInfo)] + enum EnumFieldSwap { + Second(u8), + First, + Third { named: u8 }, + } + // Swapping the registration order should also be taken into account. + assert_ne!( + to_hash(meta_type::()), + to_hash(meta_type::()) + ); + + #[allow(dead_code)] + #[derive(scale_info::TypeInfo)] + struct StructField { + a: u32, + b: u32, + } + + #[allow(dead_code)] + #[derive(scale_info::TypeInfo)] + struct StructFieldSwap { + b: u32, + a: u32, + } + assert_ne!( + to_hash(meta_type::()), + to_hash(meta_type::()) + ); + } +} diff --git a/subxt/Cargo.toml b/subxt/Cargo.toml index 607ee33468..124021070e 100644 --- a/subxt/Cargo.toml +++ b/subxt/Cargo.toml @@ -25,8 +25,10 @@ log = "0.4.14" serde = { version = "1.0.124", features = ["derive"] } serde_json = "1.0.64" thiserror = "1.0.24" +parking_lot = "0.12.0" subxt-macro = { version = "0.20.0", path = "../macro" } +subxt-metadata = { version = "0.20.0", path = "../metadata" } sp-core = { version = "6.0.0", default-features = false } sp-runtime = "6.0.0" diff --git a/subxt/src/client.rs b/subxt/src/client.rs index 3033271b96..5dcb8206d7 100644 --- a/subxt/src/client.rs +++ b/subxt/src/client.rs @@ -46,13 +46,13 @@ use codec::{ Encode, }; use derivative::Derivative; -use std::sync::Arc; /// ClientBuilder for constructing a Client. #[derive(Default)] pub struct ClientBuilder { url: Option, client: Option, + metadata: Option, page_size: Option, } @@ -62,6 +62,7 @@ impl ClientBuilder { Self { url: None, client: None, + metadata: None, page_size: None, } } @@ -84,6 +85,15 @@ impl ClientBuilder { self } + /// Set the metadata. + /// + /// *Note:* Metadata will no longer be downloaded from the runtime node. + #[cfg(integration_tests)] + pub fn set_metadata(mut self, metadata: Metadata) -> Self { + self.metadata = Some(metadata); + self + } + /// Creates a new Client. pub async fn build(self) -> Result, BasicError> { let client = if let Some(client) = self.client { @@ -93,19 +103,23 @@ impl ClientBuilder { crate::rpc::ws_client(url).await? }; let rpc = Rpc::new(client); - let (metadata, genesis_hash, runtime_version, properties) = future::join4( - rpc.metadata(), + let (genesis_hash, runtime_version, properties) = future::join3( rpc.genesis_hash(), rpc.runtime_version(None), rpc.system_properties(), ) .await; - let metadata = metadata?; + + let metadata = if let Some(metadata) = self.metadata { + metadata + } else { + rpc.metadata().await? + }; Ok(Client { rpc, genesis_hash: genesis_hash?, - metadata: Arc::new(metadata), + metadata, properties: properties.unwrap_or_else(|_| Default::default()), runtime_version: runtime_version?, iter_page_size: self.page_size.unwrap_or(10), @@ -119,7 +133,7 @@ impl ClientBuilder { pub struct Client { rpc: Rpc, genesis_hash: T::Hash, - metadata: Arc, + metadata: Metadata, properties: SystemProperties, runtime_version: RuntimeVersion, iter_page_size: u32, diff --git a/subxt/src/events/events_type.rs b/subxt/src/events/events_type.rs index 192d9a0276..493856c3bb 100644 --- a/subxt/src/events/events_type.rs +++ b/subxt/src/events/events_type.rs @@ -403,7 +403,7 @@ pub(crate) mod test_utils { ExtrinsicMetadata, PalletEventMetadata, PalletMetadata, - RuntimeMetadataLastVersion, + RuntimeMetadataV14, }, RuntimeMetadataPrefixed, }; @@ -459,7 +459,7 @@ pub(crate) mod test_utils { signed_extensions: vec![], }; - let v14 = RuntimeMetadataLastVersion::new(pallets, extrinsic, meta_type::<()>()); + let v14 = RuntimeMetadataV14::new(pallets, extrinsic, meta_type::<()>()); let runtime_metadata: RuntimeMetadataPrefixed = v14.into(); Metadata::try_from(runtime_metadata).unwrap() diff --git a/subxt/src/metadata/hash_cache.rs b/subxt/src/metadata/hash_cache.rs new file mode 100644 index 0000000000..1e657bf7cc --- /dev/null +++ b/subxt/src/metadata/hash_cache.rs @@ -0,0 +1,113 @@ +// Copyright 2019-2022 Parity Technologies (UK) Ltd. +// This file is part of subxt. +// +// subxt is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// subxt is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with subxt. If not, see . + +use parking_lot::RwLock; +use std::{ + borrow::Cow, + collections::HashMap, +}; + +/// A cache with the simple goal of storing 32 byte hashes against pallet+item keys +#[derive(Default, Debug)] +pub struct HashCache { + inner: RwLock, [u8; 32]>>, +} + +impl HashCache { + /// get a hash out of the cache by its pallet and item key. If the item doesn't exist, + /// run the function provided to obtain a hash to insert (or bail with some error on failure). + pub fn get_or_insert( + &self, + pallet: &str, + item: &str, + f: F, + ) -> Result<[u8; 32], E> + where + F: FnOnce() -> Result<[u8; 32], E>, + { + let maybe_hash = self + .inner + .read() + .get(&PalletItemKey::new(pallet, item)) + .copied(); + + if let Some(hash) = maybe_hash { + return Ok(hash) + } + + let hash = f()?; + self.inner.write().insert( + PalletItemKey::new(pallet.to_string(), item.to_string()), + hash, + ); + + Ok(hash) + } +} + +/// This exists so that we can look items up in the cache using &strs, without having to allocate +/// Strings first (as you'd have to do to construct something like an `&(String,String)` key). +#[derive(Debug, PartialEq, Eq, Hash)] +struct PalletItemKey<'a> { + pallet: Cow<'a, str>, + item: Cow<'a, str>, +} + +impl<'a> PalletItemKey<'a> { + fn new(pallet: impl Into>, item: impl Into>) -> Self { + PalletItemKey { + pallet: pallet.into(), + item: item.into(), + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn hash_cache_validation() { + let cache = HashCache::default(); + + let pallet = "System"; + let item = "Account"; + let mut call_number = 0; + let value = cache.get_or_insert(pallet, item, || -> Result<[u8; 32], ()> { + call_number += 1; + Ok([0; 32]) + }); + + assert_eq!( + cache + .inner + .read() + .get(&PalletItemKey::new(pallet, item)) + .unwrap(), + &value.unwrap() + ); + assert_eq!(value.unwrap(), [0; 32]); + assert_eq!(call_number, 1); + + // Further calls must be hashed. + let value = cache.get_or_insert(pallet, item, || -> Result<[u8; 32], ()> { + call_number += 1; + Ok([0; 32]) + }); + assert_eq!(call_number, 1); + assert_eq!(value.unwrap(), [0; 32]); + } +} diff --git a/subxt/src/metadata.rs b/subxt/src/metadata/metadata_type.rs similarity index 54% rename from subxt/src/metadata.rs rename to subxt/src/metadata/metadata_type.rs index 4529c8cff7..2ceeddcfeb 100644 --- a/subxt/src/metadata.rs +++ b/subxt/src/metadata/metadata_type.rs @@ -14,41 +14,43 @@ // You should have received a copy of the GNU General Public License // along with subxt. If not, see . -use std::{ - collections::HashMap, - convert::TryFrom, -}; - +use super::hash_cache::HashCache; +use crate::Call; use codec::Error as CodecError; - use frame_metadata::{ PalletConstantMetadata, RuntimeMetadata, - RuntimeMetadataLastVersion, RuntimeMetadataPrefixed, + RuntimeMetadataV14, StorageEntryMetadata, META_RESERVED, }; - -use crate::Call; use scale_info::{ form::PortableForm, Type, Variant, }; +use std::{ + collections::HashMap, + convert::TryFrom, + sync::{ + Arc, + RwLock, + }, +}; /// Metadata error. -#[derive(Debug, thiserror::Error)] +#[derive(Debug, thiserror::Error, PartialEq)] pub enum MetadataError { /// Module is not in metadata. - #[error("Pallet {0} not found")] - PalletNotFound(String), + #[error("Pallet not found")] + PalletNotFound, /// Pallet is not in metadata. #[error("Pallet index {0} not found")] PalletIndexNotFound(u8), /// Call is not in metadata. - #[error("Call {0} not found")] - CallNotFound(&'static str), + #[error("Call not found")] + CallNotFound, /// Event is not in metadata. #[error("Pallet {0}, Event {0} not found")] EventNotFound(u8, u8), @@ -56,8 +58,8 @@ pub enum MetadataError { #[error("Pallet {0}, Error {0} not found")] ErrorNotFound(u8, u8), /// Storage is not in metadata. - #[error("Storage {0} not found")] - StorageNotFound(&'static str), + #[error("Storage not found")] + StorageNotFound, /// Storage type does not match requested type. #[error("Storage type error")] StorageTypeError, @@ -68,28 +70,48 @@ pub enum MetadataError { #[error("Failed to decode constant value: {0}")] ConstantValueError(CodecError), /// Constant is not in metadata. - #[error("Constant {0} not found")] - ConstantNotFound(&'static str), + #[error("Constant not found")] + ConstantNotFound, /// Type is not in metadata. #[error("Type {0} missing from type registry")] TypeNotFound(u32), + /// Runtime pallet metadata is incompatible with the static one. + #[error("Pallet {0} has incompatible metadata")] + IncompatiblePalletMetadata(&'static str), + /// Runtime metadata is not fully compatible with the static one. + #[error("Node metadata is not fully compatible")] + IncompatibleMetadata, } /// Runtime metadata. #[derive(Clone, Debug)] pub struct Metadata { - metadata: RuntimeMetadataLastVersion, + inner: Arc, +} + +// We hide the innards behind an Arc so that it's easy to clone and share. +#[derive(Debug)] +struct MetadataInner { + metadata: RuntimeMetadataV14, pallets: HashMap, events: HashMap<(u8, u8), EventMetadata>, errors: HashMap<(u8, u8), ErrorMetadata>, + // The hashes uniquely identify parts of the metadata; different + // hashes mean some type difference exists between static and runtime + // versions. We cache them here to avoid recalculating: + cached_metadata_hash: RwLock>, + cached_call_hashes: HashCache, + cached_constant_hashes: HashCache, + cached_storage_hashes: HashCache, } impl Metadata { /// Returns a reference to [`PalletMetadata`]. pub fn pallet(&self, name: &'static str) -> Result<&PalletMetadata, MetadataError> { - self.pallets + self.inner + .pallets .get(name) - .ok_or_else(|| MetadataError::PalletNotFound(name.to_string())) + .ok_or(MetadataError::PalletNotFound) } /// Returns the metadata for the event at the given pallet and event indices. @@ -99,6 +121,7 @@ impl Metadata { event_index: u8, ) -> Result<&EventMetadata, MetadataError> { let event = self + .inner .events .get(&(pallet_index, event_index)) .ok_or(MetadataError::EventNotFound(pallet_index, event_index))?; @@ -112,6 +135,7 @@ impl Metadata { error_index: u8, ) -> Result<&ErrorMetadata, MetadataError> { let error = self + .inner .errors .get(&(pallet_index, error_index)) .ok_or(MetadataError::ErrorNotFound(pallet_index, error_index))?; @@ -120,12 +144,90 @@ impl Metadata { /// Resolve a type definition. pub fn resolve_type(&self, id: u32) -> Option<&Type> { - self.metadata.types.resolve(id) + self.inner.metadata.types.resolve(id) } /// Return the runtime metadata. - pub fn runtime_metadata(&self) -> &RuntimeMetadataLastVersion { - &self.metadata + pub fn runtime_metadata(&self) -> &RuntimeMetadataV14 { + &self.inner.metadata + } + + /// Obtain the unique hash for a specific storage entry. + pub fn storage_hash( + &self, + ) -> Result<[u8; 32], MetadataError> { + self.inner + .cached_storage_hashes + .get_or_insert(S::PALLET, S::STORAGE, || { + subxt_metadata::get_storage_hash( + &self.inner.metadata, + S::PALLET, + S::STORAGE, + ) + .map_err(|e| { + match e { + subxt_metadata::NotFound::Pallet => MetadataError::PalletNotFound, + subxt_metadata::NotFound::Item => MetadataError::StorageNotFound, + } + }) + }) + } + + /// Obtain the unique hash for a constant. + pub fn constant_hash( + &self, + pallet: &str, + constant: &str, + ) -> Result<[u8; 32], MetadataError> { + self.inner + .cached_constant_hashes + .get_or_insert(pallet, constant, || { + subxt_metadata::get_constant_hash(&self.inner.metadata, pallet, constant) + .map_err(|e| { + match e { + subxt_metadata::NotFound::Pallet => { + MetadataError::PalletNotFound + } + subxt_metadata::NotFound::Item => { + MetadataError::ConstantNotFound + } + } + }) + }) + } + + /// Obtain the unique hash for a call. + pub fn call_hash(&self) -> Result<[u8; 32], MetadataError> { + self.inner + .cached_call_hashes + .get_or_insert(C::PALLET, C::FUNCTION, || { + subxt_metadata::get_call_hash( + &self.inner.metadata, + C::PALLET, + C::FUNCTION, + ) + .map_err(|e| { + match e { + subxt_metadata::NotFound::Pallet => MetadataError::PalletNotFound, + subxt_metadata::NotFound::Item => MetadataError::CallNotFound, + } + }) + }) + } + + /// Obtain the unique hash for this metadata. + pub fn metadata_hash>(&self, pallets: &[T]) -> [u8; 32] { + if let Some(hash) = *self.inner.cached_metadata_hash.read().unwrap() { + return hash + } + + let hash = subxt_metadata::get_metadata_per_pallet_hash( + self.runtime_metadata(), + pallets, + ); + *self.inner.cached_metadata_hash.write().unwrap() = Some(hash); + + hash } } @@ -159,28 +261,26 @@ impl PalletMetadata { let fn_index = *self .calls .get(C::FUNCTION) - .ok_or(MetadataError::CallNotFound(C::FUNCTION))?; + .ok_or(MetadataError::CallNotFound)?; Ok(fn_index) } /// Return [`StorageEntryMetadata`] given some storage key. pub fn storage( &self, - key: &'static str, + key: &str, ) -> Result<&StorageEntryMetadata, MetadataError> { - self.storage - .get(key) - .ok_or(MetadataError::StorageNotFound(key)) + self.storage.get(key).ok_or(MetadataError::StorageNotFound) } /// Get a constant's metadata by name. pub fn constant( &self, - key: &'static str, + key: &str, ) -> Result<&PalletConstantMetadata, MetadataError> { self.constants .get(key) - .ok_or(MetadataError::ConstantNotFound(key)) + .ok_or(MetadataError::ConstantNotFound) } } @@ -359,11 +459,134 @@ impl TryFrom for Metadata { }) .collect(); - Ok(Self { - metadata, - pallets, - events, - errors, + Ok(Metadata { + inner: Arc::new(MetadataInner { + metadata, + pallets, + events, + errors, + cached_metadata_hash: Default::default(), + cached_call_hashes: Default::default(), + cached_constant_hashes: Default::default(), + cached_storage_hashes: Default::default(), + }), }) } } + +#[cfg(test)] +mod tests { + use super::*; + use crate::StorageEntryKey; + + fn load_metadata() -> Metadata { + let bytes = test_runtime::METADATA; + let meta: RuntimeMetadataPrefixed = + codec::Decode::decode(&mut &*bytes).expect("Cannot decode scale metadata"); + + Metadata::try_from(meta) + .expect("Cannot translate runtime metadata to internal Metadata") + } + + #[test] + fn metadata_inner_cache() { + // Note: Dependency on test_runtime can be removed if complex metadata + // is manually constructed. + let metadata = load_metadata(); + + let hash = metadata.metadata_hash(&["System"]); + // Check inner caching. + assert_eq!( + metadata.inner.cached_metadata_hash.read().unwrap().unwrap(), + hash + ); + + // Currently the caching does not take into account different pallets + // as the intended behavior is to use this method only once. + // Enforce this behavior into testing. + let hash_old = metadata.metadata_hash(&["Balances"]); + assert_eq!(hash_old, hash); + } + + #[test] + fn metadata_call_inner_cache() { + let metadata = load_metadata(); + + #[derive(codec::Encode)] + struct ValidCall; + impl crate::Call for ValidCall { + const PALLET: &'static str = "System"; + const FUNCTION: &'static str = "fill_block"; + } + + let hash = metadata.call_hash::(); + + let mut call_number = 0; + let hash_cached = metadata.inner.cached_call_hashes.get_or_insert( + "System", + "fill_block", + || -> Result<[u8; 32], MetadataError> { + call_number += 1; + Ok([0; 32]) + }, + ); + + // Check function is never called (e.i, value fetched from cache). + assert_eq!(call_number, 0); + assert_eq!(hash.unwrap(), hash_cached.unwrap()); + } + + #[test] + fn metadata_constant_inner_cache() { + let metadata = load_metadata(); + + let hash = metadata.constant_hash("System", "BlockWeights"); + + let mut call_number = 0; + let hash_cached = metadata.inner.cached_constant_hashes.get_or_insert( + "System", + "BlockWeights", + || -> Result<[u8; 32], MetadataError> { + call_number += 1; + Ok([0; 32]) + }, + ); + + // Check function is never called (e.i, value fetched from cache). + assert_eq!(call_number, 0); + assert_eq!(hash.unwrap(), hash_cached.unwrap()); + } + + #[test] + fn metadata_storage_inner_cache() { + let metadata = load_metadata(); + + #[derive(codec::Encode)] + struct ValidStorage; + impl crate::StorageEntry for ValidStorage { + const PALLET: &'static str = "System"; + const STORAGE: &'static str = "Account"; + type Value = (); + + fn key(&self) -> StorageEntryKey { + unreachable!("Should not be called"); + } + } + + let hash = metadata.storage_hash::(); + + let mut call_number = 0; + let hash_cached = metadata.inner.cached_storage_hashes.get_or_insert( + "System", + "Account", + || -> Result<[u8; 32], MetadataError> { + call_number += 1; + Ok([0; 32]) + }, + ); + + // Check function is never called (e.i, value fetched from cache). + assert_eq!(call_number, 0); + assert_eq!(hash.unwrap(), hash_cached.unwrap()); + } +} diff --git a/subxt/src/metadata/mod.rs b/subxt/src/metadata/mod.rs new file mode 100644 index 0000000000..fb03ace74b --- /dev/null +++ b/subxt/src/metadata/mod.rs @@ -0,0 +1,27 @@ +// Copyright 2019-2022 Parity Technologies (UK) Ltd. +// This file is part of subxt. +// +// subxt is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// subxt is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with subxt. If not, see . + +mod hash_cache; +mod metadata_type; + +pub use metadata_type::{ + ErrorMetadata, + EventMetadata, + InvalidMetadataError, + Metadata, + MetadataError, + PalletMetadata, +}; diff --git a/subxt/tests/integration/codegen/polkadot.rs b/subxt/tests/integration/codegen/polkadot.rs index b15d7029de..d9dc9e17a8 100644 --- a/subxt/tests/integration/codegen/polkadot.rs +++ b/subxt/tests/integration/codegen/polkadot.rs @@ -1,6 +1,59 @@ #[allow(dead_code, unused_imports, non_camel_case_types)] pub mod api { use super::api as root_mod; + pub static PALLETS: [&str; 51usize] = [ + "System", + "Scheduler", + "Preimage", + "Babe", + "Timestamp", + "Indices", + "Balances", + "TransactionPayment", + "Authorship", + "Staking", + "Offences", + "Historical", + "Session", + "Grandpa", + "ImOnline", + "AuthorityDiscovery", + "Democracy", + "Council", + "TechnicalCommittee", + "PhragmenElection", + "TechnicalMembership", + "Treasury", + "Claims", + "Vesting", + "Utility", + "Identity", + "Proxy", + "Multisig", + "Bounties", + "ChildBounties", + "Tips", + "ElectionProviderMultiPhase", + "BagsList", + "ParachainsOrigin", + "Configuration", + "ParasShared", + "ParaInclusion", + "ParaInherent", + "ParaScheduler", + "Paras", + "Initializer", + "Dmp", + "Ump", + "Hrmp", + "ParaSessionInfo", + "ParasDisputes", + "Registrar", + "Slots", + "Auctions", + "Crowdloan", + "XcmPallet", + ]; #[derive(:: subxt :: codec :: Encode, :: subxt :: codec :: Decode, Debug)] pub enum Event { #[codec(index = 0)] @@ -189,16 +242,30 @@ pub mod api { pub fn fill_block( &self, ratio: runtime_types::sp_arithmetic::per_things::Perbill, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - FillBlock, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + FillBlock, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = FillBlock { ratio }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 228u8, 117u8, 251u8, 95u8, 47u8, 56u8, 32u8, 177u8, 191u8, + 72u8, 75u8, 23u8, 193u8, 175u8, 227u8, 218u8, 127u8, 94u8, + 114u8, 110u8, 215u8, 61u8, 162u8, 102u8, 73u8, 89u8, 218u8, + 148u8, 59u8, 73u8, 59u8, 149u8, + ] + { + let call = FillBlock { ratio }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Make some on-chain remark."] #[doc = ""] @@ -208,31 +275,59 @@ pub mod api { pub fn remark( &self, remark: ::std::vec::Vec<::core::primitive::u8>, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Remark, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Remark, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = Remark { remark }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 186u8, 79u8, 33u8, 199u8, 216u8, 115u8, 19u8, 146u8, 220u8, + 174u8, 98u8, 61u8, 179u8, 230u8, 40u8, 70u8, 22u8, 251u8, + 77u8, 62u8, 133u8, 80u8, 186u8, 70u8, 135u8, 172u8, 178u8, + 241u8, 69u8, 106u8, 235u8, 140u8, + ] + { + let call = Remark { remark }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set the number of pages in the WebAssembly environment's heap."] pub fn set_heap_pages( &self, pages: ::core::primitive::u64, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetHeapPages, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetHeapPages, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetHeapPages { pages }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 77u8, 138u8, 122u8, 55u8, 179u8, 101u8, 60u8, 137u8, 173u8, + 39u8, 28u8, 36u8, 237u8, 243u8, 232u8, 162u8, 76u8, 176u8, + 135u8, 58u8, 60u8, 177u8, 105u8, 136u8, 94u8, 53u8, 26u8, + 31u8, 41u8, 156u8, 228u8, 241u8, + ] + { + let call = SetHeapPages { pages }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set the new runtime code."] #[doc = ""] @@ -249,16 +344,30 @@ pub mod api { pub fn set_code( &self, code: ::std::vec::Vec<::core::primitive::u8>, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetCode, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetCode, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetCode { code }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 35u8, 75u8, 103u8, 203u8, 91u8, 141u8, 77u8, 95u8, 37u8, + 157u8, 107u8, 240u8, 54u8, 242u8, 245u8, 205u8, 104u8, 165u8, + 177u8, 37u8, 86u8, 197u8, 28u8, 202u8, 121u8, 159u8, 18u8, + 204u8, 237u8, 117u8, 141u8, 131u8, + ] + { + let call = SetCode { code }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set the new runtime code without doing any checks of the given `code`."] #[doc = ""] @@ -272,16 +381,30 @@ pub mod api { pub fn set_code_without_checks( &self, code: ::std::vec::Vec<::core::primitive::u8>, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetCodeWithoutChecks, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetCodeWithoutChecks, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetCodeWithoutChecks { code }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 150u8, 148u8, 119u8, 129u8, 77u8, 216u8, 135u8, 187u8, 127u8, + 24u8, 238u8, 15u8, 227u8, 229u8, 191u8, 217u8, 106u8, 129u8, + 149u8, 79u8, 154u8, 78u8, 53u8, 159u8, 89u8, 69u8, 103u8, + 197u8, 93u8, 161u8, 134u8, 17u8, + ] + { + let call = SetCodeWithoutChecks { code }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set some items of storage."] pub fn set_storage( @@ -290,31 +413,59 @@ pub mod api { ::std::vec::Vec<::core::primitive::u8>, ::std::vec::Vec<::core::primitive::u8>, )>, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetStorage, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetStorage, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetStorage { items }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 197u8, 12u8, 119u8, 205u8, 152u8, 103u8, 211u8, 170u8, 146u8, + 253u8, 25u8, 56u8, 180u8, 146u8, 74u8, 75u8, 38u8, 108u8, + 212u8, 154u8, 23u8, 22u8, 148u8, 175u8, 107u8, 186u8, 222u8, + 13u8, 149u8, 132u8, 204u8, 217u8, + ] + { + let call = SetStorage { items }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Kill some items from storage."] pub fn kill_storage( &self, keys: ::std::vec::Vec<::std::vec::Vec<::core::primitive::u8>>, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - KillStorage, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + KillStorage, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = KillStorage { keys }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 154u8, 115u8, 185u8, 20u8, 126u8, 90u8, 222u8, 131u8, 199u8, + 57u8, 184u8, 226u8, 43u8, 245u8, 161u8, 176u8, 194u8, 123u8, + 139u8, 97u8, 97u8, 94u8, 47u8, 64u8, 204u8, 96u8, 190u8, + 94u8, 216u8, 237u8, 69u8, 51u8, + ] + { + let call = KillStorage { keys }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Kill all storage items with a key that starts with the given prefix."] #[doc = ""] @@ -324,31 +475,59 @@ pub mod api { &self, prefix: ::std::vec::Vec<::core::primitive::u8>, subkeys: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - KillPrefix, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + KillPrefix, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = KillPrefix { prefix, subkeys }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 214u8, 101u8, 191u8, 241u8, 1u8, 241u8, 144u8, 116u8, 246u8, + 199u8, 159u8, 249u8, 155u8, 164u8, 220u8, 221u8, 75u8, 33u8, + 204u8, 3u8, 255u8, 201u8, 187u8, 238u8, 181u8, 213u8, 41u8, + 105u8, 234u8, 120u8, 202u8, 115u8, + ] + { + let call = KillPrefix { prefix, subkeys }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Make some on-chain remark and emit event."] pub fn remark_with_event( &self, remark: ::std::vec::Vec<::core::primitive::u8>, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - RemarkWithEvent, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + RemarkWithEvent, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = RemarkWithEvent { remark }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 171u8, 82u8, 75u8, 237u8, 69u8, 197u8, 223u8, 125u8, 123u8, + 51u8, 241u8, 35u8, 202u8, 210u8, 227u8, 109u8, 1u8, 241u8, + 255u8, 63u8, 33u8, 115u8, 156u8, 239u8, 97u8, 76u8, 193u8, + 35u8, 74u8, 199u8, 43u8, 255u8, + ] + { + let call = RemarkWithEvent { remark }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -590,7 +769,7 @@ pub mod api { pub async fn account( &self, _0: &::subxt::sp_core::crypto::AccountId32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< runtime_types::frame_system::AccountInfo< ::core::primitive::u32, @@ -600,124 +779,277 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = Account(_0); - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 224u8, 184u8, 2u8, 14u8, 38u8, 177u8, 223u8, 98u8, 223u8, + 15u8, 130u8, 23u8, 212u8, 69u8, 61u8, 165u8, 171u8, 61u8, + 171u8, 57u8, 88u8, 71u8, 168u8, 172u8, 54u8, 91u8, 109u8, + 231u8, 169u8, 167u8, 195u8, 46u8, + ] + { + let entry = Account(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The full account information for a particular account ID."] pub async fn account_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Account<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 224u8, 184u8, 2u8, 14u8, 38u8, 177u8, 223u8, 98u8, 223u8, + 15u8, 130u8, 23u8, 212u8, 69u8, 61u8, 165u8, 171u8, 61u8, + 171u8, 57u8, 88u8, 71u8, 168u8, 172u8, 54u8, 91u8, 109u8, + 231u8, 169u8, 167u8, 195u8, 46u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Total extrinsics count for the current block."] pub async fn extrinsic_count( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<::core::primitive::u32>, ::subxt::BasicError, > { - let entry = ExtrinsicCount; - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 223u8, 60u8, 201u8, 120u8, 36u8, 44u8, 180u8, 210u8, 242u8, + 53u8, 222u8, 154u8, 123u8, 176u8, 249u8, 8u8, 225u8, 28u8, + 232u8, 4u8, 136u8, 41u8, 151u8, 82u8, 189u8, 149u8, 49u8, + 166u8, 139u8, 9u8, 163u8, 231u8, + ] + { + let entry = ExtrinsicCount; + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The current weight for the block."] pub async fn block_weight( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< runtime_types::frame_support::weights::PerDispatchClass< ::core::primitive::u64, >, ::subxt::BasicError, > { - let entry = BlockWeight; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 2u8, 236u8, 190u8, 174u8, 244u8, 98u8, 194u8, 168u8, 89u8, + 208u8, 7u8, 45u8, 175u8, 171u8, 177u8, 121u8, 215u8, 190u8, + 184u8, 195u8, 49u8, 133u8, 44u8, 1u8, 181u8, 215u8, 89u8, + 84u8, 255u8, 16u8, 57u8, 152u8, + ] + { + let entry = BlockWeight; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Total length (in bytes) for all extrinsics put together, for the current block."] pub async fn all_extrinsics_len( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<::core::primitive::u32>, ::subxt::BasicError, > { - let entry = AllExtrinsicsLen; - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 202u8, 145u8, 209u8, 225u8, 40u8, 220u8, 174u8, 74u8, 93u8, + 164u8, 254u8, 248u8, 254u8, 192u8, 32u8, 117u8, 96u8, 149u8, + 53u8, 145u8, 219u8, 64u8, 234u8, 18u8, 217u8, 200u8, 203u8, + 141u8, 145u8, 28u8, 134u8, 60u8, + ] + { + let entry = AllExtrinsicsLen; + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Map of block numbers to block hashes."] pub async fn block_hash( &self, _0: &::core::primitive::u32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::subxt::sp_core::H256, ::subxt::BasicError> { - let entry = BlockHash(_0); - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 24u8, 99u8, 146u8, 142u8, 205u8, 166u8, 4u8, 32u8, 218u8, + 213u8, 24u8, 236u8, 45u8, 116u8, 145u8, 204u8, 27u8, 141u8, + 169u8, 249u8, 111u8, 141u8, 37u8, 136u8, 45u8, 73u8, 167u8, + 217u8, 118u8, 206u8, 246u8, 120u8, + ] + { + let entry = BlockHash(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Map of block numbers to block hashes."] pub async fn block_hash_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, BlockHash<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 24u8, 99u8, 146u8, 142u8, 205u8, 166u8, 4u8, 32u8, 218u8, + 213u8, 24u8, 236u8, 45u8, 116u8, 145u8, 204u8, 27u8, 141u8, + 169u8, 249u8, 111u8, 141u8, 37u8, 136u8, 45u8, 73u8, 167u8, + 217u8, 118u8, 206u8, 246u8, 120u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Extrinsics data for the current block (maps an extrinsic's index to its data)."] pub async fn extrinsic_data( &self, _0: &::core::primitive::u32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec<::core::primitive::u8>, ::subxt::BasicError, > { - let entry = ExtrinsicData(_0); - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 210u8, 224u8, 211u8, 186u8, 118u8, 210u8, 185u8, 194u8, + 238u8, 211u8, 254u8, 73u8, 67u8, 184u8, 31u8, 229u8, 168u8, + 125u8, 98u8, 23u8, 241u8, 59u8, 49u8, 86u8, 126u8, 9u8, + 114u8, 163u8, 160u8, 62u8, 50u8, 67u8, + ] + { + let entry = ExtrinsicData(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Extrinsics data for the current block (maps an extrinsic's index to its data)."] pub async fn extrinsic_data_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, ExtrinsicData<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 210u8, 224u8, 211u8, 186u8, 118u8, 210u8, 185u8, 194u8, + 238u8, 211u8, 254u8, 73u8, 67u8, 184u8, 31u8, 229u8, 168u8, + 125u8, 98u8, 23u8, 241u8, 59u8, 49u8, 86u8, 126u8, 9u8, + 114u8, 163u8, 160u8, 62u8, 50u8, 67u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The current block number being processed. Set by `execute_block`."] pub async fn number( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let entry = Number; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 228u8, 96u8, 102u8, 190u8, 252u8, 130u8, 239u8, 172u8, 126u8, + 235u8, 246u8, 139u8, 208u8, 15u8, 88u8, 245u8, 141u8, 232u8, + 43u8, 204u8, 36u8, 87u8, 211u8, 141u8, 187u8, 68u8, 236u8, + 70u8, 193u8, 235u8, 164u8, 191u8, + ] + { + let entry = Number; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Hash of the previous block."] pub async fn parent_hash( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::subxt::sp_core::H256, ::subxt::BasicError> { - let entry = ParentHash; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 194u8, 221u8, 147u8, 22u8, 68u8, 141u8, 32u8, 6u8, 202u8, + 39u8, 164u8, 184u8, 69u8, 126u8, 190u8, 101u8, 215u8, 27u8, + 127u8, 157u8, 200u8, 69u8, 170u8, 139u8, 232u8, 27u8, 254u8, + 181u8, 183u8, 105u8, 111u8, 177u8, + ] + { + let entry = ParentHash; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Digest of the current block, also part of the block header."] pub async fn digest( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< runtime_types::sp_runtime::generic::digest::Digest, ::subxt::BasicError, > { - let entry = Digest; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 10u8, 176u8, 13u8, 228u8, 226u8, 42u8, 210u8, 151u8, 107u8, + 212u8, 136u8, 15u8, 38u8, 182u8, 225u8, 12u8, 250u8, 56u8, + 193u8, 243u8, 219u8, 113u8, 95u8, 233u8, 21u8, 229u8, 125u8, + 146u8, 92u8, 250u8, 32u8, 168u8, + ] + { + let entry = Digest; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Events deposited for the current block."] #[doc = ""] @@ -725,7 +1057,7 @@ pub mod api { #[doc = " from within the runtime."] pub async fn events( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec< runtime_types::frame_system::EventRecord< @@ -735,17 +1067,45 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = Events; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 51u8, 117u8, 189u8, 125u8, 155u8, 137u8, 63u8, 1u8, 80u8, + 211u8, 18u8, 228u8, 58u8, 237u8, 241u8, 176u8, 127u8, 189u8, + 246u8, 174u8, 50u8, 174u8, 102u8, 21u8, 108u8, 229u8, 132u8, + 20u8, 6u8, 205u8, 13u8, 88u8, + ] + { + let entry = Events; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The number of events in the `Events` list."] pub async fn event_count( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let entry = EventCount; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 236u8, 93u8, 90u8, 177u8, 250u8, 211u8, 138u8, 187u8, 26u8, + 208u8, 203u8, 113u8, 221u8, 233u8, 227u8, 9u8, 249u8, 25u8, + 202u8, 185u8, 161u8, 144u8, 167u8, 104u8, 127u8, 187u8, 38u8, + 18u8, 52u8, 61u8, 66u8, 112u8, + ] + { + let entry = EventCount; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Mapping between a topic (represented by T::Hash) and a vector of indexes"] #[doc = " of events in the `>` list."] @@ -760,13 +1120,27 @@ pub mod api { pub async fn event_topics( &self, _0: &::subxt::sp_core::H256, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec<(::core::primitive::u32, ::core::primitive::u32)>, ::subxt::BasicError, > { - let entry = EventTopics(_0); - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 231u8, 73u8, 172u8, 223u8, 210u8, 145u8, 151u8, 102u8, 73u8, + 23u8, 140u8, 55u8, 97u8, 40u8, 219u8, 239u8, 229u8, 177u8, + 72u8, 41u8, 93u8, 178u8, 7u8, 209u8, 57u8, 86u8, 153u8, + 252u8, 86u8, 152u8, 245u8, 179u8, + ] + { + let entry = EventTopics(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Mapping between a topic (represented by T::Hash) and a vector of indexes"] #[doc = " of events in the `>` list."] @@ -780,55 +1154,125 @@ pub mod api { #[doc = " no notification will be triggered thus the event might be lost."] pub async fn event_topics_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, EventTopics<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 231u8, 73u8, 172u8, 223u8, 210u8, 145u8, 151u8, 102u8, 73u8, + 23u8, 140u8, 55u8, 97u8, 40u8, 219u8, 239u8, 229u8, 177u8, + 72u8, 41u8, 93u8, 178u8, 7u8, 209u8, 57u8, 86u8, 153u8, + 252u8, 86u8, 152u8, 245u8, 179u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Stores the `spec_version` and `spec_name` of when the last runtime upgrade happened."] pub async fn last_runtime_upgrade( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::frame_system::LastRuntimeUpgradeInfo, >, ::subxt::BasicError, > { - let entry = LastRuntimeUpgrade; - self.client.storage().fetch(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 219u8, 153u8, 158u8, 38u8, 45u8, 65u8, 151u8, 137u8, 53u8, + 76u8, 11u8, 181u8, 218u8, 248u8, 125u8, 190u8, 100u8, 240u8, + 173u8, 75u8, 179u8, 137u8, 198u8, 197u8, 248u8, 185u8, 118u8, + 58u8, 42u8, 165u8, 125u8, 119u8, + ] + { + let entry = LastRuntimeUpgrade; + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " True if we have upgraded so that `type RefCount` is `u32`. False (default) if not."] pub async fn upgraded_to_u32_ref_count( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::bool, ::subxt::BasicError> { - let entry = UpgradedToU32RefCount; - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 171u8, 88u8, 244u8, 92u8, 122u8, 67u8, 27u8, 18u8, 59u8, + 175u8, 175u8, 178u8, 20u8, 150u8, 213u8, 59u8, 222u8, 141u8, + 32u8, 107u8, 3u8, 114u8, 83u8, 250u8, 180u8, 233u8, 152u8, + 54u8, 187u8, 99u8, 131u8, 204u8, + ] + { + let entry = UpgradedToU32RefCount; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " True if we have upgraded so that AccountInfo contains three types of `RefCount`. False"] #[doc = " (default) if not."] pub async fn upgraded_to_triple_ref_count( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::bool, ::subxt::BasicError> { - let entry = UpgradedToTripleRefCount; - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 90u8, 33u8, 56u8, 86u8, 90u8, 101u8, 89u8, 133u8, 203u8, + 56u8, 201u8, 210u8, 244u8, 232u8, 150u8, 18u8, 51u8, 105u8, + 14u8, 230u8, 103u8, 155u8, 246u8, 99u8, 53u8, 207u8, 225u8, + 128u8, 186u8, 76u8, 40u8, 185u8, + ] + { + let entry = UpgradedToTripleRefCount; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The execution phase of the block."] pub async fn execution_phase( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option, ::subxt::BasicError, > { - let entry = ExecutionPhase; - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 174u8, 13u8, 230u8, 220u8, 239u8, 161u8, 172u8, 122u8, 188u8, + 95u8, 141u8, 118u8, 91u8, 158u8, 111u8, 145u8, 243u8, 173u8, + 226u8, 212u8, 187u8, 118u8, 94u8, 132u8, 221u8, 244u8, 61u8, + 148u8, 217u8, 30u8, 238u8, 225u8, + ] + { + let entry = ExecutionPhase; + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -848,10 +1292,25 @@ pub mod api { runtime_types::frame_system::limits::BlockWeights, ::subxt::BasicError, > { - let pallet = self.client.metadata().pallet("System")?; - let constant = pallet.constant("BlockWeights")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("System", "BlockWeights")? + == [ + 204u8, 48u8, 167u8, 131u8, 33u8, 100u8, 198u8, 189u8, 195u8, + 1u8, 117u8, 121u8, 184u8, 221u8, 144u8, 199u8, 43u8, 212u8, + 40u8, 31u8, 121u8, 47u8, 154u8, 102u8, 87u8, 136u8, 106u8, + 147u8, 213u8, 167u8, 193u8, 209u8, + ] + { + let pallet = self.client.metadata().pallet("System")?; + let constant = pallet.constant("BlockWeights")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The maximum length of a block (in bytes)."] pub fn block_length( @@ -860,20 +1319,50 @@ pub mod api { runtime_types::frame_system::limits::BlockLength, ::subxt::BasicError, > { - let pallet = self.client.metadata().pallet("System")?; - let constant = pallet.constant("BlockLength")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("System", "BlockLength")? + == [ + 162u8, 232u8, 19u8, 135u8, 181u8, 6u8, 183u8, 230u8, 146u8, + 3u8, 140u8, 106u8, 44u8, 46u8, 50u8, 144u8, 239u8, 69u8, + 100u8, 195u8, 13u8, 73u8, 52u8, 140u8, 204u8, 91u8, 32u8, + 153u8, 179u8, 7u8, 207u8, 49u8, + ] + { + let pallet = self.client.metadata().pallet("System")?; + let constant = pallet.constant("BlockLength")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Maximum number of block number to block hash mappings to keep (oldest pruned first)."] pub fn block_hash_count( &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("System")?; - let constant = pallet.constant("BlockHashCount")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("System", "BlockHashCount")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("System")?; + let constant = pallet.constant("BlockHashCount")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The weight of runtime database operations the runtime can invoke."] pub fn db_weight( @@ -882,10 +1371,22 @@ pub mod api { runtime_types::frame_support::weights::RuntimeDbWeight, ::subxt::BasicError, > { - let pallet = self.client.metadata().pallet("System")?; - let constant = pallet.constant("DbWeight")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self.client.metadata().constant_hash("System", "DbWeight")? + == [ + 148u8, 162u8, 51u8, 245u8, 246u8, 116u8, 90u8, 22u8, 43u8, + 254u8, 84u8, 59u8, 121u8, 135u8, 46u8, 37u8, 5u8, 71u8, + 146u8, 64u8, 252u8, 95u8, 226u8, 64u8, 137u8, 198u8, 222u8, + 159u8, 14u8, 92u8, 175u8, 174u8, + ] + { + let pallet = self.client.metadata().pallet("System")?; + let constant = pallet.constant("DbWeight")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Get the chain's current version."] pub fn version( @@ -894,10 +1395,22 @@ pub mod api { runtime_types::sp_version::RuntimeVersion, ::subxt::BasicError, > { - let pallet = self.client.metadata().pallet("System")?; - let constant = pallet.constant("Version")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self.client.metadata().constant_hash("System", "Version")? + == [ + 121u8, 146u8, 105u8, 234u8, 154u8, 125u8, 117u8, 194u8, + 183u8, 62u8, 171u8, 26u8, 86u8, 200u8, 90u8, 254u8, 176u8, + 67u8, 111u8, 241u8, 185u8, 244u8, 208u8, 140u8, 94u8, 2u8, + 48u8, 138u8, 231u8, 151u8, 157u8, 217u8, + ] + { + let pallet = self.client.metadata().pallet("System")?; + let constant = pallet.constant("Version")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The designated SS85 prefix of this chain."] #[doc = ""] @@ -908,10 +1421,25 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u16, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("System")?; - let constant = pallet.constant("SS58Prefix")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("System", "SS58Prefix")? + == [ + 116u8, 33u8, 2u8, 170u8, 181u8, 147u8, 171u8, 169u8, 167u8, + 227u8, 41u8, 144u8, 11u8, 236u8, 82u8, 100u8, 74u8, 60u8, + 184u8, 72u8, 169u8, 90u8, 208u8, 135u8, 15u8, 117u8, 10u8, + 123u8, 128u8, 193u8, 29u8, 70u8, + ] + { + let pallet = self.client.metadata().pallet("System")?; + let constant = pallet.constant("SS58Prefix")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -1050,37 +1578,65 @@ pub mod api { runtime_types::polkadot_runtime::Call, ::subxt::sp_core::H256, >, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Schedule, - DispatchError, - root_mod::Event, - > { - let call = Schedule { - when, - maybe_periodic, - priority, - call: ::std::boxed::Box::new(call), - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Schedule, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 171u8, 203u8, 174u8, 141u8, 138u8, 30u8, 100u8, 95u8, 14u8, + 2u8, 34u8, 14u8, 199u8, 60u8, 129u8, 160u8, 8u8, 166u8, 4u8, + 20u8, 41u8, 86u8, 21u8, 73u8, 222u8, 151u8, 179u8, 209u8, + 74u8, 31u8, 71u8, 73u8, + ] + { + let call = Schedule { + when, + maybe_periodic, + priority, + call: ::std::boxed::Box::new(call), + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Cancel an anonymously scheduled task."] pub fn cancel( &self, when: ::core::primitive::u32, index: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Cancel, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Cancel, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = Cancel { when, index }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 118u8, 0u8, 188u8, 218u8, 148u8, 86u8, 139u8, 15u8, 3u8, + 161u8, 6u8, 150u8, 46u8, 32u8, 85u8, 179u8, 106u8, 113u8, + 240u8, 115u8, 167u8, 114u8, 243u8, 69u8, 103u8, 60u8, 99u8, + 135u8, 21u8, 8u8, 19u8, 225u8, + ] + { + let call = Cancel { when, index }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Schedule a named task."] pub fn schedule_named( @@ -1096,37 +1652,65 @@ pub mod api { runtime_types::polkadot_runtime::Call, ::subxt::sp_core::H256, >, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ScheduleNamed, - DispatchError, - root_mod::Event, - > { - let call = ScheduleNamed { - id, - when, - maybe_periodic, - priority, - call: ::std::boxed::Box::new(call), - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ScheduleNamed, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 47u8, 156u8, 239u8, 248u8, 198u8, 13u8, 10u8, 156u8, 176u8, + 254u8, 247u8, 152u8, 108u8, 255u8, 224u8, 185u8, 109u8, 56u8, + 233u8, 5u8, 73u8, 230u8, 151u8, 97u8, 125u8, 183u8, 4u8, + 202u8, 163u8, 3u8, 70u8, 221u8, + ] + { + let call = ScheduleNamed { + id, + when, + maybe_periodic, + priority, + call: ::std::boxed::Box::new(call), + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Cancel a named scheduled task."] pub fn cancel_named( &self, id: ::std::vec::Vec<::core::primitive::u8>, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - CancelNamed, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + CancelNamed, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = CancelNamed { id }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 118u8, 221u8, 232u8, 126u8, 67u8, 134u8, 33u8, 7u8, 224u8, + 110u8, 181u8, 18u8, 57u8, 39u8, 15u8, 64u8, 90u8, 132u8, 2u8, + 238u8, 19u8, 241u8, 194u8, 120u8, 5u8, 109u8, 74u8, 205u8, + 42u8, 244u8, 99u8, 54u8, + ] + { + let call = CancelNamed { id }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Anonymously schedule a task after a delay."] #[doc = ""] @@ -1145,21 +1729,35 @@ pub mod api { runtime_types::polkadot_runtime::Call, ::subxt::sp_core::H256, >, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ScheduleAfter, - DispatchError, - root_mod::Event, - > { - let call = ScheduleAfter { - after, - maybe_periodic, - priority, - call: ::std::boxed::Box::new(call), - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ScheduleAfter, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 150u8, 70u8, 131u8, 52u8, 50u8, 73u8, 176u8, 193u8, 17u8, + 31u8, 218u8, 113u8, 220u8, 23u8, 160u8, 196u8, 100u8, 27u8, + 193u8, 79u8, 254u8, 68u8, 22u8, 216u8, 157u8, 136u8, 233u8, + 98u8, 46u8, 220u8, 121u8, 29u8, + ] + { + let call = ScheduleAfter { + after, + maybe_periodic, + priority, + call: ::std::boxed::Box::new(call), + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Schedule a named task after a delay."] #[doc = ""] @@ -1179,22 +1777,36 @@ pub mod api { runtime_types::polkadot_runtime::Call, ::subxt::sp_core::H256, >, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ScheduleNamedAfter, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ScheduleNamedAfter, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ScheduleNamedAfter { - id, - after, - maybe_periodic, - priority, - call: ::std::boxed::Box::new(call), - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 127u8, 121u8, 141u8, 162u8, 95u8, 211u8, 214u8, 15u8, 22u8, + 28u8, 23u8, 71u8, 92u8, 58u8, 249u8, 163u8, 216u8, 85u8, + 155u8, 88u8, 161u8, 113u8, 153u8, 200u8, 248u8, 168u8, 121u8, + 124u8, 131u8, 122u8, 232u8, 160u8, + ] + { + let call = ScheduleNamedAfter { + id, + after, + maybe_periodic, + priority, + call: ::std::boxed::Box::new(call), + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -1290,25 +1902,50 @@ pub mod api { pub fn new(client: &'a ::subxt::Client) -> Self { Self { client } } - #[doc = " Items to be executed, indexed by the block number that they should be executed on."] pub async fn agenda (& self , _0 : & :: core :: primitive :: u32 , hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < :: std :: vec :: Vec < :: core :: option :: Option < runtime_types :: pallet_scheduler :: ScheduledV3 < runtime_types :: frame_support :: traits :: schedule :: MaybeHashed < runtime_types :: polkadot_runtime :: Call , :: subxt :: sp_core :: H256 > , :: core :: primitive :: u32 , runtime_types :: polkadot_runtime :: OriginCaller , :: subxt :: sp_core :: crypto :: AccountId32 > > > , :: subxt :: BasicError >{ - let entry = Agenda(_0); - self.client.storage().fetch_or_default(&entry, hash).await + #[doc = " Items to be executed, indexed by the block number that they should be executed on."] pub async fn agenda (& self , _0 : & :: core :: primitive :: u32 , block_hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < :: std :: vec :: Vec < :: core :: option :: Option < runtime_types :: pallet_scheduler :: ScheduledV3 < runtime_types :: frame_support :: traits :: schedule :: MaybeHashed < runtime_types :: polkadot_runtime :: Call , :: subxt :: sp_core :: H256 > , :: core :: primitive :: u32 , runtime_types :: polkadot_runtime :: OriginCaller , :: subxt :: sp_core :: crypto :: AccountId32 > > > , :: subxt :: BasicError >{ + if self.client.metadata().storage_hash::()? + == [ + 235u8, 95u8, 118u8, 134u8, 98u8, 235u8, 250u8, 110u8, 250u8, + 7u8, 75u8, 190u8, 53u8, 194u8, 153u8, 51u8, 125u8, 69u8, + 46u8, 232u8, 63u8, 132u8, 47u8, 167u8, 210u8, 46u8, 43u8, + 142u8, 255u8, 252u8, 99u8, 253u8, + ] + { + let entry = Agenda(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Items to be executed, indexed by the block number that they should be executed on."] pub async fn agenda_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Agenda<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 235u8, 95u8, 118u8, 134u8, 98u8, 235u8, 250u8, 110u8, 250u8, + 7u8, 75u8, 190u8, 53u8, 194u8, 153u8, 51u8, 125u8, 69u8, + 46u8, 232u8, 63u8, 132u8, 47u8, 167u8, 210u8, 46u8, 43u8, + 142u8, 255u8, 252u8, 99u8, 253u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Lookup from identity to the block number and index of the task."] pub async fn lookup( &self, _0: &[::core::primitive::u8], - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<( ::core::primitive::u32, @@ -1316,18 +1953,40 @@ pub mod api { )>, ::subxt::BasicError, > { - let entry = Lookup(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 56u8, 105u8, 156u8, 110u8, 251u8, 141u8, 219u8, 56u8, 131u8, + 57u8, 180u8, 33u8, 48u8, 30u8, 193u8, 194u8, 169u8, 182u8, + 168u8, 43u8, 36u8, 202u8, 222u8, 182u8, 41u8, 216u8, 222u8, + 1u8, 72u8, 165u8, 62u8, 166u8, + ] + { + let entry = Lookup(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Lookup from identity to the block number and index of the task."] pub async fn lookup_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Lookup<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 56u8, 105u8, 156u8, 110u8, 251u8, 141u8, 219u8, 56u8, 131u8, + 57u8, 180u8, 33u8, 48u8, 30u8, 193u8, 194u8, 169u8, 182u8, + 168u8, 43u8, 36u8, 202u8, 222u8, 182u8, 41u8, 216u8, 222u8, + 1u8, 72u8, 165u8, 62u8, 166u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -1346,10 +2005,25 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u64, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Scheduler")?; - let constant = pallet.constant("MaximumWeight")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Scheduler", "MaximumWeight")? + == [ + 128u8, 214u8, 205u8, 242u8, 181u8, 142u8, 124u8, 231u8, + 190u8, 146u8, 59u8, 226u8, 157u8, 101u8, 103u8, 117u8, 249u8, + 65u8, 18u8, 191u8, 103u8, 119u8, 53u8, 85u8, 81u8, 96u8, + 220u8, 42u8, 184u8, 239u8, 42u8, 246u8, + ] + { + let pallet = self.client.metadata().pallet("Scheduler")?; + let constant = pallet.constant("MaximumWeight")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The maximum number of scheduled calls in the queue for a single block."] #[doc = " Not strictly enforced, but used for weight estimation."] @@ -1357,10 +2031,25 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Scheduler")?; - let constant = pallet.constant("MaxScheduledPerBlock")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Scheduler", "MaxScheduledPerBlock")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Scheduler")?; + let constant = pallet.constant("MaxScheduledPerBlock")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -1430,31 +2119,59 @@ pub mod api { pub fn note_preimage( &self, bytes: ::std::vec::Vec<::core::primitive::u8>, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - NotePreimage, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + NotePreimage, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = NotePreimage { bytes }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 116u8, 66u8, 88u8, 251u8, 187u8, 86u8, 82u8, 136u8, 215u8, + 82u8, 240u8, 255u8, 70u8, 190u8, 116u8, 187u8, 232u8, 168u8, + 125u8, 234u8, 8u8, 21u8, 247u8, 195u8, 167u8, 237u8, 27u8, + 202u8, 123u8, 25u8, 225u8, 131u8, + ] + { + let call = NotePreimage { bytes }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Clear an unrequested preimage from the runtime storage."] pub fn unnote_preimage( &self, hash: ::subxt::sp_core::H256, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - UnnotePreimage, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + UnnotePreimage, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = UnnotePreimage { hash }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 162u8, 195u8, 220u8, 134u8, 147u8, 150u8, 145u8, 130u8, + 231u8, 104u8, 83u8, 70u8, 42u8, 90u8, 248u8, 61u8, 223u8, + 63u8, 162u8, 219u8, 92u8, 248u8, 179u8, 99u8, 158u8, 252u8, + 89u8, 59u8, 115u8, 130u8, 73u8, 21u8, + ] + { + let call = UnnotePreimage { hash }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Request a preimage be uploaded to the chain without paying any fees or deposits."] #[doc = ""] @@ -1463,16 +2180,30 @@ pub mod api { pub fn request_preimage( &self, hash: ::subxt::sp_core::H256, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - RequestPreimage, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + RequestPreimage, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = RequestPreimage { hash }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 186u8, 108u8, 235u8, 145u8, 104u8, 29u8, 22u8, 33u8, 21u8, + 121u8, 32u8, 75u8, 141u8, 125u8, 205u8, 186u8, 210u8, 184u8, + 134u8, 248u8, 74u8, 175u8, 104u8, 91u8, 247u8, 151u8, 70u8, + 192u8, 183u8, 163u8, 245u8, 180u8, + ] + { + let call = RequestPreimage { hash }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Clear a previously made request for a preimage."] #[doc = ""] @@ -1480,16 +2211,30 @@ pub mod api { pub fn unrequest_preimage( &self, hash: ::subxt::sp_core::H256, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - UnrequestPreimage, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + UnrequestPreimage, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = UnrequestPreimage { hash }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 160u8, 6u8, 6u8, 198u8, 77u8, 37u8, 28u8, 86u8, 240u8, 160u8, + 128u8, 123u8, 144u8, 150u8, 150u8, 60u8, 107u8, 148u8, 189u8, + 192u8, 125u8, 25u8, 55u8, 212u8, 193u8, 212u8, 198u8, 131u8, + 113u8, 37u8, 213u8, 152u8, + ] + { + let call = UnrequestPreimage { hash }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -1567,7 +2312,7 @@ pub mod api { pub async fn status_for( &self, _0: &::subxt::sp_core::H256, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::pallet_preimage::RequestStatus< @@ -1577,24 +2322,46 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = StatusFor(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 239u8, 53u8, 52u8, 248u8, 196u8, 74u8, 99u8, 113u8, 135u8, + 186u8, 100u8, 46u8, 246u8, 245u8, 160u8, 102u8, 81u8, 96u8, + 85u8, 11u8, 27u8, 53u8, 139u8, 8u8, 18u8, 208u8, 241u8, + 139u8, 162u8, 239u8, 113u8, 28u8, + ] + { + let entry = StatusFor(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The request status of a given hash."] pub async fn status_for_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, StatusFor<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 239u8, 53u8, 52u8, 248u8, 196u8, 74u8, 99u8, 113u8, 135u8, + 186u8, 100u8, 46u8, 246u8, 245u8, 160u8, 102u8, 81u8, 96u8, + 85u8, 11u8, 27u8, 53u8, 139u8, 8u8, 18u8, 208u8, 241u8, + 139u8, 162u8, 239u8, 113u8, 28u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The preimages stored by this pallet."] pub async fn preimage_for( &self, _0: &::subxt::sp_core::H256, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::frame_support::storage::bounded_vec::BoundedVec< @@ -1603,18 +2370,40 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = PreimageFor(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 153u8, 48u8, 185u8, 144u8, 57u8, 68u8, 133u8, 92u8, 225u8, + 172u8, 36u8, 62u8, 152u8, 162u8, 15u8, 139u8, 140u8, 82u8, + 118u8, 63u8, 31u8, 158u8, 197u8, 26u8, 141u8, 210u8, 150u8, + 82u8, 109u8, 100u8, 144u8, 56u8, + ] + { + let entry = PreimageFor(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The preimages stored by this pallet."] pub async fn preimage_for_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, PreimageFor<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 153u8, 48u8, 185u8, 144u8, 57u8, 68u8, 133u8, 92u8, 225u8, + 172u8, 36u8, 62u8, 152u8, 162u8, 15u8, 139u8, 140u8, 82u8, + 118u8, 63u8, 31u8, 158u8, 197u8, 26u8, 141u8, 210u8, 150u8, + 82u8, 109u8, 100u8, 144u8, 56u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -1696,19 +2485,35 @@ pub mod api { &self, equivocation_proof : runtime_types :: sp_consensus_slots :: EquivocationProof < runtime_types :: sp_runtime :: generic :: header :: Header < :: core :: primitive :: u32 , runtime_types :: sp_runtime :: traits :: BlakeTwo256 > , runtime_types :: sp_consensus_babe :: app :: Public >, key_owner_proof: runtime_types::sp_session::MembershipProof, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ReportEquivocation, - DispatchError, - root_mod::Event, - > { - let call = ReportEquivocation { - equivocation_proof: ::std::boxed::Box::new(equivocation_proof), - key_owner_proof, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ReportEquivocation, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 123u8, 212u8, 216u8, 77u8, 79u8, 132u8, 201u8, 155u8, 166u8, + 230u8, 50u8, 89u8, 98u8, 68u8, 56u8, 213u8, 206u8, 245u8, + 91u8, 104u8, 89u8, 189u8, 57u8, 38u8, 127u8, 22u8, 47u8, + 206u8, 142u8, 202u8, 106u8, 154u8, + ] + { + let call = ReportEquivocation { + equivocation_proof: ::std::boxed::Box::new( + equivocation_proof, + ), + key_owner_proof, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Report authority equivocation/misbehavior. This method will verify"] #[doc = "the equivocation proof and validate the given key ownership proof"] @@ -1722,19 +2527,38 @@ pub mod api { &self, equivocation_proof : runtime_types :: sp_consensus_slots :: EquivocationProof < runtime_types :: sp_runtime :: generic :: header :: Header < :: core :: primitive :: u32 , runtime_types :: sp_runtime :: traits :: BlakeTwo256 > , runtime_types :: sp_consensus_babe :: app :: Public >, key_owner_proof: runtime_types::sp_session::MembershipProof, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ReportEquivocationUnsigned, - DispatchError, - root_mod::Event, - > { - let call = ReportEquivocationUnsigned { - equivocation_proof: ::std::boxed::Box::new(equivocation_proof), - key_owner_proof, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ReportEquivocationUnsigned, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self + .client + .metadata() + .call_hash::()? + == [ + 32u8, 163u8, 168u8, 251u8, 251u8, 9u8, 1u8, 195u8, 173u8, + 32u8, 235u8, 125u8, 141u8, 201u8, 130u8, 207u8, 239u8, 76u8, + 150u8, 99u8, 74u8, 193u8, 60u8, 165u8, 93u8, 49u8, 95u8, + 224u8, 217u8, 243u8, 117u8, 173u8, + ] + { + let call = ReportEquivocationUnsigned { + equivocation_proof: ::std::boxed::Box::new( + equivocation_proof, + ), + key_owner_proof, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Plan an epoch config change. The epoch config change is recorded and will be enacted on"] #[doc = "the next call to `enact_epoch_change`. The config will be activated one epoch after."] @@ -1743,16 +2567,30 @@ pub mod api { pub fn plan_config_change( &self, config : runtime_types :: sp_consensus_babe :: digests :: NextConfigDescriptor, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - PlanConfigChange, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + PlanConfigChange, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = PlanConfigChange { config }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 215u8, 121u8, 90u8, 87u8, 178u8, 247u8, 114u8, 53u8, 174u8, + 28u8, 20u8, 33u8, 139u8, 216u8, 13u8, 187u8, 74u8, 198u8, + 38u8, 28u8, 175u8, 13u8, 73u8, 132u8, 103u8, 78u8, 217u8, + 207u8, 113u8, 169u8, 42u8, 103u8, + ] + { + let call = PlanConfigChange { config }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -1919,38 +2757,94 @@ pub mod api { #[doc = " Current epoch index."] pub async fn epoch_index( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u64, ::subxt::BasicError> { - let entry = EpochIndex; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 51u8, 27u8, 91u8, 156u8, 118u8, 99u8, 46u8, 219u8, 190u8, + 147u8, 205u8, 23u8, 106u8, 169u8, 121u8, 218u8, 208u8, 235u8, + 135u8, 127u8, 243u8, 41u8, 55u8, 243u8, 235u8, 122u8, 57u8, + 86u8, 37u8, 90u8, 208u8, 71u8, + ] + { + let entry = EpochIndex; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } - #[doc = " Current epoch authorities."] pub async fn authorities (& self , hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < runtime_types :: frame_support :: storage :: weak_bounded_vec :: WeakBoundedVec < (runtime_types :: sp_consensus_babe :: app :: Public , :: core :: primitive :: u64 ,) > , :: subxt :: BasicError >{ - let entry = Authorities; - self.client.storage().fetch_or_default(&entry, hash).await + #[doc = " Current epoch authorities."] pub async fn authorities (& self , block_hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < runtime_types :: frame_support :: storage :: weak_bounded_vec :: WeakBoundedVec < (runtime_types :: sp_consensus_babe :: app :: Public , :: core :: primitive :: u64 ,) > , :: subxt :: BasicError >{ + if self.client.metadata().storage_hash::()? + == [ + 39u8, 102u8, 251u8, 125u8, 230u8, 247u8, 174u8, 255u8, 2u8, + 81u8, 86u8, 69u8, 182u8, 92u8, 191u8, 163u8, 66u8, 181u8, + 247u8, 9u8, 57u8, 154u8, 239u8, 34u8, 25u8, 139u8, 119u8, + 4u8, 131u8, 124u8, 135u8, 240u8, + ] + { + let entry = Authorities; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The slot at which the first epoch actually started. This is 0"] #[doc = " until the first block of the chain."] pub async fn genesis_slot( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< runtime_types::sp_consensus_slots::Slot, ::subxt::BasicError, > { - let entry = GenesisSlot; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 136u8, 244u8, 7u8, 142u8, 224u8, 33u8, 144u8, 186u8, 155u8, + 144u8, 68u8, 81u8, 241u8, 57u8, 40u8, 207u8, 35u8, 39u8, + 28u8, 41u8, 210u8, 213u8, 53u8, 195u8, 175u8, 119u8, 6u8, + 175u8, 100u8, 192u8, 180u8, 73u8, + ] + { + let entry = GenesisSlot; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Current slot number."] pub async fn current_slot( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< runtime_types::sp_consensus_slots::Slot, ::subxt::BasicError, > { - let entry = CurrentSlot; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 233u8, 102u8, 77u8, 99u8, 103u8, 50u8, 151u8, 229u8, 46u8, + 226u8, 181u8, 37u8, 117u8, 204u8, 234u8, 120u8, 116u8, 166u8, + 80u8, 188u8, 92u8, 154u8, 137u8, 150u8, 79u8, 164u8, 29u8, + 203u8, 2u8, 51u8, 123u8, 104u8, + ] + { + let entry = CurrentSlot; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The epoch randomness for the *current* epoch."] #[doc = ""] @@ -1964,41 +2858,97 @@ pub mod api { #[doc = " adversary, for purposes such as public-coin zero-knowledge proofs."] pub async fn randomness( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< [::core::primitive::u8; 32usize], ::subxt::BasicError, > { - let entry = Randomness; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 191u8, 197u8, 25u8, 164u8, 104u8, 248u8, 247u8, 193u8, 244u8, + 60u8, 181u8, 195u8, 248u8, 90u8, 41u8, 199u8, 82u8, 123u8, + 72u8, 126u8, 18u8, 17u8, 128u8, 215u8, 34u8, 251u8, 227u8, + 70u8, 166u8, 10u8, 104u8, 140u8, + ] + { + let entry = Randomness; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Pending epoch configuration change that will be applied when the next epoch is enacted."] pub async fn pending_epoch_config_change( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::sp_consensus_babe::digests::NextConfigDescriptor, >, ::subxt::BasicError, > { - let entry = PendingEpochConfigChange; - self.client.storage().fetch(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 98u8, 52u8, 22u8, 32u8, 76u8, 196u8, 89u8, 78u8, 119u8, + 181u8, 17u8, 49u8, 220u8, 159u8, 195u8, 74u8, 33u8, 59u8, + 15u8, 104u8, 26u8, 111u8, 165u8, 68u8, 147u8, 14u8, 86u8, + 94u8, 250u8, 167u8, 146u8, 82u8, + ] + { + let entry = PendingEpochConfigChange; + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Next epoch randomness."] pub async fn next_randomness( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< [::core::primitive::u8; 32usize], ::subxt::BasicError, > { - let entry = NextRandomness; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 185u8, 98u8, 45u8, 109u8, 253u8, 38u8, 238u8, 221u8, 240u8, + 29u8, 38u8, 107u8, 118u8, 117u8, 131u8, 115u8, 21u8, 255u8, + 203u8, 81u8, 243u8, 251u8, 91u8, 60u8, 163u8, 202u8, 125u8, + 193u8, 173u8, 234u8, 166u8, 92u8, + ] + { + let entry = NextRandomness; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } - #[doc = " Next epoch authorities."] pub async fn next_authorities (& self , hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < runtime_types :: frame_support :: storage :: weak_bounded_vec :: WeakBoundedVec < (runtime_types :: sp_consensus_babe :: app :: Public , :: core :: primitive :: u64 ,) > , :: subxt :: BasicError >{ - let entry = NextAuthorities; - self.client.storage().fetch_or_default(&entry, hash).await + #[doc = " Next epoch authorities."] pub async fn next_authorities (& self , block_hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < runtime_types :: frame_support :: storage :: weak_bounded_vec :: WeakBoundedVec < (runtime_types :: sp_consensus_babe :: app :: Public , :: core :: primitive :: u64 ,) > , :: subxt :: BasicError >{ + if self.client.metadata().storage_hash::()? + == [ + 211u8, 175u8, 218u8, 0u8, 212u8, 114u8, 210u8, 137u8, 146u8, + 135u8, 78u8, 133u8, 85u8, 253u8, 140u8, 242u8, 101u8, 155u8, + 159u8, 8u8, 217u8, 176u8, 234u8, 143u8, 212u8, 103u8, 198u8, + 94u8, 121u8, 111u8, 56u8, 89u8, + ] + { + let entry = NextAuthorities; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Randomness under construction."] #[doc = ""] @@ -2011,49 +2961,99 @@ pub mod api { #[doc = " epoch."] pub async fn segment_index( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let entry = SegmentIndex; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 128u8, 45u8, 87u8, 58u8, 174u8, 152u8, 241u8, 156u8, 56u8, + 192u8, 19u8, 45u8, 75u8, 160u8, 35u8, 253u8, 145u8, 11u8, + 178u8, 81u8, 114u8, 117u8, 112u8, 107u8, 163u8, 208u8, 240u8, + 151u8, 102u8, 176u8, 246u8, 5u8, + ] + { + let entry = SegmentIndex; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " TWOX-NOTE: `SegmentIndex` is an increasing integer, so this is okay."] pub async fn under_construction( &self, _0: &::core::primitive::u32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< runtime_types::frame_support::storage::bounded_vec::BoundedVec< [::core::primitive::u8; 32usize], >, ::subxt::BasicError, > { - let entry = UnderConstruction(_0); - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 12u8, 167u8, 30u8, 96u8, 161u8, 63u8, 210u8, 63u8, 91u8, + 199u8, 188u8, 78u8, 254u8, 255u8, 253u8, 202u8, 203u8, 26u8, + 4u8, 105u8, 76u8, 125u8, 191u8, 245u8, 32u8, 97u8, 127u8, + 129u8, 167u8, 80u8, 210u8, 123u8, + ] + { + let entry = UnderConstruction(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " TWOX-NOTE: `SegmentIndex` is an increasing integer, so this is okay."] pub async fn under_construction_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, UnderConstruction<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 12u8, 167u8, 30u8, 96u8, 161u8, 63u8, 210u8, 63u8, 91u8, + 199u8, 188u8, 78u8, 254u8, 255u8, 253u8, 202u8, 203u8, 26u8, + 4u8, 105u8, 76u8, 125u8, 191u8, 245u8, 32u8, 97u8, 127u8, + 129u8, 167u8, 80u8, 210u8, 123u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Temporary value (cleared at block finalization) which is `Some`"] #[doc = " if per-block initialization has already been called for current block."] pub async fn initialized( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< ::core::option::Option<[::core::primitive::u8; 32usize]>, >, ::subxt::BasicError, > { - let entry = Initialized; - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 48u8, 206u8, 111u8, 118u8, 149u8, 175u8, 148u8, 53u8, 233u8, + 82u8, 220u8, 57u8, 22u8, 164u8, 116u8, 228u8, 134u8, 237u8, + 129u8, 195u8, 60u8, 169u8, 1u8, 164u8, 74u8, 177u8, 145u8, + 112u8, 66u8, 198u8, 53u8, 157u8, + ] + { + let entry = Initialized; + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " This field should always be populated during block processing unless"] #[doc = " secondary plain slots are enabled (which don't contain a VRF output)."] @@ -2061,13 +3061,30 @@ pub mod api { #[doc = " It is set in `on_initialize`, before it will contain the value from the last block."] pub async fn author_vrf_randomness( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<[::core::primitive::u8; 32usize]>, ::subxt::BasicError, > { - let entry = AuthorVrfRandomness; - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 66u8, 235u8, 74u8, 252u8, 222u8, 135u8, 19u8, 28u8, 74u8, + 191u8, 170u8, 197u8, 207u8, 127u8, 77u8, 121u8, 138u8, 138u8, + 110u8, 187u8, 34u8, 14u8, 230u8, 43u8, 241u8, 241u8, 63u8, + 163u8, 53u8, 179u8, 250u8, 247u8, + ] + { + let entry = AuthorVrfRandomness; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The block numbers when the last and current epoch have started, respectively `N-1` and"] #[doc = " `N`."] @@ -2076,13 +3093,27 @@ pub mod api { #[doc = " slots, which may be skipped, the block numbers may not line up with the slot numbers."] pub async fn epoch_start( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< (::core::primitive::u32, ::core::primitive::u32), ::subxt::BasicError, > { - let entry = EpochStart; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 196u8, 39u8, 241u8, 20u8, 150u8, 180u8, 136u8, 4u8, 195u8, + 205u8, 218u8, 10u8, 130u8, 131u8, 168u8, 243u8, 207u8, 249u8, + 58u8, 195u8, 177u8, 119u8, 110u8, 243u8, 241u8, 3u8, 245u8, + 56u8, 157u8, 5u8, 68u8, 60u8, + ] + { + let entry = EpochStart; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " How late the current block is compared to its parent."] #[doc = ""] @@ -2091,39 +3122,75 @@ pub mod api { #[doc = " execution context should always yield zero."] pub async fn lateness( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let entry = Lateness; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 229u8, 230u8, 224u8, 89u8, 49u8, 213u8, 198u8, 236u8, 144u8, + 56u8, 193u8, 234u8, 62u8, 242u8, 191u8, 199u8, 105u8, 131u8, + 74u8, 63u8, 75u8, 1u8, 210u8, 49u8, 3u8, 128u8, 18u8, 77u8, + 219u8, 146u8, 60u8, 88u8, + ] + { + let entry = Lateness; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The configuration for the current epoch. Should never be `None` as it is initialized in"] #[doc = " genesis."] pub async fn epoch_config( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::sp_consensus_babe::BabeEpochConfiguration, >, ::subxt::BasicError, > { - let entry = EpochConfig; - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 169u8, 189u8, 214u8, 159u8, 181u8, 232u8, 243u8, 4u8, 113u8, + 24u8, 221u8, 229u8, 27u8, 35u8, 3u8, 121u8, 136u8, 88u8, + 187u8, 193u8, 207u8, 153u8, 223u8, 225u8, 166u8, 183u8, 53u8, + 3u8, 162u8, 207u8, 88u8, 133u8, + ] + { + let entry = EpochConfig; + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The configuration for the next epoch, `None` if the config will not change"] #[doc = " (you can fallback to `EpochConfig` instead in that case)."] pub async fn next_epoch_config( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::sp_consensus_babe::BabeEpochConfiguration, >, ::subxt::BasicError, > { - let entry = NextEpochConfig; - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 239u8, 125u8, 203u8, 223u8, 161u8, 107u8, 232u8, 54u8, 158u8, + 100u8, 244u8, 140u8, 119u8, 58u8, 253u8, 245u8, 73u8, 236u8, + 50u8, 67u8, 228u8, 162u8, 166u8, 168u8, 162u8, 152u8, 239u8, + 246u8, 153u8, 223u8, 109u8, 121u8, + ] + { + let entry = NextEpochConfig; + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -2143,10 +3210,25 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u64, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Babe")?; - let constant = pallet.constant("EpochDuration")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Babe", "EpochDuration")? + == [ + 128u8, 214u8, 205u8, 242u8, 181u8, 142u8, 124u8, 231u8, + 190u8, 146u8, 59u8, 226u8, 157u8, 101u8, 103u8, 117u8, 249u8, + 65u8, 18u8, 191u8, 103u8, 119u8, 53u8, 85u8, 81u8, 96u8, + 220u8, 42u8, 184u8, 239u8, 42u8, 246u8, + ] + { + let pallet = self.client.metadata().pallet("Babe")?; + let constant = pallet.constant("EpochDuration")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The expected average block time at which BABE should be creating"] #[doc = " blocks. Since BABE is probabilistic it is not trivial to figure out"] @@ -2157,20 +3239,50 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u64, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Babe")?; - let constant = pallet.constant("ExpectedBlockTime")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Babe", "ExpectedBlockTime")? + == [ + 128u8, 214u8, 205u8, 242u8, 181u8, 142u8, 124u8, 231u8, + 190u8, 146u8, 59u8, 226u8, 157u8, 101u8, 103u8, 117u8, 249u8, + 65u8, 18u8, 191u8, 103u8, 119u8, 53u8, 85u8, 81u8, 96u8, + 220u8, 42u8, 184u8, 239u8, 42u8, 246u8, + ] + { + let pallet = self.client.metadata().pallet("Babe")?; + let constant = pallet.constant("ExpectedBlockTime")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Max number of authorities allowed"] pub fn max_authorities( &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Babe")?; - let constant = pallet.constant("MaxAuthorities")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Babe", "MaxAuthorities")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Babe")?; + let constant = pallet.constant("MaxAuthorities")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -2229,16 +3341,30 @@ pub mod api { pub fn set( &self, now: ::core::primitive::u64, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Set, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Set, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = Set { now }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 191u8, 73u8, 102u8, 150u8, 65u8, 157u8, 172u8, 194u8, 7u8, + 72u8, 1u8, 35u8, 54u8, 99u8, 245u8, 139u8, 40u8, 136u8, + 245u8, 53u8, 167u8, 100u8, 143u8, 244u8, 160u8, 5u8, 18u8, + 130u8, 77u8, 160u8, 227u8, 51u8, + ] + { + let call = Set { now }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -2272,20 +3398,48 @@ pub mod api { #[doc = " Current time for the current block."] pub async fn now( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u64, ::subxt::BasicError> { - let entry = Now; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 148u8, 53u8, 50u8, 54u8, 13u8, 161u8, 57u8, 150u8, 16u8, + 83u8, 144u8, 221u8, 59u8, 75u8, 158u8, 130u8, 39u8, 123u8, + 106u8, 134u8, 202u8, 185u8, 83u8, 85u8, 60u8, 41u8, 120u8, + 96u8, 210u8, 34u8, 2u8, 250u8, + ] + { + let entry = Now; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Did the timestamp get updated in this block?"] pub async fn did_update( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::bool, ::subxt::BasicError> { - let entry = DidUpdate; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 70u8, 13u8, 92u8, 186u8, 80u8, 151u8, 167u8, 90u8, 158u8, + 232u8, 175u8, 13u8, 103u8, 135u8, 2u8, 78u8, 16u8, 6u8, 39u8, + 158u8, 167u8, 85u8, 27u8, 47u8, 122u8, 73u8, 127u8, 26u8, + 35u8, 168u8, 72u8, 204u8, + ] + { + let entry = DidUpdate; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -2306,10 +3460,25 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u64, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Timestamp")?; - let constant = pallet.constant("MinimumPeriod")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Timestamp", "MinimumPeriod")? + == [ + 128u8, 214u8, 205u8, 242u8, 181u8, 142u8, 124u8, 231u8, + 190u8, 146u8, 59u8, 226u8, 157u8, 101u8, 103u8, 117u8, 249u8, + 65u8, 18u8, 191u8, 103u8, 119u8, 53u8, 85u8, 81u8, 96u8, + 220u8, 42u8, 184u8, 239u8, 42u8, 246u8, + ] + { + let pallet = self.client.metadata().pallet("Timestamp")?; + let constant = pallet.constant("MinimumPeriod")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -2419,16 +3588,30 @@ pub mod api { pub fn claim( &self, index: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Claim, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Claim, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = Claim { index }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 27u8, 4u8, 108u8, 55u8, 23u8, 109u8, 175u8, 25u8, 201u8, + 230u8, 228u8, 51u8, 164u8, 15u8, 79u8, 10u8, 219u8, 182u8, + 242u8, 102u8, 164u8, 148u8, 39u8, 91u8, 106u8, 197u8, 29u8, + 190u8, 178u8, 221u8, 16u8, 87u8, + ] + { + let call = Claim { index }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Assign an index already owned by the sender to another account. The balance reservation"] #[doc = "is effectively transferred to the new account."] @@ -2454,16 +3637,30 @@ pub mod api { &self, new: ::subxt::sp_core::crypto::AccountId32, index: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Transfer, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Transfer, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = Transfer { new, index }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 124u8, 83u8, 33u8, 230u8, 23u8, 70u8, 83u8, 59u8, 76u8, + 100u8, 219u8, 100u8, 165u8, 163u8, 102u8, 193u8, 11u8, 22u8, + 30u8, 125u8, 114u8, 28u8, 61u8, 156u8, 38u8, 170u8, 129u8, + 74u8, 187u8, 28u8, 33u8, 65u8, + ] + { + let call = Transfer { new, index }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Free up an index owned by the sender."] #[doc = ""] @@ -2486,16 +3683,30 @@ pub mod api { pub fn free( &self, index: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Free, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Free, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = Free { index }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 153u8, 143u8, 162u8, 33u8, 229u8, 3u8, 159u8, 153u8, 111u8, + 100u8, 160u8, 250u8, 227u8, 24u8, 157u8, 226u8, 173u8, 39u8, + 25u8, 200u8, 137u8, 147u8, 232u8, 213u8, 182u8, 49u8, 142u8, + 250u8, 139u8, 155u8, 84u8, 214u8, + ] + { + let call = Free { index }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Force an index to an account. This doesn't require a deposit. If the index is already"] #[doc = "held, then any deposit is reimbursed to its current owner."] @@ -2523,16 +3734,30 @@ pub mod api { new: ::subxt::sp_core::crypto::AccountId32, index: ::core::primitive::u32, freeze: ::core::primitive::bool, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ForceTransfer, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ForceTransfer, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ForceTransfer { new, index, freeze }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 181u8, 143u8, 90u8, 135u8, 132u8, 11u8, 145u8, 85u8, 4u8, + 211u8, 56u8, 110u8, 213u8, 153u8, 224u8, 106u8, 198u8, 250u8, + 130u8, 253u8, 72u8, 58u8, 133u8, 150u8, 102u8, 119u8, 177u8, + 175u8, 77u8, 106u8, 253u8, 99u8, + ] + { + let call = ForceTransfer { new, index, freeze }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Freeze an index so it will always point to the sender account. This consumes the"] #[doc = "deposit."] @@ -2555,16 +3780,30 @@ pub mod api { pub fn freeze( &self, index: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Freeze, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Freeze, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = Freeze { index }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 204u8, 127u8, 214u8, 137u8, 138u8, 28u8, 171u8, 169u8, 184u8, + 164u8, 235u8, 114u8, 132u8, 176u8, 14u8, 207u8, 72u8, 39u8, + 179u8, 231u8, 137u8, 243u8, 242u8, 57u8, 89u8, 57u8, 213u8, + 210u8, 87u8, 12u8, 253u8, 159u8, + ] + { + let call = Freeze { index }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -2635,7 +3874,7 @@ pub mod api { pub async fn accounts( &self, _0: &::core::primitive::u32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<( ::subxt::sp_core::crypto::AccountId32, @@ -2644,18 +3883,40 @@ pub mod api { )>, ::subxt::BasicError, > { - let entry = Accounts(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 105u8, 208u8, 81u8, 30u8, 157u8, 108u8, 22u8, 122u8, 152u8, + 220u8, 40u8, 97u8, 255u8, 166u8, 222u8, 11u8, 81u8, 245u8, + 143u8, 79u8, 57u8, 19u8, 174u8, 164u8, 220u8, 59u8, 77u8, + 117u8, 39u8, 72u8, 251u8, 234u8, + ] + { + let entry = Accounts(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The lookup from index to account."] pub async fn accounts_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Accounts<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 105u8, 208u8, 81u8, 30u8, 157u8, 108u8, 22u8, 122u8, 152u8, + 220u8, 40u8, 97u8, 255u8, 166u8, 222u8, 11u8, 81u8, 245u8, + 143u8, 79u8, 57u8, 19u8, 174u8, 164u8, 220u8, 59u8, 77u8, + 117u8, 39u8, 72u8, 251u8, 234u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -2673,10 +3934,22 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Indices")?; - let constant = pallet.constant("Deposit")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self.client.metadata().constant_hash("Indices", "Deposit")? + == [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, + 200u8, 214u8, 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, + 101u8, 54u8, 210u8, 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, + 15u8, 178u8, 98u8, 148u8, 156u8, + ] + { + let pallet = self.client.metadata().pallet("Indices")?; + let constant = pallet.constant("Deposit")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -2821,16 +4094,30 @@ pub mod api { (), >, value: ::core::primitive::u128, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Transfer, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Transfer, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = Transfer { dest, value }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 250u8, 8u8, 164u8, 186u8, 80u8, 220u8, 134u8, 247u8, 142u8, + 121u8, 34u8, 22u8, 169u8, 39u8, 6u8, 93u8, 72u8, 47u8, 44u8, + 107u8, 9u8, 98u8, 203u8, 190u8, 136u8, 55u8, 251u8, 78u8, + 216u8, 150u8, 98u8, 118u8, + ] + { + let call = Transfer { dest, value }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set the balances of a given account."] #[doc = ""] @@ -2848,20 +4135,34 @@ pub mod api { >, new_free: ::core::primitive::u128, new_reserved: ::core::primitive::u128, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetBalance, - DispatchError, - root_mod::Event, - > { - let call = SetBalance { - who, - new_free, - new_reserved, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetBalance, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 232u8, 6u8, 27u8, 131u8, 163u8, 72u8, 148u8, 197u8, 14u8, + 239u8, 94u8, 1u8, 32u8, 94u8, 17u8, 14u8, 123u8, 82u8, 39u8, + 233u8, 77u8, 20u8, 40u8, 139u8, 222u8, 137u8, 103u8, 18u8, + 126u8, 63u8, 200u8, 149u8, + ] + { + let call = SetBalance { + who, + new_free, + new_reserved, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Exactly as `transfer`, except the origin must be root and the source account may be"] #[doc = "specified."] @@ -2880,20 +4181,34 @@ pub mod api { (), >, value: ::core::primitive::u128, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ForceTransfer, - DispatchError, - root_mod::Event, - > { - let call = ForceTransfer { - source, - dest, - value, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ForceTransfer, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 120u8, 66u8, 111u8, 84u8, 176u8, 241u8, 214u8, 118u8, 219u8, + 75u8, 127u8, 222u8, 45u8, 33u8, 204u8, 147u8, 126u8, 214u8, + 101u8, 190u8, 37u8, 37u8, 159u8, 166u8, 61u8, 143u8, 22u8, + 32u8, 15u8, 83u8, 221u8, 230u8, + ] + { + let call = ForceTransfer { + source, + dest, + value, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Same as the [`transfer`] call, but with a check that the transfer will not kill the"] #[doc = "origin account."] @@ -2908,16 +4223,30 @@ pub mod api { (), >, value: ::core::primitive::u128, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - TransferKeepAlive, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + TransferKeepAlive, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = TransferKeepAlive { dest, value }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 111u8, 233u8, 125u8, 71u8, 223u8, 141u8, 112u8, 94u8, 157u8, + 11u8, 88u8, 7u8, 239u8, 145u8, 247u8, 183u8, 245u8, 87u8, + 157u8, 35u8, 49u8, 91u8, 54u8, 103u8, 101u8, 76u8, 110u8, + 94u8, 81u8, 170u8, 153u8, 209u8, + ] + { + let call = TransferKeepAlive { dest, value }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Transfer the entire transferable balance from the caller account."] #[doc = ""] @@ -2943,16 +4272,30 @@ pub mod api { (), >, keep_alive: ::core::primitive::bool, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - TransferAll, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + TransferAll, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = TransferAll { dest, keep_alive }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 240u8, 165u8, 185u8, 144u8, 24u8, 149u8, 15u8, 46u8, 60u8, + 147u8, 19u8, 187u8, 96u8, 24u8, 150u8, 53u8, 151u8, 232u8, + 200u8, 164u8, 176u8, 167u8, 8u8, 23u8, 63u8, 135u8, 68u8, + 110u8, 5u8, 21u8, 35u8, 78u8, + ] + { + let call = TransferAll { dest, keep_alive }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Unreserve some balance from a user by force."] #[doc = ""] @@ -2964,16 +4307,30 @@ pub mod api { (), >, amount: ::core::primitive::u128, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ForceUnreserve, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ForceUnreserve, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ForceUnreserve { who, amount }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 106u8, 42u8, 48u8, 136u8, 41u8, 155u8, 214u8, 112u8, 99u8, + 122u8, 202u8, 250u8, 95u8, 60u8, 182u8, 13u8, 25u8, 149u8, + 212u8, 212u8, 247u8, 191u8, 130u8, 95u8, 84u8, 252u8, 252u8, + 197u8, 244u8, 149u8, 103u8, 67u8, + ] + { + let call = ForceUnreserve { who, amount }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -3161,11 +4518,25 @@ pub mod api { #[doc = " The total units issued in the system."] pub async fn total_issuance( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let entry = TotalIssuance; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 1u8, 206u8, 252u8, 237u8, 6u8, 30u8, 20u8, 232u8, 164u8, + 115u8, 51u8, 156u8, 156u8, 206u8, 241u8, 187u8, 44u8, 84u8, + 25u8, 164u8, 235u8, 20u8, 86u8, 242u8, 124u8, 23u8, 28u8, + 140u8, 26u8, 73u8, 231u8, 51u8, + ] + { + let entry = TotalIssuance; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The Balances pallet example of storing the balance of an account."] #[doc = ""] @@ -3194,13 +4565,27 @@ pub mod api { pub async fn account( &self, _0: &::subxt::sp_core::crypto::AccountId32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< runtime_types::pallet_balances::AccountData<::core::primitive::u128>, ::subxt::BasicError, > { - let entry = Account(_0); - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 129u8, 169u8, 171u8, 206u8, 229u8, 178u8, 69u8, 118u8, 199u8, + 64u8, 254u8, 67u8, 16u8, 154u8, 160u8, 197u8, 177u8, 161u8, + 148u8, 199u8, 78u8, 219u8, 187u8, 83u8, 99u8, 110u8, 207u8, + 252u8, 243u8, 39u8, 46u8, 106u8, + ] + { + let entry = Account(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The Balances pallet example of storing the balance of an account."] #[doc = ""] @@ -3228,34 +4613,70 @@ pub mod api { #[doc = " NOTE: This is only used in the case that this pallet is used to store balances."] pub async fn account_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Account<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 129u8, 169u8, 171u8, 206u8, 229u8, 178u8, 69u8, 118u8, 199u8, + 64u8, 254u8, 67u8, 16u8, 154u8, 160u8, 197u8, 177u8, 161u8, + 148u8, 199u8, 78u8, 219u8, 187u8, 83u8, 99u8, 110u8, 207u8, + 252u8, 243u8, 39u8, 46u8, 106u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Any liquidity locks on some account balances."] - #[doc = " NOTE: Should only be accessed when setting, changing and freeing a lock."] pub async fn locks (& self , _0 : & :: subxt :: sp_core :: crypto :: AccountId32 , hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < runtime_types :: frame_support :: storage :: weak_bounded_vec :: WeakBoundedVec < runtime_types :: pallet_balances :: BalanceLock < :: core :: primitive :: u128 > > , :: subxt :: BasicError >{ - let entry = Locks(_0); - self.client.storage().fetch_or_default(&entry, hash).await + #[doc = " NOTE: Should only be accessed when setting, changing and freeing a lock."] pub async fn locks (& self , _0 : & :: subxt :: sp_core :: crypto :: AccountId32 , block_hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < runtime_types :: frame_support :: storage :: weak_bounded_vec :: WeakBoundedVec < runtime_types :: pallet_balances :: BalanceLock < :: core :: primitive :: u128 > > , :: subxt :: BasicError >{ + if self.client.metadata().storage_hash::()? + == [ + 31u8, 76u8, 213u8, 60u8, 86u8, 11u8, 155u8, 151u8, 33u8, + 212u8, 74u8, 89u8, 174u8, 74u8, 195u8, 107u8, 29u8, 163u8, + 178u8, 34u8, 209u8, 8u8, 201u8, 237u8, 77u8, 99u8, 205u8, + 212u8, 236u8, 132u8, 2u8, 252u8, + ] + { + let entry = Locks(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Any liquidity locks on some account balances."] #[doc = " NOTE: Should only be accessed when setting, changing and freeing a lock."] pub async fn locks_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Locks<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 31u8, 76u8, 213u8, 60u8, 86u8, 11u8, 155u8, 151u8, 33u8, + 212u8, 74u8, 89u8, 174u8, 74u8, 195u8, 107u8, 29u8, 163u8, + 178u8, 34u8, 209u8, 8u8, 201u8, 237u8, 77u8, 99u8, 205u8, + 212u8, 236u8, 132u8, 2u8, 252u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Named reserves on some account balances."] pub async fn reserves( &self, _0: &::subxt::sp_core::crypto::AccountId32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< runtime_types::frame_support::storage::bounded_vec::BoundedVec< runtime_types::pallet_balances::ReserveData< @@ -3265,31 +4686,70 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = Reserves(_0); - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 103u8, 6u8, 69u8, 151u8, 81u8, 40u8, 146u8, 113u8, 56u8, + 239u8, 104u8, 31u8, 168u8, 242u8, 141u8, 121u8, 213u8, 213u8, + 114u8, 63u8, 62u8, 47u8, 91u8, 119u8, 57u8, 91u8, 95u8, 81u8, + 19u8, 208u8, 59u8, 146u8, + ] + { + let entry = Reserves(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Named reserves on some account balances."] pub async fn reserves_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Reserves<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 103u8, 6u8, 69u8, 151u8, 81u8, 40u8, 146u8, 113u8, 56u8, + 239u8, 104u8, 31u8, 168u8, 242u8, 141u8, 121u8, 213u8, 213u8, + 114u8, 63u8, 62u8, 47u8, 91u8, 119u8, 57u8, 91u8, 95u8, 81u8, + 19u8, 208u8, 59u8, 146u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Storage version of the pallet."] #[doc = ""] #[doc = " This is set to v2.0.0 for new networks."] pub async fn storage_version( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< runtime_types::pallet_balances::Releases, ::subxt::BasicError, > { - let entry = StorageVersion; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 135u8, 96u8, 28u8, 234u8, 124u8, 212u8, 56u8, 140u8, 40u8, + 101u8, 235u8, 128u8, 136u8, 221u8, 182u8, 81u8, 17u8, 9u8, + 184u8, 228u8, 174u8, 165u8, 200u8, 162u8, 214u8, 178u8, + 227u8, 72u8, 34u8, 5u8, 173u8, 96u8, + ] + { + let entry = StorageVersion; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -3307,10 +4767,25 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Balances")?; - let constant = pallet.constant("ExistentialDeposit")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Balances", "ExistentialDeposit")? + == [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, + 200u8, 214u8, 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, + 101u8, 54u8, 210u8, 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, + 15u8, 178u8, 98u8, 148u8, 156u8, + ] + { + let pallet = self.client.metadata().pallet("Balances")?; + let constant = pallet.constant("ExistentialDeposit")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The maximum number of locks that should exist on an account."] #[doc = " Not strictly enforced, but used for weight estimation."] @@ -3318,20 +4793,50 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Balances")?; - let constant = pallet.constant("MaxLocks")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Balances", "MaxLocks")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Balances")?; + let constant = pallet.constant("MaxLocks")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The maximum number of named reserves that can exist on an account."] pub fn max_reserves( &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Balances")?; - let constant = pallet.constant("MaxReserves")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Balances", "MaxReserves")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Balances")?; + let constant = pallet.constant("MaxReserves")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -3370,23 +4875,51 @@ pub mod api { } pub async fn next_fee_multiplier( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< runtime_types::sp_arithmetic::fixed_point::FixedU128, ::subxt::BasicError, > { - let entry = NextFeeMultiplier; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 232u8, 48u8, 68u8, 202u8, 209u8, 29u8, 249u8, 71u8, 0u8, + 84u8, 229u8, 250u8, 176u8, 203u8, 27u8, 26u8, 34u8, 55u8, + 83u8, 183u8, 224u8, 40u8, 62u8, 127u8, 131u8, 88u8, 128u8, + 9u8, 56u8, 178u8, 31u8, 183u8, + ] + { + let entry = NextFeeMultiplier; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } pub async fn storage_version( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< runtime_types::pallet_transaction_payment::Releases, ::subxt::BasicError, > { - let entry = StorageVersion; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 219u8, 243u8, 82u8, 176u8, 65u8, 5u8, 132u8, 114u8, 8u8, + 82u8, 176u8, 200u8, 97u8, 150u8, 177u8, 164u8, 166u8, 11u8, + 34u8, 12u8, 12u8, 198u8, 58u8, 191u8, 186u8, 221u8, 221u8, + 119u8, 181u8, 253u8, 154u8, 228u8, + ] + { + let entry = StorageVersion; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -3404,10 +4937,26 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("TransactionPayment")?; - let constant = pallet.constant("TransactionByteFee")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("TransactionPayment", "TransactionByteFee")? + == [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, + 200u8, 214u8, 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, + 101u8, 54u8, 210u8, 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, + 15u8, 178u8, 98u8, 148u8, 156u8, + ] + { + let pallet = + self.client.metadata().pallet("TransactionPayment")?; + let constant = pallet.constant("TransactionByteFee")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " A fee mulitplier for `Operational` extrinsics to compute \"virtual tip\" to boost their"] #[doc = " `priority`"] @@ -3434,10 +4983,26 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u8, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("TransactionPayment")?; - let constant = pallet.constant("OperationalFeeMultiplier")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("TransactionPayment", "OperationalFeeMultiplier")? + == [ + 141u8, 130u8, 11u8, 35u8, 226u8, 114u8, 92u8, 179u8, 168u8, + 110u8, 28u8, 91u8, 221u8, 64u8, 4u8, 148u8, 201u8, 193u8, + 185u8, 66u8, 226u8, 114u8, 97u8, 79u8, 62u8, 212u8, 202u8, + 114u8, 237u8, 228u8, 183u8, 165u8, + ] + { + let pallet = + self.client.metadata().pallet("TransactionPayment")?; + let constant = pallet.constant("OperationalFeeMultiplier")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The polynomial that is applied in order to derive fee from weight."] pub fn weight_to_fee( @@ -3450,10 +5015,26 @@ pub mod api { >, ::subxt::BasicError, > { - let pallet = self.client.metadata().pallet("TransactionPayment")?; - let constant = pallet.constant("WeightToFee")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("TransactionPayment", "WeightToFee")? + == [ + 99u8, 211u8, 10u8, 189u8, 123u8, 171u8, 119u8, 79u8, 112u8, + 33u8, 10u8, 47u8, 119u8, 55u8, 237u8, 32u8, 127u8, 21u8, + 117u8, 156u8, 153u8, 243u8, 128u8, 211u8, 243u8, 75u8, 15u8, + 181u8, 126u8, 73u8, 51u8, 47u8, + ] + { + let pallet = + self.client.metadata().pallet("TransactionPayment")?; + let constant = pallet.constant("WeightToFee")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -3506,16 +5087,30 @@ pub mod api { runtime_types::sp_runtime::traits::BlakeTwo256, >, >, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetUncles, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetUncles, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetUncles { new_uncles }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 5u8, 56u8, 71u8, 152u8, 103u8, 232u8, 101u8, 171u8, 200u8, + 2u8, 177u8, 102u8, 0u8, 93u8, 210u8, 90u8, 56u8, 151u8, 5u8, + 235u8, 227u8, 197u8, 189u8, 248u8, 2u8, 71u8, 49u8, 220u8, + 212u8, 253u8, 235u8, 67u8, + ] + { + let call = SetUncles { new_uncles }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -3564,7 +5159,7 @@ pub mod api { #[doc = " Uncles"] pub async fn uncles( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec< runtime_types::pallet_authorship::UncleEntryItem< @@ -3575,28 +5170,67 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = Uncles; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 71u8, 135u8, 85u8, 172u8, 221u8, 165u8, 212u8, 2u8, 208u8, + 50u8, 9u8, 92u8, 251u8, 25u8, 194u8, 123u8, 210u8, 4u8, + 148u8, 30u8, 20u8, 146u8, 21u8, 210u8, 138u8, 128u8, 144u8, + 152u8, 97u8, 57u8, 205u8, 231u8, + ] + { + let entry = Uncles; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Author of current block."] pub async fn author( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<::subxt::sp_core::crypto::AccountId32>, ::subxt::BasicError, > { - let entry = Author; - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 191u8, 57u8, 3u8, 242u8, 220u8, 123u8, 103u8, 215u8, 149u8, + 120u8, 20u8, 139u8, 146u8, 234u8, 180u8, 105u8, 129u8, 128u8, + 114u8, 147u8, 114u8, 236u8, 23u8, 21u8, 15u8, 250u8, 180u8, + 19u8, 177u8, 145u8, 77u8, 228u8, + ] + { + let entry = Author; + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Whether uncles were already set in this block."] pub async fn did_set_uncles( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::bool, ::subxt::BasicError> { - let entry = DidSetUncles; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 64u8, 3u8, 208u8, 187u8, 50u8, 45u8, 37u8, 88u8, 163u8, + 226u8, 37u8, 126u8, 232u8, 107u8, 156u8, 187u8, 29u8, 15u8, + 53u8, 46u8, 28u8, 73u8, 83u8, 123u8, 14u8, 244u8, 243u8, + 43u8, 245u8, 143u8, 15u8, 115u8, + ] + { + let entry = DidSetUncles; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -3616,10 +5250,25 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Authorship")?; - let constant = pallet.constant("UncleGenerations")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Authorship", "UncleGenerations")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Authorship")?; + let constant = pallet.constant("UncleGenerations")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -3940,20 +5589,34 @@ pub mod api { payee: runtime_types::pallet_staking::RewardDestination< ::subxt::sp_core::crypto::AccountId32, >, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Bond, - DispatchError, - root_mod::Event, - > { - let call = Bond { - controller, - value, - payee, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Bond, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 41u8, 8u8, 237u8, 132u8, 236u8, 61u8, 222u8, 146u8, 255u8, + 136u8, 174u8, 104u8, 120u8, 64u8, 198u8, 147u8, 80u8, 237u8, + 65u8, 255u8, 187u8, 55u8, 252u8, 34u8, 252u8, 88u8, 35u8, + 236u8, 249u8, 170u8, 116u8, 208u8, + ] + { + let call = Bond { + controller, + value, + payee, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Add some extra amount that have appeared in the stash `free_balance` into the balance up"] #[doc = "for staking."] @@ -3973,16 +5636,30 @@ pub mod api { pub fn bond_extra( &self, max_additional: ::core::primitive::u128, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - BondExtra, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + BondExtra, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = BondExtra { max_additional }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 170u8, 38u8, 37u8, 71u8, 243u8, 41u8, 24u8, 59u8, 17u8, + 229u8, 61u8, 20u8, 130u8, 167u8, 1u8, 1u8, 158u8, 180u8, + 234u8, 65u8, 196u8, 181u8, 232u8, 146u8, 62u8, 90u8, 194u8, + 183u8, 253u8, 142u8, 251u8, 200u8, + ] + { + let call = BondExtra { max_additional }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Schedule a portion of the stash to be unlocked ready for transfer out after the bond"] #[doc = "period ends. If this leaves an amount actively bonded less than"] @@ -4006,16 +5683,30 @@ pub mod api { pub fn unbond( &self, value: ::core::primitive::u128, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Unbond, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Unbond, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = Unbond { value }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 85u8, 188u8, 141u8, 62u8, 242u8, 15u8, 6u8, 20u8, 96u8, + 220u8, 201u8, 163u8, 29u8, 136u8, 24u8, 4u8, 143u8, 13u8, + 22u8, 118u8, 22u8, 212u8, 164u8, 125u8, 200u8, 219u8, 6u8, + 25u8, 174u8, 92u8, 108u8, 89u8, + ] + { + let call = Unbond { value }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Remove any unlocked chunks from the `unlocking` queue from our management."] #[doc = ""] @@ -4035,16 +5726,30 @@ pub mod api { pub fn withdraw_unbonded( &self, num_slashing_spans: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - WithdrawUnbonded, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + WithdrawUnbonded, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = WithdrawUnbonded { num_slashing_spans }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 252u8, 47u8, 185u8, 86u8, 179u8, 203u8, 20u8, 5u8, 88u8, + 252u8, 212u8, 173u8, 20u8, 202u8, 206u8, 56u8, 10u8, 186u8, + 124u8, 221u8, 42u8, 61u8, 202u8, 110u8, 233u8, 40u8, 210u8, + 135u8, 204u8, 110u8, 133u8, 123u8, + ] + { + let call = WithdrawUnbonded { num_slashing_spans }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Declare the desire to validate for the origin controller."] #[doc = ""] @@ -4054,16 +5759,30 @@ pub mod api { pub fn validate( &self, prefs: runtime_types::pallet_staking::ValidatorPrefs, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Validate, - DispatchError, - root_mod::Event, - > { - let call = Validate { prefs }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Validate, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 138u8, 13u8, 146u8, 216u8, 4u8, 27u8, 20u8, 159u8, 148u8, + 25u8, 169u8, 229u8, 145u8, 2u8, 251u8, 58u8, 13u8, 128u8, + 20u8, 22u8, 194u8, 11u8, 13u8, 65u8, 50u8, 51u8, 158u8, + 239u8, 45u8, 90u8, 6u8, 37u8, + ] + { + let call = Validate { prefs }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Declare the desire to nominate `targets` for the origin controller."] #[doc = ""] @@ -4084,16 +5803,30 @@ pub mod api { (), >, >, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Nominate, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Nominate, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = Nominate { targets }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 199u8, 181u8, 123u8, 171u8, 186u8, 9u8, 23u8, 220u8, 147u8, + 7u8, 252u8, 26u8, 25u8, 195u8, 126u8, 175u8, 181u8, 118u8, + 162u8, 37u8, 99u8, 31u8, 100u8, 249u8, 245u8, 122u8, 235u8, + 11u8, 43u8, 39u8, 198u8, 145u8, + ] + { + let call = Nominate { targets }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Declare no desire to either validate or nominate."] #[doc = ""] @@ -4108,16 +5841,30 @@ pub mod api { #[doc = "# "] pub fn chill( &self, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Chill, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Chill, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = Chill {}; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 94u8, 20u8, 196u8, 31u8, 220u8, 125u8, 115u8, 167u8, 140u8, + 3u8, 20u8, 132u8, 81u8, 120u8, 215u8, 166u8, 230u8, 56u8, + 16u8, 222u8, 31u8, 153u8, 120u8, 62u8, 153u8, 67u8, 220u8, + 239u8, 11u8, 234u8, 127u8, 122u8, + ] + { + let call = Chill {}; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "(Re-)set the payment target for a controller."] #[doc = ""] @@ -4140,16 +5887,30 @@ pub mod api { payee: runtime_types::pallet_staking::RewardDestination< ::subxt::sp_core::crypto::AccountId32, >, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetPayee, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetPayee, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetPayee { payee }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 185u8, 62u8, 154u8, 65u8, 135u8, 104u8, 38u8, 171u8, 237u8, + 16u8, 169u8, 38u8, 53u8, 161u8, 170u8, 232u8, 249u8, 185u8, + 24u8, 155u8, 54u8, 88u8, 96u8, 147u8, 171u8, 85u8, 216u8, + 240u8, 52u8, 158u8, 134u8, 72u8, + ] + { + let call = SetPayee { payee }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "(Re-)set the controller of a stash."] #[doc = ""] @@ -4173,16 +5934,30 @@ pub mod api { ::subxt::sp_core::crypto::AccountId32, (), >, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetController, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetController, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetController { controller }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 239u8, 105u8, 43u8, 234u8, 201u8, 103u8, 93u8, 252u8, 26u8, + 52u8, 27u8, 23u8, 219u8, 153u8, 195u8, 150u8, 244u8, 13u8, + 24u8, 241u8, 199u8, 160u8, 119u8, 37u8, 55u8, 239u8, 142u8, + 16u8, 80u8, 45u8, 20u8, 233u8, + ] + { + let call = SetController { controller }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Sets the ideal number of validators."] #[doc = ""] @@ -4195,16 +5970,30 @@ pub mod api { pub fn set_validator_count( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetValidatorCount, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetValidatorCount, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetValidatorCount { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 181u8, 82u8, 21u8, 239u8, 81u8, 194u8, 166u8, 66u8, 55u8, + 156u8, 68u8, 22u8, 76u8, 251u8, 241u8, 113u8, 168u8, 8u8, + 193u8, 125u8, 112u8, 82u8, 200u8, 139u8, 55u8, 139u8, 22u8, + 35u8, 171u8, 124u8, 112u8, 52u8, + ] + { + let call = SetValidatorCount { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Increments the ideal number of validators."] #[doc = ""] @@ -4216,16 +6005,33 @@ pub mod api { pub fn increase_validator_count( &self, additional: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - IncreaseValidatorCount, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + IncreaseValidatorCount, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = IncreaseValidatorCount { additional }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 219u8, 143u8, 69u8, 205u8, 182u8, 155u8, 101u8, 39u8, 59u8, + 214u8, 81u8, 47u8, 247u8, 54u8, 106u8, 92u8, 183u8, 42u8, + 30u8, 57u8, 28u8, 136u8, 13u8, 13u8, 170u8, 101u8, 216u8, + 234u8, 194u8, 90u8, 248u8, 234u8, + ] + { + let call = IncreaseValidatorCount { additional }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Scale up the ideal number of validators by a factor."] #[doc = ""] @@ -4237,16 +6043,30 @@ pub mod api { pub fn scale_validator_count( &self, factor: runtime_types::sp_arithmetic::per_things::Percent, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ScaleValidatorCount, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ScaleValidatorCount, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ScaleValidatorCount { factor }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 170u8, 156u8, 101u8, 109u8, 117u8, 199u8, 38u8, 157u8, 132u8, + 210u8, 54u8, 66u8, 251u8, 10u8, 123u8, 120u8, 237u8, 31u8, + 206u8, 176u8, 224u8, 112u8, 82u8, 70u8, 152u8, 6u8, 166u8, + 118u8, 10u8, 172u8, 254u8, 148u8, + ] + { + let call = ScaleValidatorCount { factor }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Force there to be no new eras indefinitely."] #[doc = ""] @@ -4265,16 +6085,30 @@ pub mod api { #[doc = "# "] pub fn force_no_eras( &self, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ForceNoEras, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ForceNoEras, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ForceNoEras {}; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 16u8, 81u8, 207u8, 168u8, 23u8, 236u8, 11u8, 75u8, 141u8, + 107u8, 92u8, 2u8, 53u8, 111u8, 252u8, 116u8, 91u8, 120u8, + 75u8, 24u8, 125u8, 53u8, 9u8, 28u8, 242u8, 87u8, 245u8, 55u8, + 40u8, 103u8, 151u8, 178u8, + ] + { + let call = ForceNoEras {}; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Force there to be a new era at the end of the next session. After this, it will be"] #[doc = "reset to normal (non-forced) behaviour."] @@ -4294,16 +6128,30 @@ pub mod api { #[doc = "# "] pub fn force_new_era( &self, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ForceNewEra, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ForceNewEra, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ForceNewEra {}; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 230u8, 242u8, 169u8, 196u8, 78u8, 145u8, 24u8, 191u8, 113u8, + 68u8, 5u8, 138u8, 48u8, 51u8, 109u8, 126u8, 73u8, 136u8, + 162u8, 158u8, 174u8, 201u8, 213u8, 230u8, 215u8, 44u8, 200u8, + 32u8, 75u8, 27u8, 23u8, 254u8, + ] + { + let call = ForceNewEra {}; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set the validators who cannot be slashed (if any)."] #[doc = ""] @@ -4311,16 +6159,30 @@ pub mod api { pub fn set_invulnerables( &self, invulnerables: ::std::vec::Vec<::subxt::sp_core::crypto::AccountId32>, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetInvulnerables, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetInvulnerables, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetInvulnerables { invulnerables }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 0u8, 119u8, 27u8, 243u8, 238u8, 65u8, 133u8, 89u8, 210u8, + 202u8, 154u8, 243u8, 168u8, 158u8, 9u8, 147u8, 146u8, 215u8, + 172u8, 28u8, 171u8, 183u8, 112u8, 42u8, 245u8, 232u8, 238u8, + 94u8, 205u8, 46u8, 0u8, 20u8, + ] + { + let call = SetInvulnerables { invulnerables }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Force a current staker to become completely unstaked, immediately."] #[doc = ""] @@ -4329,19 +6191,33 @@ pub mod api { &self, stash: ::subxt::sp_core::crypto::AccountId32, num_slashing_spans: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ForceUnstake, - DispatchError, - root_mod::Event, - > { - let call = ForceUnstake { - stash, - num_slashing_spans, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ForceUnstake, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 254u8, 115u8, 250u8, 15u8, 235u8, 119u8, 2u8, 131u8, 237u8, + 144u8, 247u8, 66u8, 150u8, 92u8, 12u8, 112u8, 137u8, 195u8, + 246u8, 178u8, 129u8, 64u8, 214u8, 4u8, 183u8, 18u8, 94u8, + 104u8, 157u8, 174u8, 231u8, 1u8, + ] + { + let call = ForceUnstake { + stash, + num_slashing_spans, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Force there to be a new era at the end of sessions indefinitely."] #[doc = ""] @@ -4354,16 +6230,30 @@ pub mod api { #[doc = "have enough blocks to get a result."] pub fn force_new_era_always( &self, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ForceNewEraAlways, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ForceNewEraAlways, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ForceNewEraAlways {}; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 179u8, 118u8, 189u8, 54u8, 248u8, 141u8, 207u8, 142u8, 80u8, + 37u8, 241u8, 185u8, 138u8, 254u8, 117u8, 147u8, 225u8, 118u8, + 34u8, 177u8, 197u8, 158u8, 8u8, 82u8, 202u8, 108u8, 208u8, + 26u8, 64u8, 33u8, 74u8, 43u8, + ] + { + let call = ForceNewEraAlways {}; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Cancel enactment of a deferred slash."] #[doc = ""] @@ -4374,16 +6264,30 @@ pub mod api { &self, era: ::core::primitive::u32, slash_indices: ::std::vec::Vec<::core::primitive::u32>, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - CancelDeferredSlash, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + CancelDeferredSlash, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = CancelDeferredSlash { era, slash_indices }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 217u8, 175u8, 246u8, 108u8, 78u8, 134u8, 98u8, 49u8, 178u8, + 209u8, 98u8, 178u8, 52u8, 242u8, 173u8, 135u8, 171u8, 70u8, + 129u8, 239u8, 62u8, 150u8, 84u8, 142u8, 243u8, 193u8, 179u8, + 249u8, 114u8, 231u8, 8u8, 252u8, + ] + { + let call = CancelDeferredSlash { era, slash_indices }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Pay out all the stakers behind a single validator for a single era."] #[doc = ""] @@ -4410,19 +6314,33 @@ pub mod api { &self, validator_stash: ::subxt::sp_core::crypto::AccountId32, era: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - PayoutStakers, - DispatchError, - root_mod::Event, - > { - let call = PayoutStakers { - validator_stash, - era, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + PayoutStakers, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 235u8, 65u8, 65u8, 249u8, 162u8, 235u8, 127u8, 48u8, 216u8, + 51u8, 252u8, 111u8, 186u8, 191u8, 174u8, 245u8, 144u8, 77u8, + 135u8, 124u8, 205u8, 160u8, 148u8, 130u8, 81u8, 213u8, 195u8, + 105u8, 21u8, 65u8, 186u8, 157u8, + ] + { + let call = PayoutStakers { + validator_stash, + era, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Rebond a portion of the stash scheduled to be unlocked."] #[doc = ""] @@ -4436,16 +6354,30 @@ pub mod api { pub fn rebond( &self, value: ::core::primitive::u128, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Rebond, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Rebond, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = Rebond { value }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 138u8, 156u8, 164u8, 170u8, 178u8, 236u8, 221u8, 242u8, + 157u8, 176u8, 173u8, 145u8, 254u8, 94u8, 158u8, 27u8, 138u8, + 103u8, 116u8, 31u8, 41u8, 106u8, 199u8, 180u8, 233u8, 172u8, + 38u8, 7u8, 76u8, 29u8, 5u8, 225u8, + ] + { + let call = Rebond { value }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set `HistoryDepth` value. This function will delete any history information"] #[doc = "when `HistoryDepth` is reduced."] @@ -4473,19 +6405,33 @@ pub mod api { &self, new_history_depth: ::core::primitive::u32, era_items_deleted: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetHistoryDepth, - DispatchError, - root_mod::Event, - > { - let call = SetHistoryDepth { - new_history_depth, - era_items_deleted, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetHistoryDepth, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 128u8, 149u8, 139u8, 192u8, 213u8, 239u8, 248u8, 215u8, 57u8, + 145u8, 177u8, 225u8, 43u8, 214u8, 228u8, 14u8, 213u8, 181u8, + 18u8, 40u8, 242u8, 1u8, 210u8, 87u8, 143u8, 78u8, 0u8, 23u8, + 145u8, 46u8, 210u8, 168u8, + ] + { + let call = SetHistoryDepth { + new_history_depth, + era_items_deleted, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Remove all data structures concerning a staker/stash once it is at a state where it can"] #[doc = "be considered `dust` in the staking system. The requirements are:"] @@ -4503,19 +6449,33 @@ pub mod api { &self, stash: ::subxt::sp_core::crypto::AccountId32, num_slashing_spans: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ReapStash, - DispatchError, - root_mod::Event, - > { - let call = ReapStash { - stash, - num_slashing_spans, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ReapStash, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 84u8, 192u8, 207u8, 193u8, 133u8, 53u8, 93u8, 148u8, 153u8, + 112u8, 54u8, 145u8, 68u8, 195u8, 42u8, 158u8, 17u8, 230u8, + 197u8, 218u8, 179u8, 101u8, 237u8, 105u8, 17u8, 232u8, 125u8, + 163u8, 209u8, 134u8, 3u8, 248u8, + ] + { + let call = ReapStash { + stash, + num_slashing_spans, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Remove the given nominations from the calling validator."] #[doc = ""] @@ -4536,16 +6496,30 @@ pub mod api { (), >, >, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Kick, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Kick, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = Kick { who }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 145u8, 201u8, 168u8, 147u8, 25u8, 39u8, 62u8, 48u8, 236u8, + 44u8, 45u8, 233u8, 178u8, 196u8, 117u8, 117u8, 74u8, 193u8, + 131u8, 101u8, 210u8, 40u8, 18u8, 207u8, 99u8, 160u8, 103u8, + 89u8, 69u8, 72u8, 155u8, 89u8, + ] + { + let call = Kick { who }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Update the various staking configurations ."] #[doc = ""] @@ -4572,23 +6546,37 @@ pub mod api { max_validator_count : runtime_types :: pallet_staking :: pallet :: pallet :: ConfigOp < :: core :: primitive :: u32 >, chill_threshold : runtime_types :: pallet_staking :: pallet :: pallet :: ConfigOp < runtime_types :: sp_arithmetic :: per_things :: Percent >, min_commission : runtime_types :: pallet_staking :: pallet :: pallet :: ConfigOp < runtime_types :: sp_arithmetic :: per_things :: Perbill >, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetStakingConfigs, - DispatchError, - root_mod::Event, - > { - let call = SetStakingConfigs { - min_nominator_bond, - min_validator_bond, - max_nominator_count, - max_validator_count, - chill_threshold, - min_commission, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetStakingConfigs, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 249u8, 192u8, 107u8, 126u8, 200u8, 50u8, 63u8, 120u8, 116u8, + 53u8, 183u8, 80u8, 134u8, 135u8, 49u8, 112u8, 232u8, 140u8, + 177u8, 175u8, 136u8, 220u8, 209u8, 179u8, 219u8, 110u8, 19u8, + 165u8, 191u8, 173u8, 65u8, 13u8, + ] + { + let call = SetStakingConfigs { + min_nominator_bond, + min_validator_bond, + max_nominator_count, + max_validator_count, + chill_threshold, + min_commission, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Declare a `controller` to stop participating as either a validator or nominator."] #[doc = ""] @@ -4619,16 +6607,30 @@ pub mod api { pub fn chill_other( &self, controller: ::subxt::sp_core::crypto::AccountId32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ChillOther, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ChillOther, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ChillOther { controller }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 219u8, 114u8, 146u8, 43u8, 175u8, 216u8, 70u8, 148u8, 137u8, + 192u8, 77u8, 247u8, 134u8, 80u8, 188u8, 100u8, 79u8, 141u8, + 32u8, 94u8, 15u8, 178u8, 159u8, 233u8, 235u8, 6u8, 243u8, + 253u8, 22u8, 145u8, 146u8, 219u8, + ] + { + let call = ChillOther { controller }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Force a validator to have at least the minimum commission. This will not affect a"] #[doc = "validator who already has a commission greater than or equal to the minimum. Any account"] @@ -4636,16 +6638,33 @@ pub mod api { pub fn force_apply_min_commission( &self, validator_stash: ::subxt::sp_core::crypto::AccountId32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ForceApplyMinCommission, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ForceApplyMinCommission, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ForceApplyMinCommission { validator_stash }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 8u8, 57u8, 61u8, 141u8, 175u8, 100u8, 174u8, 161u8, 236u8, + 2u8, 133u8, 169u8, 249u8, 168u8, 236u8, 188u8, 168u8, 221u8, + 88u8, 148u8, 95u8, 24u8, 214u8, 206u8, 165u8, 170u8, 200u8, + 134u8, 38u8, 174u8, 187u8, 119u8, + ] + { + let call = ForceApplyMinCommission { validator_stash }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -5269,101 +7288,224 @@ pub mod api { #[doc = " guaranteed."] pub async fn history_depth( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let entry = HistoryDepth; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 41u8, 54u8, 118u8, 245u8, 75u8, 136u8, 220u8, 25u8, 55u8, + 255u8, 149u8, 177u8, 49u8, 155u8, 167u8, 188u8, 170u8, 29u8, + 251u8, 44u8, 240u8, 250u8, 225u8, 205u8, 102u8, 74u8, 25u8, + 47u8, 52u8, 235u8, 204u8, 167u8, + ] + { + let entry = HistoryDepth; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The ideal number of staking participants."] pub async fn validator_count( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let entry = ValidatorCount; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 245u8, 75u8, 214u8, 110u8, 66u8, 164u8, 86u8, 206u8, 69u8, + 89u8, 12u8, 111u8, 117u8, 16u8, 228u8, 184u8, 207u8, 6u8, + 0u8, 126u8, 221u8, 67u8, 125u8, 218u8, 188u8, 245u8, 156u8, + 188u8, 34u8, 85u8, 208u8, 197u8, + ] + { + let entry = ValidatorCount; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Minimum number of staking participants before emergency conditions are imposed."] pub async fn minimum_validator_count( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let entry = MinimumValidatorCount; - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 82u8, 95u8, 128u8, 55u8, 136u8, 134u8, 71u8, 117u8, 135u8, + 76u8, 44u8, 46u8, 174u8, 34u8, 170u8, 228u8, 175u8, 1u8, + 234u8, 162u8, 91u8, 252u8, 127u8, 68u8, 243u8, 241u8, 13u8, + 107u8, 214u8, 70u8, 87u8, 249u8, + ] + { + let entry = MinimumValidatorCount; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Any validators that may never be slashed or forcibly kicked. It's a Vec since they're"] #[doc = " easy to initialize and the performance hit is minimal (we expect no more than four"] #[doc = " invulnerables) and restricted to testnets."] pub async fn invulnerables( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec<::subxt::sp_core::crypto::AccountId32>, ::subxt::BasicError, > { - let entry = Invulnerables; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 103u8, 93u8, 29u8, 166u8, 244u8, 19u8, 78u8, 182u8, 235u8, + 37u8, 199u8, 127u8, 211u8, 124u8, 168u8, 145u8, 111u8, 251u8, + 33u8, 36u8, 167u8, 119u8, 124u8, 206u8, 205u8, 14u8, 186u8, + 68u8, 16u8, 150u8, 45u8, 158u8, + ] + { + let entry = Invulnerables; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Map from all locked \"stash\" accounts to the controller account."] pub async fn bonded( &self, _0: &::subxt::sp_core::crypto::AccountId32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<::subxt::sp_core::crypto::AccountId32>, ::subxt::BasicError, > { - let entry = Bonded(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 9u8, 214u8, 190u8, 93u8, 116u8, 143u8, 174u8, 103u8, 102u8, + 25u8, 123u8, 201u8, 12u8, 44u8, 188u8, 241u8, 74u8, 33u8, + 35u8, 79u8, 210u8, 243u8, 174u8, 190u8, 46u8, 48u8, 21u8, + 10u8, 243u8, 16u8, 99u8, 48u8, + ] + { + let entry = Bonded(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Map from all locked \"stash\" accounts to the controller account."] pub async fn bonded_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Bonded<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 9u8, 214u8, 190u8, 93u8, 116u8, 143u8, 174u8, 103u8, 102u8, + 25u8, 123u8, 201u8, 12u8, 44u8, 188u8, 241u8, 74u8, 33u8, + 35u8, 79u8, 210u8, 243u8, 174u8, 190u8, 46u8, 48u8, 21u8, + 10u8, 243u8, 16u8, 99u8, 48u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The minimum active bond to become and maintain the role of a nominator."] pub async fn min_nominator_bond( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let entry = MinNominatorBond; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 187u8, 66u8, 149u8, 226u8, 72u8, 219u8, 57u8, 246u8, 102u8, + 47u8, 71u8, 12u8, 219u8, 204u8, 127u8, 223u8, 58u8, 134u8, + 81u8, 165u8, 200u8, 142u8, 196u8, 158u8, 26u8, 38u8, 165u8, + 19u8, 91u8, 251u8, 119u8, 84u8, + ] + { + let entry = MinNominatorBond; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The minimum active bond to become and maintain the role of a validator."] pub async fn min_validator_bond( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let entry = MinValidatorBond; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 48u8, 105u8, 85u8, 178u8, 142u8, 208u8, 208u8, 19u8, 236u8, + 130u8, 129u8, 169u8, 35u8, 245u8, 66u8, 182u8, 92u8, 20u8, + 22u8, 109u8, 155u8, 174u8, 87u8, 118u8, 242u8, 216u8, 193u8, + 154u8, 4u8, 5u8, 66u8, 56u8, + ] + { + let entry = MinValidatorBond; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The minimum amount of commission that validators can set."] #[doc = ""] #[doc = " If set to `0`, no limit exists."] pub async fn min_commission( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< runtime_types::sp_arithmetic::per_things::Perbill, ::subxt::BasicError, > { - let entry = MinCommission; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 198u8, 29u8, 53u8, 56u8, 181u8, 170u8, 164u8, 240u8, 27u8, + 171u8, 69u8, 57u8, 151u8, 40u8, 23u8, 166u8, 157u8, 68u8, + 208u8, 20u8, 2u8, 78u8, 63u8, 235u8, 166u8, 50u8, 3u8, 246u8, + 237u8, 146u8, 170u8, 91u8, + ] + { + let entry = MinCommission; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Map from all (unlocked) \"controller\" accounts to the info regarding the staking."] pub async fn ledger( &self, _0: &::subxt::sp_core::crypto::AccountId32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::pallet_staking::StakingLedger< @@ -5373,86 +7515,189 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = Ledger(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 91u8, 46u8, 130u8, 228u8, 126u8, 95u8, 46u8, 57u8, 222u8, + 98u8, 250u8, 145u8, 83u8, 135u8, 240u8, 153u8, 57u8, 21u8, + 232u8, 254u8, 217u8, 22u8, 62u8, 76u8, 128u8, 159u8, 137u8, + 149u8, 112u8, 251u8, 142u8, 35u8, + ] + { + let entry = Ledger(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Map from all (unlocked) \"controller\" accounts to the info regarding the staking."] pub async fn ledger_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Ledger<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 91u8, 46u8, 130u8, 228u8, 126u8, 95u8, 46u8, 57u8, 222u8, + 98u8, 250u8, 145u8, 83u8, 135u8, 240u8, 153u8, 57u8, 21u8, + 232u8, 254u8, 217u8, 22u8, 62u8, 76u8, 128u8, 159u8, 137u8, + 149u8, 112u8, 251u8, 142u8, 35u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Where the reward payment should be made. Keyed by stash."] pub async fn payee( &self, _0: &::subxt::sp_core::crypto::AccountId32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< runtime_types::pallet_staking::RewardDestination< ::subxt::sp_core::crypto::AccountId32, >, ::subxt::BasicError, > { - let entry = Payee(_0); - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 108u8, 35u8, 28u8, 189u8, 146u8, 103u8, 200u8, 73u8, 220u8, + 230u8, 193u8, 7u8, 66u8, 147u8, 55u8, 34u8, 1u8, 21u8, 255u8, + 100u8, 64u8, 175u8, 16u8, 106u8, 130u8, 202u8, 103u8, 62u8, + 79u8, 143u8, 115u8, 222u8, + ] + { + let entry = Payee(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Where the reward payment should be made. Keyed by stash."] pub async fn payee_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Payee<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 108u8, 35u8, 28u8, 189u8, 146u8, 103u8, 200u8, 73u8, 220u8, + 230u8, 193u8, 7u8, 66u8, 147u8, 55u8, 34u8, 1u8, 21u8, 255u8, + 100u8, 64u8, 175u8, 16u8, 106u8, 130u8, 202u8, 103u8, 62u8, + 79u8, 143u8, 115u8, 222u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The map from (wannabe) validator stash key to the preferences of that validator."] pub async fn validators( &self, _0: &::subxt::sp_core::crypto::AccountId32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< runtime_types::pallet_staking::ValidatorPrefs, ::subxt::BasicError, > { - let entry = Validators(_0); - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 45u8, 57u8, 106u8, 30u8, 123u8, 251u8, 148u8, 37u8, 52u8, + 129u8, 103u8, 88u8, 54u8, 216u8, 174u8, 181u8, 51u8, 181u8, + 70u8, 6u8, 136u8, 7u8, 239u8, 44u8, 83u8, 153u8, 124u8, + 187u8, 225u8, 112u8, 23u8, 76u8, + ] + { + let entry = Validators(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The map from (wannabe) validator stash key to the preferences of that validator."] pub async fn validators_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Validators<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 45u8, 57u8, 106u8, 30u8, 123u8, 251u8, 148u8, 37u8, 52u8, + 129u8, 103u8, 88u8, 54u8, 216u8, 174u8, 181u8, 51u8, 181u8, + 70u8, 6u8, 136u8, 7u8, 239u8, 44u8, 83u8, 153u8, 124u8, + 187u8, 225u8, 112u8, 23u8, 76u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Counter for the related counted storage map"] pub async fn counter_for_validators( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let entry = CounterForValidators; - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 139u8, 25u8, 223u8, 6u8, 160u8, 239u8, 212u8, 85u8, 36u8, + 185u8, 69u8, 63u8, 21u8, 156u8, 144u8, 241u8, 112u8, 85u8, + 49u8, 78u8, 88u8, 11u8, 8u8, 48u8, 118u8, 34u8, 62u8, 159u8, + 239u8, 122u8, 90u8, 45u8, + ] + { + let entry = CounterForValidators; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The maximum validator count before we stop allowing new validators to join."] #[doc = ""] #[doc = " When this value is not set, no limits are enforced."] pub async fn max_validators_count( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<::core::primitive::u32>, ::subxt::BasicError, > { - let entry = MaxValidatorsCount; - self.client.storage().fetch(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 250u8, 62u8, 16u8, 68u8, 192u8, 216u8, 236u8, 211u8, 217u8, + 9u8, 213u8, 49u8, 41u8, 37u8, 58u8, 62u8, 131u8, 112u8, 64u8, + 26u8, 133u8, 7u8, 130u8, 1u8, 71u8, 158u8, 14u8, 55u8, 169u8, + 239u8, 223u8, 245u8, + ] + { + let entry = MaxValidatorsCount; + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The map from nominator stash key to their nomination preferences, namely the validators that"] #[doc = " they wish to support."] @@ -5473,13 +7718,24 @@ pub mod api { pub async fn nominators( &self, _0: &::subxt::sp_core::crypto::AccountId32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option, ::subxt::BasicError, > { - let entry = Nominators(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 176u8, 26u8, 169u8, 68u8, 99u8, 216u8, 95u8, 198u8, 5u8, + 123u8, 21u8, 83u8, 220u8, 140u8, 122u8, 111u8, 22u8, 133u8, + 9u8, 155u8, 35u8, 58u8, 232u8, 143u8, 62u8, 229u8, 228u8, + 98u8, 175u8, 114u8, 152u8, 253u8, + ] + { + let entry = Nominators(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The map from nominator stash key to their nomination preferences, namely the validators that"] #[doc = " they wish to support."] @@ -5499,34 +7755,76 @@ pub mod api { #[doc = " [`Call::chill_other`] dispatchable by anyone."] pub async fn nominators_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Nominators<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 176u8, 26u8, 169u8, 68u8, 99u8, 216u8, 95u8, 198u8, 5u8, + 123u8, 21u8, 83u8, 220u8, 140u8, 122u8, 111u8, 22u8, 133u8, + 9u8, 155u8, 35u8, 58u8, 232u8, 143u8, 62u8, 229u8, 228u8, + 98u8, 175u8, 114u8, 152u8, 253u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Counter for the related counted storage map"] pub async fn counter_for_nominators( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let entry = CounterForNominators; - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 31u8, 94u8, 130u8, 138u8, 75u8, 8u8, 38u8, 162u8, 181u8, 5u8, + 125u8, 116u8, 9u8, 51u8, 22u8, 234u8, 40u8, 117u8, 215u8, + 46u8, 82u8, 117u8, 225u8, 1u8, 9u8, 208u8, 83u8, 63u8, 39u8, + 187u8, 207u8, 191u8, + ] + { + let entry = CounterForNominators; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The maximum nominator count before we stop allowing new validators to join."] #[doc = ""] #[doc = " When this value is not set, no limits are enforced."] pub async fn max_nominators_count( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<::core::primitive::u32>, ::subxt::BasicError, > { - let entry = MaxNominatorsCount; - self.client.storage().fetch(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 180u8, 190u8, 180u8, 66u8, 235u8, 173u8, 76u8, 160u8, 197u8, + 92u8, 96u8, 165u8, 220u8, 188u8, 32u8, 119u8, 3u8, 73u8, + 86u8, 49u8, 104u8, 17u8, 186u8, 98u8, 221u8, 175u8, 109u8, + 254u8, 207u8, 245u8, 125u8, 179u8, + ] + { + let entry = MaxNominatorsCount; + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The current era index."] #[doc = ""] @@ -5534,13 +7832,24 @@ pub mod api { #[doc = " set, it might be active or not."] pub async fn current_era( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<::core::primitive::u32>, ::subxt::BasicError, > { - let entry = CurrentEra; - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 105u8, 150u8, 49u8, 122u8, 4u8, 78u8, 8u8, 121u8, 34u8, + 136u8, 157u8, 227u8, 59u8, 139u8, 7u8, 253u8, 7u8, 10u8, + 117u8, 71u8, 240u8, 74u8, 86u8, 36u8, 198u8, 37u8, 153u8, + 93u8, 196u8, 22u8, 192u8, 243u8, + ] + { + let entry = CurrentEra; + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The active era information, it holds index and start."] #[doc = ""] @@ -5548,13 +7857,24 @@ pub mod api { #[doc = " equal to [`SessionInterface::validators`]."] pub async fn active_era( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option, ::subxt::BasicError, > { - let entry = ActiveEra; - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 230u8, 144u8, 49u8, 201u8, 36u8, 253u8, 97u8, 135u8, 57u8, + 169u8, 157u8, 138u8, 21u8, 35u8, 14u8, 2u8, 151u8, 214u8, + 176u8, 211u8, 48u8, 105u8, 38u8, 123u8, 98u8, 255u8, 14u8, + 35u8, 177u8, 247u8, 31u8, 28u8, + ] + { + let entry = ActiveEra; + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The session index at which the era start for the last `HISTORY_DEPTH` eras."] #[doc = ""] @@ -5563,13 +7883,27 @@ pub mod api { pub async fn eras_start_session_index( &self, _0: &::core::primitive::u32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<::core::primitive::u32>, ::subxt::BasicError, > { - let entry = ErasStartSessionIndex(_0); - self.client.storage().fetch(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 92u8, 157u8, 168u8, 144u8, 132u8, 3u8, 212u8, 80u8, 230u8, + 229u8, 251u8, 218u8, 97u8, 55u8, 79u8, 100u8, 163u8, 91u8, + 32u8, 246u8, 122u8, 78u8, 149u8, 214u8, 103u8, 249u8, 119u8, + 20u8, 101u8, 116u8, 110u8, 185u8, + ] + { + let entry = ErasStartSessionIndex(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The session index at which the era start for the last `HISTORY_DEPTH` eras."] #[doc = ""] @@ -5577,12 +7911,26 @@ pub mod api { #[doc = " for the eras in `[CurrentEra - HISTORY_DEPTH, CurrentEra]`."] pub async fn eras_start_session_index_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, ErasStartSessionIndex<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 92u8, 157u8, 168u8, 144u8, 132u8, 3u8, 212u8, 80u8, 230u8, + 229u8, 251u8, 218u8, 97u8, 55u8, 79u8, 100u8, 163u8, 91u8, + 32u8, 246u8, 122u8, 78u8, 149u8, 214u8, 103u8, 249u8, 119u8, + 20u8, 101u8, 116u8, 110u8, 185u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Exposure of validator at era."] #[doc = ""] @@ -5594,7 +7942,7 @@ pub mod api { &self, _0: &::core::primitive::u32, _1: &::subxt::sp_core::crypto::AccountId32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< runtime_types::pallet_staking::Exposure< ::subxt::sp_core::crypto::AccountId32, @@ -5602,8 +7950,22 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = ErasStakers(_0, _1); - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 176u8, 250u8, 76u8, 183u8, 219u8, 180u8, 156u8, 138u8, 111u8, + 153u8, 154u8, 90u8, 14u8, 194u8, 56u8, 133u8, 197u8, 199u8, + 35u8, 20u8, 188u8, 129u8, 169u8, 38u8, 10u8, 219u8, 186u8, + 107u8, 179u8, 160u8, 244u8, 210u8, + ] + { + let entry = ErasStakers(_0, _1); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Exposure of validator at era."] #[doc = ""] @@ -5613,12 +7975,23 @@ pub mod api { #[doc = " If stakers hasn't been set or has been removed then empty exposure is returned."] pub async fn eras_stakers_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, ErasStakers<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 176u8, 250u8, 76u8, 183u8, 219u8, 180u8, 156u8, 138u8, 111u8, + 153u8, 154u8, 90u8, 14u8, 194u8, 56u8, 133u8, 197u8, 199u8, + 35u8, 20u8, 188u8, 129u8, 169u8, 38u8, 10u8, 219u8, 186u8, + 107u8, 179u8, 160u8, 244u8, 210u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Clipped Exposure of validator at era."] #[doc = ""] @@ -5635,7 +8008,7 @@ pub mod api { &self, _0: &::core::primitive::u32, _1: &::subxt::sp_core::crypto::AccountId32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< runtime_types::pallet_staking::Exposure< ::subxt::sp_core::crypto::AccountId32, @@ -5643,8 +8016,25 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = ErasStakersClipped(_0, _1); - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 91u8, 87u8, 165u8, 255u8, 253u8, 169u8, 48u8, 28u8, 254u8, + 124u8, 93u8, 108u8, 252u8, 15u8, 141u8, 139u8, 152u8, 118u8, + 226u8, 122u8, 178u8, 110u8, 4u8, 242u8, 62u8, 77u8, 157u8, + 122u8, 149u8, 225u8, 201u8, 231u8, + ] + { + let entry = ErasStakersClipped(_0, _1); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Clipped Exposure of validator at era."] #[doc = ""] @@ -5659,12 +8049,26 @@ pub mod api { #[doc = " If stakers hasn't been set or has been removed then empty exposure is returned."] pub async fn eras_stakers_clipped_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, ErasStakersClipped<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 91u8, 87u8, 165u8, 255u8, 253u8, 169u8, 48u8, 28u8, 254u8, + 124u8, 93u8, 108u8, 252u8, 15u8, 141u8, 139u8, 152u8, 118u8, + 226u8, 122u8, 178u8, 110u8, 4u8, 242u8, 62u8, 77u8, 157u8, + 122u8, 149u8, 225u8, 201u8, 231u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Similar to `ErasStakers`, this holds the preferences of validators."] #[doc = ""] @@ -5675,13 +8079,30 @@ pub mod api { &self, _0: &::core::primitive::u32, _1: &::subxt::sp_core::crypto::AccountId32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< runtime_types::pallet_staking::ValidatorPrefs, ::subxt::BasicError, > { - let entry = ErasValidatorPrefs(_0, _1); - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 8u8, 55u8, 222u8, 216u8, 126u8, 126u8, 131u8, 18u8, 145u8, + 58u8, 91u8, 123u8, 92u8, 19u8, 178u8, 200u8, 133u8, 140u8, + 3u8, 207u8, 101u8, 70u8, 204u8, 172u8, 98u8, 137u8, 149u8, + 74u8, 99u8, 141u8, 150u8, 228u8, + ] + { + let entry = ErasValidatorPrefs(_0, _1); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Similar to `ErasStakers`, this holds the preferences of validators."] #[doc = ""] @@ -5690,12 +8111,26 @@ pub mod api { #[doc = " Is it removed after `HISTORY_DEPTH` eras."] pub async fn eras_validator_prefs_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, ErasValidatorPrefs<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 8u8, 55u8, 222u8, 216u8, 126u8, 126u8, 131u8, 18u8, 145u8, + 58u8, 91u8, 123u8, 92u8, 19u8, 178u8, 200u8, 133u8, 140u8, + 3u8, 207u8, 101u8, 70u8, 204u8, 172u8, 98u8, 137u8, 149u8, + 74u8, 99u8, 141u8, 150u8, 228u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The total validator era payout for the last `HISTORY_DEPTH` eras."] #[doc = ""] @@ -5703,113 +8138,239 @@ pub mod api { pub async fn eras_validator_reward( &self, _0: &::core::primitive::u32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<::core::primitive::u128>, ::subxt::BasicError, > { - let entry = ErasValidatorReward(_0); - self.client.storage().fetch(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 87u8, 80u8, 156u8, 123u8, 107u8, 77u8, 203u8, 37u8, 231u8, + 84u8, 124u8, 155u8, 227u8, 212u8, 212u8, 179u8, 84u8, 161u8, + 223u8, 255u8, 254u8, 107u8, 52u8, 89u8, 98u8, 169u8, 136u8, + 241u8, 104u8, 3u8, 244u8, 161u8, + ] + { + let entry = ErasValidatorReward(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The total validator era payout for the last `HISTORY_DEPTH` eras."] #[doc = ""] #[doc = " Eras that haven't finished yet or has been removed doesn't have reward."] pub async fn eras_validator_reward_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, ErasValidatorReward<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 87u8, 80u8, 156u8, 123u8, 107u8, 77u8, 203u8, 37u8, 231u8, + 84u8, 124u8, 155u8, 227u8, 212u8, 212u8, 179u8, 84u8, 161u8, + 223u8, 255u8, 254u8, 107u8, 52u8, 89u8, 98u8, 169u8, 136u8, + 241u8, 104u8, 3u8, 244u8, 161u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Rewards for the last `HISTORY_DEPTH` eras."] #[doc = " If reward hasn't been set or has been removed then 0 reward is returned."] pub async fn eras_reward_points( &self, _0: &::core::primitive::u32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< runtime_types::pallet_staking::EraRewardPoints< ::subxt::sp_core::crypto::AccountId32, >, ::subxt::BasicError, > { - let entry = ErasRewardPoints(_0); - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 76u8, 221u8, 158u8, 62u8, 3u8, 254u8, 139u8, 170u8, 103u8, + 218u8, 191u8, 103u8, 57u8, 212u8, 208u8, 7u8, 105u8, 52u8, + 117u8, 173u8, 8u8, 34u8, 82u8, 141u8, 51u8, 72u8, 243u8, + 56u8, 206u8, 206u8, 48u8, 140u8, + ] + { + let entry = ErasRewardPoints(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Rewards for the last `HISTORY_DEPTH` eras."] #[doc = " If reward hasn't been set or has been removed then 0 reward is returned."] pub async fn eras_reward_points_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, ErasRewardPoints<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 76u8, 221u8, 158u8, 62u8, 3u8, 254u8, 139u8, 170u8, 103u8, + 218u8, 191u8, 103u8, 57u8, 212u8, 208u8, 7u8, 105u8, 52u8, + 117u8, 173u8, 8u8, 34u8, 82u8, 141u8, 51u8, 72u8, 243u8, + 56u8, 206u8, 206u8, 48u8, 140u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The total amount staked for the last `HISTORY_DEPTH` eras."] #[doc = " If total hasn't been set or has been removed then 0 stake is returned."] pub async fn eras_total_stake( &self, _0: &::core::primitive::u32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let entry = ErasTotalStake(_0); - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 224u8, 240u8, 168u8, 69u8, 148u8, 140u8, 249u8, 240u8, 4u8, + 46u8, 77u8, 11u8, 224u8, 65u8, 26u8, 239u8, 1u8, 110u8, 53u8, + 11u8, 247u8, 235u8, 142u8, 234u8, 22u8, 43u8, 24u8, 36u8, + 37u8, 43u8, 170u8, 40u8, + ] + { + let entry = ErasTotalStake(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The total amount staked for the last `HISTORY_DEPTH` eras."] #[doc = " If total hasn't been set or has been removed then 0 stake is returned."] pub async fn eras_total_stake_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, ErasTotalStake<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 224u8, 240u8, 168u8, 69u8, 148u8, 140u8, 249u8, 240u8, 4u8, + 46u8, 77u8, 11u8, 224u8, 65u8, 26u8, 239u8, 1u8, 110u8, 53u8, + 11u8, 247u8, 235u8, 142u8, 234u8, 22u8, 43u8, 24u8, 36u8, + 37u8, 43u8, 170u8, 40u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Mode of era forcing."] pub async fn force_era( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< runtime_types::pallet_staking::Forcing, ::subxt::BasicError, > { - let entry = ForceEra; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 221u8, 41u8, 71u8, 21u8, 28u8, 193u8, 65u8, 97u8, 103u8, + 37u8, 145u8, 146u8, 183u8, 194u8, 57u8, 131u8, 214u8, 136u8, + 68u8, 156u8, 140u8, 194u8, 69u8, 151u8, 115u8, 177u8, 92u8, + 147u8, 29u8, 40u8, 41u8, 31u8, + ] + { + let entry = ForceEra; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The percentage of the slash that is distributed to reporters."] #[doc = ""] #[doc = " The rest of the slashed value is handled by the `Slash`."] pub async fn slash_reward_fraction( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< runtime_types::sp_arithmetic::per_things::Perbill, ::subxt::BasicError, > { - let entry = SlashRewardFraction; - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 92u8, 55u8, 255u8, 233u8, 174u8, 125u8, 32u8, 21u8, 78u8, + 237u8, 123u8, 241u8, 113u8, 243u8, 48u8, 101u8, 190u8, 165u8, + 216u8, 134u8, 35u8, 128u8, 7u8, 207u8, 48u8, 92u8, 116u8, + 179u8, 253u8, 14u8, 87u8, 176u8, + ] + { + let entry = SlashRewardFraction; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The amount of currency given to reporters of a slash event which was"] #[doc = " canceled by extraordinary circumstances (e.g. governance)."] pub async fn canceled_slash_payout( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let entry = CanceledSlashPayout; - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 126u8, 218u8, 66u8, 92u8, 82u8, 124u8, 145u8, 161u8, 40u8, + 176u8, 14u8, 211u8, 178u8, 216u8, 8u8, 156u8, 83u8, 14u8, + 91u8, 15u8, 200u8, 170u8, 3u8, 127u8, 141u8, 139u8, 151u8, + 98u8, 74u8, 96u8, 238u8, 29u8, + ] + { + let entry = CanceledSlashPayout; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " All unapplied slashes that are queued for later."] pub async fn unapplied_slashes( &self, _0: &::core::primitive::u32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec< runtime_types::pallet_staking::UnappliedSlash< @@ -5819,18 +8380,43 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = UnappliedSlashes(_0); - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 213u8, 28u8, 144u8, 139u8, 187u8, 184u8, 7u8, 192u8, 114u8, + 57u8, 238u8, 66u8, 7u8, 254u8, 41u8, 230u8, 189u8, 188u8, + 127u8, 49u8, 201u8, 179u8, 21u8, 157u8, 177u8, 130u8, 137u8, + 151u8, 51u8, 213u8, 242u8, 236u8, + ] + { + let entry = UnappliedSlashes(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " All unapplied slashes that are queued for later."] pub async fn unapplied_slashes_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, UnappliedSlashes<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 213u8, 28u8, 144u8, 139u8, 187u8, 184u8, 7u8, 192u8, 114u8, + 57u8, 238u8, 66u8, 7u8, 254u8, 41u8, 230u8, 189u8, 188u8, + 127u8, 49u8, 201u8, 179u8, 21u8, 157u8, 177u8, 130u8, 137u8, + 151u8, 51u8, 213u8, 242u8, 236u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " A mapping from still-bonded eras to the first session index of that era."] #[doc = ""] @@ -5838,13 +8424,27 @@ pub mod api { #[doc = " `[active_era - bounding_duration; active_era]`"] pub async fn bonded_eras( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec<(::core::primitive::u32, ::core::primitive::u32)>, ::subxt::BasicError, > { - let entry = BondedEras; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 243u8, 162u8, 236u8, 198u8, 122u8, 182u8, 37u8, 55u8, 171u8, + 156u8, 235u8, 223u8, 226u8, 129u8, 89u8, 206u8, 2u8, 155u8, + 222u8, 154u8, 116u8, 124u8, 4u8, 119u8, 155u8, 94u8, 248u8, + 30u8, 171u8, 51u8, 78u8, 106u8, + ] + { + let entry = BondedEras; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " All slashing events on validators, mapped by era to the highest slash proportion"] #[doc = " and slash value of the era."] @@ -5852,7 +8452,7 @@ pub mod api { &self, _0: &::core::primitive::u32, _1: &::subxt::sp_core::crypto::AccountId32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<( runtime_types::sp_arithmetic::per_things::Perbill, @@ -5860,66 +8460,144 @@ pub mod api { )>, ::subxt::BasicError, > { - let entry = ValidatorSlashInEra(_0, _1); - self.client.storage().fetch(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 241u8, 177u8, 227u8, 239u8, 150u8, 186u8, 50u8, 97u8, 144u8, + 224u8, 24u8, 149u8, 189u8, 166u8, 71u8, 232u8, 221u8, 129u8, + 122u8, 248u8, 235u8, 100u8, 130u8, 230u8, 11u8, 96u8, 214u8, + 59u8, 79u8, 40u8, 236u8, 136u8, + ] + { + let entry = ValidatorSlashInEra(_0, _1); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " All slashing events on validators, mapped by era to the highest slash proportion"] #[doc = " and slash value of the era."] pub async fn validator_slash_in_era_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, ValidatorSlashInEra<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 241u8, 177u8, 227u8, 239u8, 150u8, 186u8, 50u8, 97u8, 144u8, + 224u8, 24u8, 149u8, 189u8, 166u8, 71u8, 232u8, 221u8, 129u8, + 122u8, 248u8, 235u8, 100u8, 130u8, 230u8, 11u8, 96u8, 214u8, + 59u8, 79u8, 40u8, 236u8, 136u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " All slashing events on nominators, mapped by era to the highest slash value of the era."] pub async fn nominator_slash_in_era( &self, _0: &::core::primitive::u32, _1: &::subxt::sp_core::crypto::AccountId32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<::core::primitive::u128>, ::subxt::BasicError, > { - let entry = NominatorSlashInEra(_0, _1); - self.client.storage().fetch(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 149u8, 144u8, 51u8, 167u8, 71u8, 119u8, 218u8, 110u8, 25u8, + 45u8, 168u8, 149u8, 62u8, 195u8, 248u8, 50u8, 215u8, 216u8, + 228u8, 4u8, 238u8, 4u8, 52u8, 211u8, 65u8, 223u8, 84u8, + 105u8, 186u8, 200u8, 73u8, 133u8, + ] + { + let entry = NominatorSlashInEra(_0, _1); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " All slashing events on nominators, mapped by era to the highest slash value of the era."] pub async fn nominator_slash_in_era_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, NominatorSlashInEra<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 149u8, 144u8, 51u8, 167u8, 71u8, 119u8, 218u8, 110u8, 25u8, + 45u8, 168u8, 149u8, 62u8, 195u8, 248u8, 50u8, 215u8, 216u8, + 228u8, 4u8, 238u8, 4u8, 52u8, 211u8, 65u8, 223u8, 84u8, + 105u8, 186u8, 200u8, 73u8, 133u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Slashing spans for stash accounts."] pub async fn slashing_spans( &self, _0: &::subxt::sp_core::crypto::AccountId32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::pallet_staking::slashing::SlashingSpans, >, ::subxt::BasicError, > { - let entry = SlashingSpans(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 22u8, 73u8, 200u8, 194u8, 106u8, 157u8, 84u8, 5u8, 119u8, + 5u8, 73u8, 247u8, 125u8, 213u8, 80u8, 37u8, 154u8, 192u8, + 16u8, 2u8, 135u8, 124u8, 139u8, 26u8, 84u8, 223u8, 254u8, + 229u8, 148u8, 45u8, 194u8, 183u8, + ] + { + let entry = SlashingSpans(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Slashing spans for stash accounts."] pub async fn slashing_spans_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, SlashingSpans<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 22u8, 73u8, 200u8, 194u8, 106u8, 157u8, 84u8, 5u8, 119u8, + 5u8, 73u8, 247u8, 125u8, 213u8, 80u8, 37u8, 154u8, 192u8, + 16u8, 2u8, 135u8, 124u8, 139u8, 26u8, 84u8, 223u8, 254u8, + 229u8, 148u8, 45u8, 194u8, 183u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Records information about the maximum slash of a stash within a slashing span,"] #[doc = " as well as how much reward has been paid out."] @@ -5927,48 +8605,104 @@ pub mod api { &self, _0: &::subxt::sp_core::crypto::AccountId32, _1: &::core::primitive::u32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< runtime_types::pallet_staking::slashing::SpanRecord< ::core::primitive::u128, >, ::subxt::BasicError, > { - let entry = SpanSlash(_0, _1); - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 95u8, 42u8, 40u8, 167u8, 201u8, 140u8, 142u8, 55u8, 69u8, + 238u8, 248u8, 118u8, 209u8, 11u8, 117u8, 132u8, 179u8, 33u8, + 17u8, 156u8, 137u8, 220u8, 170u8, 144u8, 235u8, 99u8, 248u8, + 47u8, 99u8, 42u8, 247u8, 189u8, + ] + { + let entry = SpanSlash(_0, _1); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Records information about the maximum slash of a stash within a slashing span,"] #[doc = " as well as how much reward has been paid out."] pub async fn span_slash_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, SpanSlash<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 95u8, 42u8, 40u8, 167u8, 201u8, 140u8, 142u8, 55u8, 69u8, + 238u8, 248u8, 118u8, 209u8, 11u8, 117u8, 132u8, 179u8, 33u8, + 17u8, 156u8, 137u8, 220u8, 170u8, 144u8, 235u8, 99u8, 248u8, + 47u8, 99u8, 42u8, 247u8, 189u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The earliest era for which we have a pending, unapplied slash."] pub async fn earliest_unapplied_slash( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<::core::primitive::u32>, ::subxt::BasicError, > { - let entry = EarliestUnappliedSlash; - self.client.storage().fetch(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 2u8, 167u8, 88u8, 76u8, 113u8, 225u8, 232u8, 80u8, 183u8, + 162u8, 104u8, 28u8, 162u8, 13u8, 120u8, 45u8, 200u8, 130u8, + 147u8, 124u8, 210u8, 111u8, 30u8, 222u8, 70u8, 79u8, 125u8, + 157u8, 56u8, 252u8, 237u8, 216u8, + ] + { + let entry = EarliestUnappliedSlash; + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The last planned session scheduled by the session pallet."] #[doc = ""] #[doc = " This is basically in sync with the call to [`pallet_session::SessionManager::new_session`]."] pub async fn current_planned_session( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let entry = CurrentPlannedSession; - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 38u8, 22u8, 56u8, 250u8, 17u8, 154u8, 99u8, 37u8, 155u8, + 253u8, 100u8, 117u8, 5u8, 239u8, 31u8, 190u8, 53u8, 241u8, + 11u8, 185u8, 163u8, 227u8, 10u8, 77u8, 210u8, 64u8, 156u8, + 218u8, 105u8, 16u8, 1u8, 57u8, + ] + { + let entry = CurrentPlannedSession; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Indices of validators that have offended in the active era and whether they are currently"] #[doc = " disabled."] @@ -5981,13 +8715,30 @@ pub mod api { #[doc = " the era ends."] pub async fn offending_validators( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec<(::core::primitive::u32, ::core::primitive::bool)>, ::subxt::BasicError, > { - let entry = OffendingValidators; - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 94u8, 254u8, 0u8, 50u8, 76u8, 232u8, 51u8, 153u8, 118u8, + 14u8, 70u8, 101u8, 112u8, 215u8, 173u8, 82u8, 182u8, 104u8, + 167u8, 103u8, 187u8, 168u8, 86u8, 16u8, 51u8, 235u8, 51u8, + 119u8, 38u8, 154u8, 42u8, 113u8, + ] + { + let entry = OffendingValidators; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " True if network has been upgraded to this version."] #[doc = " Storage version of the pallet."] @@ -5995,28 +8746,53 @@ pub mod api { #[doc = " This is set to v7.0.0 for new networks."] pub async fn storage_version( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< runtime_types::pallet_staking::Releases, ::subxt::BasicError, > { - let entry = StorageVersion; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 156u8, 107u8, 113u8, 89u8, 107u8, 89u8, 171u8, 229u8, 13u8, + 96u8, 203u8, 67u8, 119u8, 153u8, 199u8, 158u8, 63u8, 114u8, + 229u8, 113u8, 81u8, 70u8, 200u8, 9u8, 147u8, 233u8, 6u8, 7u8, + 210u8, 109u8, 149u8, 14u8, + ] + { + let entry = StorageVersion; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The threshold for when users can start calling `chill_other` for other validators /"] #[doc = " nominators. The threshold is compared to the actual number of validators / nominators"] #[doc = " (`CountFor*`) in the system compared to the configured max (`Max*Count`)."] pub async fn chill_threshold( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::sp_arithmetic::per_things::Percent, >, ::subxt::BasicError, > { - let entry = ChillThreshold; - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 254u8, 131u8, 112u8, 90u8, 234u8, 72u8, 26u8, 240u8, 38u8, + 14u8, 128u8, 234u8, 133u8, 169u8, 66u8, 48u8, 234u8, 170u8, + 159u8, 145u8, 75u8, 135u8, 79u8, 189u8, 54u8, 89u8, 113u8, + 144u8, 16u8, 70u8, 184u8, 43u8, + ] + { + let entry = ChillThreshold; + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -6034,30 +8810,75 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Staking")?; - let constant = pallet.constant("MaxNominations")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Staking", "MaxNominations")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Staking")?; + let constant = pallet.constant("MaxNominations")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Number of sessions per era."] pub fn sessions_per_era( &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Staking")?; - let constant = pallet.constant("SessionsPerEra")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Staking", "SessionsPerEra")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Staking")?; + let constant = pallet.constant("SessionsPerEra")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Number of eras that staked funds must remain bonded for."] pub fn bonding_duration( &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Staking")?; - let constant = pallet.constant("BondingDuration")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Staking", "BondingDuration")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Staking")?; + let constant = pallet.constant("BondingDuration")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Number of eras that slashes are deferred by, after computation."] #[doc = ""] @@ -6067,10 +8888,25 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Staking")?; - let constant = pallet.constant("SlashDeferDuration")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Staking", "SlashDeferDuration")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Staking")?; + let constant = pallet.constant("SlashDeferDuration")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The maximum number of nominators rewarded for each validator."] #[doc = ""] @@ -6080,10 +8916,26 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Staking")?; - let constant = pallet.constant("MaxNominatorRewardedPerValidator")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Staking", "MaxNominatorRewardedPerValidator")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Staking")?; + let constant = + pallet.constant("MaxNominatorRewardedPerValidator")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The maximum number of `unlocking` chunks a [`StakingLedger`] can have. Effectively"] #[doc = " determines how many unique eras a staker may be unbonding in."] @@ -6091,10 +8943,25 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Staking")?; - let constant = pallet.constant("MaxUnlockingChunks")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Staking", "MaxUnlockingChunks")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Staking")?; + let constant = pallet.constant("MaxUnlockingChunks")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -6187,7 +9054,7 @@ pub mod api { pub async fn reports( &self, _0: &::subxt::sp_core::H256, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::sp_staking::offence::OffenceDetails< @@ -6203,41 +9070,94 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = Reports(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 82u8, 209u8, 30u8, 189u8, 152u8, 16u8, 7u8, 24u8, 178u8, + 140u8, 17u8, 226u8, 97u8, 37u8, 80u8, 211u8, 252u8, 36u8, + 196u8, 121u8, 113u8, 79u8, 209u8, 113u8, 236u8, 148u8, 243u8, + 100u8, 46u8, 193u8, 180u8, 83u8, + ] + { + let entry = Reports(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The primary structure that holds all offence records keyed by report identifiers."] pub async fn reports_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Reports<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 82u8, 209u8, 30u8, 189u8, 152u8, 16u8, 7u8, 24u8, 178u8, + 140u8, 17u8, 226u8, 97u8, 37u8, 80u8, 211u8, 252u8, 36u8, + 196u8, 121u8, 113u8, 79u8, 209u8, 113u8, 236u8, 148u8, 243u8, + 100u8, 46u8, 193u8, 180u8, 83u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " A vector of reports of the same kind that happened at the same time slot."] pub async fn concurrent_reports_index( &self, _0: &[::core::primitive::u8; 16usize], _1: &[::core::primitive::u8], - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec<::subxt::sp_core::H256>, ::subxt::BasicError, > { - let entry = ConcurrentReportsIndex(_0, _1); - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 110u8, 42u8, 178u8, 19u8, 180u8, 109u8, 26u8, 134u8, 74u8, + 223u8, 19u8, 172u8, 149u8, 194u8, 228u8, 11u8, 205u8, 189u8, + 157u8, 52u8, 179u8, 177u8, 19u8, 65u8, 35u8, 176u8, 62u8, + 98u8, 108u8, 236u8, 242u8, 240u8, + ] + { + let entry = ConcurrentReportsIndex(_0, _1); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " A vector of reports of the same kind that happened at the same time slot."] pub async fn concurrent_reports_index_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, ConcurrentReportsIndex<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 110u8, 42u8, 178u8, 19u8, 180u8, 109u8, 26u8, 134u8, 74u8, + 223u8, 19u8, 172u8, 149u8, 194u8, 228u8, 11u8, 205u8, 189u8, + 157u8, 52u8, 179u8, 177u8, 19u8, 65u8, 35u8, 176u8, 62u8, + 98u8, 108u8, 236u8, 242u8, 240u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Enumerates all reports of a kind along with the time they happened."] #[doc = ""] @@ -6248,13 +9168,30 @@ pub mod api { pub async fn reports_by_kind_index( &self, _0: &[::core::primitive::u8; 16usize], - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec<::core::primitive::u8>, ::subxt::BasicError, > { - let entry = ReportsByKindIndex(_0); - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 162u8, 66u8, 131u8, 48u8, 250u8, 237u8, 179u8, 214u8, 36u8, + 137u8, 226u8, 136u8, 120u8, 61u8, 215u8, 43u8, 164u8, 50u8, + 91u8, 164u8, 20u8, 96u8, 189u8, 100u8, 242u8, 106u8, 21u8, + 136u8, 98u8, 215u8, 180u8, 145u8, + ] + { + let entry = ReportsByKindIndex(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Enumerates all reports of a kind along with the time they happened."] #[doc = ""] @@ -6264,12 +9201,26 @@ pub mod api { #[doc = " different types are not supported at the moment so we are doing the manual serialization."] pub async fn reports_by_kind_index_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, ReportsByKindIndex<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 162u8, 66u8, 131u8, 48u8, 250u8, 237u8, 179u8, 214u8, 36u8, + 137u8, 226u8, 136u8, 120u8, 61u8, 215u8, 43u8, 164u8, 50u8, + 91u8, 164u8, 20u8, 96u8, 189u8, 100u8, 242u8, 106u8, 21u8, + 136u8, 98u8, 215u8, 180u8, 145u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -6339,16 +9290,30 @@ pub mod api { &self, keys: runtime_types::polkadot_runtime::SessionKeys, proof: ::std::vec::Vec<::core::primitive::u8>, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetKeys, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetKeys, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetKeys { keys, proof }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 194u8, 88u8, 145u8, 74u8, 215u8, 181u8, 126u8, 21u8, 193u8, + 174u8, 42u8, 142u8, 229u8, 213u8, 104u8, 36u8, 134u8, 83u8, + 245u8, 106u8, 9u8, 42u8, 75u8, 206u8, 161u8, 248u8, 232u8, + 31u8, 160u8, 213u8, 70u8, 228u8, + ] + { + let call = SetKeys { keys, proof }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Removes any session key(s) of the function caller."] #[doc = ""] @@ -6368,16 +9333,30 @@ pub mod api { #[doc = "# "] pub fn purge_keys( &self, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - PurgeKeys, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + PurgeKeys, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = PurgeKeys {}; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 200u8, 255u8, 4u8, 213u8, 188u8, 92u8, 99u8, 116u8, 163u8, + 152u8, 29u8, 35u8, 133u8, 119u8, 246u8, 44u8, 91u8, 31u8, + 145u8, 23u8, 213u8, 64u8, 71u8, 242u8, 207u8, 239u8, 231u8, + 37u8, 61u8, 63u8, 190u8, 35u8, + ] + { + let call = PurgeKeys {}; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -6487,38 +9466,80 @@ pub mod api { #[doc = " The current set of validators."] pub async fn validators( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec<::subxt::sp_core::crypto::AccountId32>, ::subxt::BasicError, > { - let entry = Validators; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 186u8, 248u8, 234u8, 74u8, 245u8, 141u8, 90u8, 152u8, 226u8, + 220u8, 255u8, 104u8, 174u8, 1u8, 37u8, 152u8, 23u8, 208u8, + 25u8, 49u8, 33u8, 253u8, 254u8, 251u8, 141u8, 16u8, 18u8, + 175u8, 196u8, 188u8, 163u8, 209u8, + ] + { + let entry = Validators; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Current index of the session."] pub async fn current_index( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let entry = CurrentIndex; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 148u8, 179u8, 159u8, 15u8, 197u8, 95u8, 214u8, 30u8, 209u8, + 251u8, 183u8, 231u8, 91u8, 25u8, 181u8, 191u8, 143u8, 252u8, + 227u8, 80u8, 159u8, 66u8, 194u8, 67u8, 113u8, 74u8, 111u8, + 91u8, 218u8, 187u8, 130u8, 40u8, + ] + { + let entry = CurrentIndex; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " True if the underlying economic identities or weighting behind the validators"] #[doc = " has changed in the queued validator set."] pub async fn queued_changed( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::bool, ::subxt::BasicError> { - let entry = QueuedChanged; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 105u8, 140u8, 235u8, 218u8, 96u8, 100u8, 252u8, 10u8, 58u8, + 221u8, 244u8, 251u8, 67u8, 91u8, 80u8, 202u8, 152u8, 42u8, + 50u8, 113u8, 200u8, 247u8, 59u8, 213u8, 77u8, 195u8, 1u8, + 150u8, 220u8, 18u8, 245u8, 46u8, + ] + { + let entry = QueuedChanged; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The queued keys for the next session. When the next session begins, these keys"] #[doc = " will be used to determine the validator's session keys."] pub async fn queued_keys( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec<( ::subxt::sp_core::crypto::AccountId32, @@ -6526,8 +9547,22 @@ pub mod api { )>, ::subxt::BasicError, > { - let entry = QueuedKeys; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 94u8, 85u8, 104u8, 215u8, 108u8, 102u8, 70u8, 179u8, 201u8, + 132u8, 63u8, 148u8, 29u8, 97u8, 185u8, 117u8, 153u8, 236u8, + 106u8, 21u8, 156u8, 60u8, 178u8, 93u8, 240u8, 144u8, 101u8, + 78u8, 63u8, 247u8, 128u8, 13u8, + ] + { + let entry = QueuedKeys; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Indices of disabled validators."] #[doc = ""] @@ -6536,58 +9571,119 @@ pub mod api { #[doc = " a new set of identities."] pub async fn disabled_validators( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec<::core::primitive::u32>, ::subxt::BasicError, > { - let entry = DisabledValidators; - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 135u8, 22u8, 22u8, 97u8, 82u8, 217u8, 144u8, 141u8, 121u8, + 240u8, 189u8, 16u8, 176u8, 88u8, 177u8, 31u8, 20u8, 242u8, + 73u8, 104u8, 11u8, 110u8, 214u8, 34u8, 52u8, 217u8, 106u8, + 33u8, 174u8, 174u8, 198u8, 84u8, + ] + { + let entry = DisabledValidators; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The next session keys for a validator."] pub async fn next_keys( &self, _0: &::subxt::sp_core::crypto::AccountId32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option, ::subxt::BasicError, > { - let entry = NextKeys(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 18u8, 229u8, 236u8, 115u8, 189u8, 239u8, 3u8, 100u8, 6u8, + 254u8, 237u8, 61u8, 223u8, 21u8, 226u8, 203u8, 214u8, 213u8, + 58u8, 252u8, 168u8, 7u8, 92u8, 5u8, 176u8, 37u8, 43u8, 104u8, + 175u8, 75u8, 42u8, 221u8, + ] + { + let entry = NextKeys(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The next session keys for a validator."] pub async fn next_keys_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, NextKeys<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 18u8, 229u8, 236u8, 115u8, 189u8, 239u8, 3u8, 100u8, 6u8, + 254u8, 237u8, 61u8, 223u8, 21u8, 226u8, 203u8, 214u8, 213u8, + 58u8, 252u8, 168u8, 7u8, 92u8, 5u8, 176u8, 37u8, 43u8, 104u8, + 175u8, 75u8, 42u8, 221u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The owner of a key. The key is the `KeyTypeId` + the encoded key."] pub async fn key_owner( &self, _0: &runtime_types::sp_core::crypto::KeyTypeId, _1: &[::core::primitive::u8], - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<::subxt::sp_core::crypto::AccountId32>, ::subxt::BasicError, > { - let entry = KeyOwner(_0, _1); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 49u8, 245u8, 212u8, 141u8, 211u8, 208u8, 109u8, 102u8, 249u8, + 161u8, 41u8, 93u8, 220u8, 230u8, 14u8, 59u8, 251u8, 176u8, + 33u8, 127u8, 93u8, 149u8, 205u8, 229u8, 113u8, 129u8, 162u8, + 177u8, 155u8, 216u8, 151u8, 57u8, + ] + { + let entry = KeyOwner(_0, _1); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The owner of a key. The key is the `KeyTypeId` + the encoded key."] pub async fn key_owner_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, KeyOwner<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 49u8, 245u8, 212u8, 141u8, 211u8, 208u8, 109u8, 102u8, 249u8, + 161u8, 41u8, 93u8, 220u8, 230u8, 14u8, 59u8, 251u8, 176u8, + 33u8, 127u8, 93u8, 149u8, 205u8, 229u8, 113u8, 129u8, 162u8, + 177u8, 155u8, 216u8, 151u8, 57u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -6663,19 +9759,35 @@ pub mod api { &self, equivocation_proof : runtime_types :: sp_finality_grandpa :: EquivocationProof < :: subxt :: sp_core :: H256 , :: core :: primitive :: u32 >, key_owner_proof: runtime_types::sp_session::MembershipProof, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ReportEquivocation, - DispatchError, - root_mod::Event, - > { - let call = ReportEquivocation { - equivocation_proof: ::std::boxed::Box::new(equivocation_proof), - key_owner_proof, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ReportEquivocation, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 230u8, 252u8, 24u8, 207u8, 164u8, 127u8, 177u8, 30u8, 113u8, + 175u8, 207u8, 252u8, 230u8, 225u8, 181u8, 190u8, 236u8, + 110u8, 145u8, 168u8, 200u8, 134u8, 88u8, 234u8, 231u8, 45u8, + 149u8, 169u8, 155u8, 114u8, 62u8, 65u8, + ] + { + let call = ReportEquivocation { + equivocation_proof: ::std::boxed::Box::new( + equivocation_proof, + ), + key_owner_proof, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Report voter equivocation/misbehavior. This method will verify the"] #[doc = "equivocation proof and validate the given key ownership proof"] @@ -6690,19 +9802,38 @@ pub mod api { &self, equivocation_proof : runtime_types :: sp_finality_grandpa :: EquivocationProof < :: subxt :: sp_core :: H256 , :: core :: primitive :: u32 >, key_owner_proof: runtime_types::sp_session::MembershipProof, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ReportEquivocationUnsigned, - DispatchError, - root_mod::Event, - > { - let call = ReportEquivocationUnsigned { - equivocation_proof: ::std::boxed::Box::new(equivocation_proof), - key_owner_proof, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ReportEquivocationUnsigned, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self + .client + .metadata() + .call_hash::()? + == [ + 141u8, 235u8, 27u8, 135u8, 124u8, 124u8, 234u8, 51u8, 100u8, + 105u8, 188u8, 248u8, 133u8, 10u8, 84u8, 14u8, 40u8, 235u8, + 14u8, 107u8, 63u8, 148u8, 107u8, 172u8, 136u8, 159u8, 86u8, + 23u8, 145u8, 221u8, 93u8, 206u8, + ] + { + let call = ReportEquivocationUnsigned { + equivocation_proof: ::std::boxed::Box::new( + equivocation_proof, + ), + key_owner_proof, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Note that the current authority set of the GRANDPA finality gadget has"] #[doc = "stalled. This will trigger a forced authority set change at the beginning"] @@ -6715,19 +9846,33 @@ pub mod api { &self, delay: ::core::primitive::u32, best_finalized_block_number: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - NoteStalled, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + NoteStalled, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = NoteStalled { - delay, - best_finalized_block_number, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 227u8, 98u8, 249u8, 158u8, 96u8, 124u8, 72u8, 188u8, 27u8, + 215u8, 73u8, 62u8, 103u8, 79u8, 38u8, 48u8, 212u8, 88u8, + 233u8, 187u8, 11u8, 95u8, 39u8, 247u8, 55u8, 184u8, 228u8, + 102u8, 13u8, 251u8, 52u8, 206u8, + ] + { + let call = NoteStalled { + delay, + best_finalized_block_number, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -6833,18 +9978,32 @@ pub mod api { #[doc = " State of the current authority set."] pub async fn state( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< runtime_types::pallet_grandpa::StoredState<::core::primitive::u32>, ::subxt::BasicError, > { - let entry = State; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 159u8, 75u8, 78u8, 23u8, 98u8, 89u8, 239u8, 230u8, 192u8, + 67u8, 139u8, 222u8, 151u8, 237u8, 216u8, 20u8, 235u8, 247u8, + 180u8, 24u8, 64u8, 160u8, 58u8, 15u8, 205u8, 191u8, 120u8, + 68u8, 32u8, 5u8, 161u8, 106u8, + ] + { + let entry = State; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Pending change: (signaled at, scheduled change)."] pub async fn pending_change( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::pallet_grandpa::StoredPendingChange< @@ -6853,24 +10012,46 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = PendingChange; - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 128u8, 176u8, 209u8, 41u8, 231u8, 111u8, 205u8, 198u8, 154u8, + 44u8, 228u8, 231u8, 44u8, 110u8, 74u8, 9u8, 31u8, 86u8, + 128u8, 244u8, 112u8, 21u8, 120u8, 176u8, 50u8, 213u8, 122u8, + 46u8, 85u8, 255u8, 40u8, 173u8, + ] + { + let entry = PendingChange; + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " next block number where we can force a change."] pub async fn next_forced( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<::core::primitive::u32>, ::subxt::BasicError, > { - let entry = NextForced; - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 99u8, 43u8, 245u8, 201u8, 60u8, 9u8, 122u8, 99u8, 188u8, + 29u8, 67u8, 6u8, 193u8, 133u8, 179u8, 67u8, 202u8, 208u8, + 62u8, 179u8, 19u8, 169u8, 196u8, 119u8, 107u8, 75u8, 100u8, + 3u8, 121u8, 18u8, 80u8, 156u8, + ] + { + let entry = NextForced; + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " `true` if we are currently stalled."] pub async fn stalled( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<( ::core::primitive::u32, @@ -6878,18 +10059,43 @@ pub mod api { )>, ::subxt::BasicError, > { - let entry = Stalled; - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 219u8, 8u8, 37u8, 78u8, 150u8, 55u8, 0u8, 57u8, 201u8, 170u8, + 186u8, 189u8, 56u8, 161u8, 44u8, 15u8, 53u8, 178u8, 224u8, + 208u8, 231u8, 109u8, 14u8, 209u8, 57u8, 205u8, 237u8, 153u8, + 231u8, 156u8, 24u8, 185u8, + ] + { + let entry = Stalled; + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The number of changes (both in terms of keys and underlying economic responsibilities)"] #[doc = " in the \"set\" of Grandpa validators from genesis."] pub async fn current_set_id( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u64, ::subxt::BasicError> { - let entry = CurrentSetId; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 129u8, 7u8, 62u8, 101u8, 199u8, 60u8, 56u8, 33u8, 54u8, + 158u8, 20u8, 178u8, 244u8, 145u8, 189u8, 197u8, 157u8, 163u8, + 116u8, 36u8, 105u8, 52u8, 149u8, 244u8, 108u8, 94u8, 109u8, + 111u8, 244u8, 137u8, 7u8, 108u8, + ] + { + let entry = CurrentSetId; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " A mapping from grandpa set ID to the index of the *most recent* session for which its"] #[doc = " members were responsible."] @@ -6898,13 +10104,24 @@ pub mod api { pub async fn set_id_session( &self, _0: &::core::primitive::u64, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<::core::primitive::u32>, ::subxt::BasicError, > { - let entry = SetIdSession(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 91u8, 175u8, 145u8, 127u8, 242u8, 81u8, 13u8, 231u8, 110u8, + 11u8, 166u8, 169u8, 103u8, 146u8, 123u8, 133u8, 157u8, 15u8, + 33u8, 234u8, 108u8, 13u8, 88u8, 115u8, 254u8, 9u8, 145u8, + 199u8, 102u8, 47u8, 53u8, 134u8, + ] + { + let entry = SetIdSession(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " A mapping from grandpa set ID to the index of the *most recent* session for which its"] #[doc = " members were responsible."] @@ -6912,12 +10129,23 @@ pub mod api { #[doc = " TWOX-NOTE: `SetId` is not under user control."] pub async fn set_id_session_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, SetIdSession<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 91u8, 175u8, 145u8, 127u8, 242u8, 81u8, 13u8, 231u8, 110u8, + 11u8, 166u8, 169u8, 103u8, 146u8, 123u8, 133u8, 157u8, 15u8, + 33u8, 234u8, 108u8, 13u8, 88u8, 115u8, 254u8, 9u8, 145u8, + 199u8, 102u8, 47u8, 53u8, 134u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -6935,10 +10163,25 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Grandpa")?; - let constant = pallet.constant("MaxAuthorities")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Grandpa", "MaxAuthorities")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Grandpa")?; + let constant = pallet.constant("MaxAuthorities")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -6995,19 +10238,33 @@ pub mod api { ::core::primitive::u32, >, signature : runtime_types :: pallet_im_online :: sr25519 :: app_sr25519 :: Signature, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Heartbeat, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Heartbeat, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = Heartbeat { - heartbeat, - signature, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 246u8, 83u8, 28u8, 233u8, 69u8, 55u8, 28u8, 178u8, 82u8, + 159u8, 56u8, 241u8, 111u8, 78u8, 194u8, 15u8, 14u8, 250u8, + 172u8, 148u8, 208u8, 52u8, 33u8, 106u8, 159u8, 210u8, 196u8, + 79u8, 138u8, 194u8, 150u8, 201u8, + ] + { + let call = Heartbeat { + heartbeat, + signature, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -7131,15 +10388,43 @@ pub mod api { #[doc = " more accurate then the value we calculate for `HeartbeatAfter`."] pub async fn heartbeat_after( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let entry = HeartbeatAfter; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 108u8, 100u8, 85u8, 198u8, 226u8, 122u8, 94u8, 225u8, 97u8, + 154u8, 135u8, 95u8, 106u8, 28u8, 185u8, 78u8, 192u8, 196u8, + 35u8, 191u8, 12u8, 19u8, 163u8, 46u8, 232u8, 235u8, 193u8, + 81u8, 126u8, 204u8, 25u8, 228u8, + ] + { + let entry = HeartbeatAfter; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } - #[doc = " The current set of keys that may issue a heartbeat."] pub async fn keys (& self , hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < runtime_types :: frame_support :: storage :: weak_bounded_vec :: WeakBoundedVec < runtime_types :: pallet_im_online :: sr25519 :: app_sr25519 :: Public > , :: subxt :: BasicError >{ - let entry = Keys; - self.client.storage().fetch_or_default(&entry, hash).await + #[doc = " The current set of keys that may issue a heartbeat."] pub async fn keys (& self , block_hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < runtime_types :: frame_support :: storage :: weak_bounded_vec :: WeakBoundedVec < runtime_types :: pallet_im_online :: sr25519 :: app_sr25519 :: Public > , :: subxt :: BasicError >{ + if self.client.metadata().storage_hash::()? + == [ + 105u8, 250u8, 99u8, 106u8, 9u8, 29u8, 73u8, 176u8, 158u8, + 247u8, 28u8, 171u8, 95u8, 1u8, 109u8, 11u8, 231u8, 52u8, + 54u8, 102u8, 142u8, 105u8, 209u8, 31u8, 132u8, 60u8, 89u8, + 181u8, 89u8, 193u8, 241u8, 130u8, + ] + { + let entry = Keys; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " For each session index, we keep a mapping of `SessionIndex` and `AuthIndex` to"] #[doc = " `WrapperOpaque`."] @@ -7147,7 +10432,7 @@ pub mod api { &self, _0: &::core::primitive::u32, _1: &::core::primitive::u32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::frame_support::traits::misc::WrapperOpaque< @@ -7156,19 +10441,47 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = ReceivedHeartbeats(_0, _1); - self.client.storage().fetch(&entry, hash).await - } + if self + .client + .metadata() + .storage_hash::()? + == [ + 29u8, 40u8, 67u8, 222u8, 59u8, 104u8, 24u8, 193u8, 249u8, + 200u8, 152u8, 225u8, 72u8, 243u8, 140u8, 114u8, 121u8, 216u8, + 54u8, 145u8, 205u8, 82u8, 133u8, 128u8, 109u8, 54u8, 153u8, + 118u8, 66u8, 147u8, 251u8, 148u8, + ] + { + let entry = ReceivedHeartbeats(_0, _1); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } + } #[doc = " For each session index, we keep a mapping of `SessionIndex` and `AuthIndex` to"] #[doc = " `WrapperOpaque`."] pub async fn received_heartbeats_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, ReceivedHeartbeats<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 29u8, 40u8, 67u8, 222u8, 59u8, 104u8, 24u8, 193u8, 249u8, + 200u8, 152u8, 225u8, 72u8, 243u8, 140u8, 114u8, 121u8, 216u8, + 54u8, 145u8, 205u8, 82u8, 133u8, 128u8, 109u8, 54u8, 153u8, + 118u8, 66u8, 147u8, 251u8, 148u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " For each session index, we keep a mapping of `ValidatorId` to the"] #[doc = " number of blocks authored by the given authority."] @@ -7176,22 +10489,47 @@ pub mod api { &self, _0: &::core::primitive::u32, _1: &::subxt::sp_core::crypto::AccountId32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let entry = AuthoredBlocks(_0, _1); - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 94u8, 193u8, 107u8, 126u8, 3u8, 13u8, 28u8, 151u8, 197u8, + 226u8, 224u8, 48u8, 138u8, 113u8, 31u8, 57u8, 111u8, 184u8, + 218u8, 215u8, 185u8, 83u8, 209u8, 139u8, 114u8, 241u8, 68u8, + 110u8, 157u8, 208u8, 16u8, 22u8, + ] + { + let entry = AuthoredBlocks(_0, _1); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " For each session index, we keep a mapping of `ValidatorId` to the"] #[doc = " number of blocks authored by the given authority."] pub async fn authored_blocks_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, AuthoredBlocks<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 94u8, 193u8, 107u8, 126u8, 3u8, 13u8, 28u8, 151u8, 197u8, + 226u8, 224u8, 48u8, 138u8, 113u8, 31u8, 57u8, 111u8, 184u8, + 218u8, 215u8, 185u8, 83u8, 209u8, 139u8, 114u8, 241u8, 68u8, + 110u8, 157u8, 208u8, 16u8, 22u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -7212,10 +10550,25 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u64, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("ImOnline")?; - let constant = pallet.constant("UnsignedPriority")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("ImOnline", "UnsignedPriority")? + == [ + 128u8, 214u8, 205u8, 242u8, 181u8, 142u8, 124u8, 231u8, + 190u8, 146u8, 59u8, 226u8, 157u8, 101u8, 103u8, 117u8, 249u8, + 65u8, 18u8, 191u8, 103u8, 119u8, 53u8, 85u8, 81u8, 96u8, + 220u8, 42u8, 184u8, 239u8, 42u8, 246u8, + ] + { + let pallet = self.client.metadata().pallet("ImOnline")?; + let constant = pallet.constant("UnsignedPriority")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -7498,19 +10851,33 @@ pub mod api { &self, proposal_hash: ::subxt::sp_core::H256, value: ::core::primitive::u128, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Propose, - DispatchError, - root_mod::Event, - > { - let call = Propose { - proposal_hash, - value, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Propose, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 149u8, 60u8, 16u8, 143u8, 114u8, 16u8, 124u8, 96u8, 97u8, + 5u8, 176u8, 137u8, 188u8, 164u8, 65u8, 145u8, 142u8, 104u8, + 74u8, 120u8, 248u8, 90u8, 109u8, 112u8, 29u8, 226u8, 208u8, + 230u8, 101u8, 8u8, 79u8, 12u8, + ] + { + let call = Propose { + proposal_hash, + value, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Signals agreement with a particular proposal."] #[doc = ""] @@ -7526,19 +10893,33 @@ pub mod api { &self, proposal: ::core::primitive::u32, seconds_upper_bound: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Second, - DispatchError, - root_mod::Event, - > { - let call = Second { - proposal, - seconds_upper_bound, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Second, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 37u8, 226u8, 138u8, 26u8, 138u8, 46u8, 39u8, 147u8, 22u8, + 32u8, 245u8, 40u8, 49u8, 228u8, 218u8, 225u8, 72u8, 89u8, + 37u8, 90u8, 132u8, 31u8, 52u8, 22u8, 234u8, 124u8, 254u8, + 223u8, 56u8, 215u8, 255u8, 79u8, + ] + { + let call = Second { + proposal, + seconds_upper_bound, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Vote in a referendum. If `vote.is_aye()`, the vote is to enact the proposal;"] #[doc = "otherwise it is a vote to keep the status quo."] @@ -7555,16 +10936,30 @@ pub mod api { vote: runtime_types::pallet_democracy::vote::AccountVote< ::core::primitive::u128, >, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Vote, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Vote, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = Vote { ref_index, vote }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 1u8, 235u8, 77u8, 58u8, 54u8, 224u8, 30u8, 168u8, 150u8, + 169u8, 20u8, 172u8, 137u8, 191u8, 189u8, 184u8, 28u8, 118u8, + 204u8, 233u8, 146u8, 212u8, 45u8, 139u8, 58u8, 175u8, 231u8, + 169u8, 43u8, 164u8, 149u8, 16u8, + ] + { + let call = Vote { ref_index, vote }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Schedule an emergency cancellation of a referendum. Cannot happen twice to the same"] #[doc = "referendum."] @@ -7577,16 +10972,30 @@ pub mod api { pub fn emergency_cancel( &self, ref_index: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - EmergencyCancel, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + EmergencyCancel, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = EmergencyCancel { ref_index }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 4u8, 129u8, 205u8, 102u8, 202u8, 197u8, 75u8, 155u8, 24u8, + 125u8, 157u8, 73u8, 50u8, 243u8, 173u8, 103u8, 49u8, 60u8, + 50u8, 63u8, 54u8, 40u8, 34u8, 227u8, 29u8, 247u8, 179u8, + 102u8, 107u8, 177u8, 117u8, 161u8, + ] + { + let call = EmergencyCancel { ref_index }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Schedule a referendum to be tabled once it is legal to schedule an external"] #[doc = "referendum."] @@ -7600,16 +11009,30 @@ pub mod api { pub fn external_propose( &self, proposal_hash: ::subxt::sp_core::H256, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ExternalPropose, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ExternalPropose, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ExternalPropose { proposal_hash }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 50u8, 82u8, 155u8, 206u8, 57u8, 61u8, 64u8, 43u8, 30u8, 71u8, + 89u8, 91u8, 221u8, 46u8, 15u8, 222u8, 15u8, 211u8, 56u8, + 176u8, 84u8, 225u8, 192u8, 92u8, 253u8, 56u8, 207u8, 29u8, + 252u8, 77u8, 245u8, 113u8, + ] + { + let call = ExternalPropose { proposal_hash }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Schedule a majority-carries referendum to be tabled next once it is legal to schedule"] #[doc = "an external referendum."] @@ -7625,16 +11048,33 @@ pub mod api { pub fn external_propose_majority( &self, proposal_hash: ::subxt::sp_core::H256, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ExternalProposeMajority, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ExternalProposeMajority, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ExternalProposeMajority { proposal_hash }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 18u8, 92u8, 204u8, 120u8, 189u8, 60u8, 223u8, 166u8, 213u8, + 49u8, 20u8, 131u8, 202u8, 1u8, 87u8, 226u8, 168u8, 156u8, + 144u8, 110u8, 118u8, 125u8, 81u8, 111u8, 229u8, 244u8, 89u8, + 93u8, 202u8, 140u8, 16u8, 220u8, + ] + { + let call = ExternalProposeMajority { proposal_hash }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Schedule a negative-turnout-bias referendum to be tabled next once it is legal to"] #[doc = "schedule an external referendum."] @@ -7650,16 +11090,33 @@ pub mod api { pub fn external_propose_default( &self, proposal_hash: ::subxt::sp_core::H256, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ExternalProposeDefault, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ExternalProposeDefault, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ExternalProposeDefault { proposal_hash }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 51u8, 75u8, 236u8, 51u8, 53u8, 39u8, 26u8, 231u8, 212u8, + 191u8, 175u8, 233u8, 181u8, 156u8, 210u8, 221u8, 181u8, + 182u8, 113u8, 69u8, 171u8, 70u8, 219u8, 133u8, 88u8, 78u8, + 87u8, 228u8, 177u8, 53u8, 111u8, 115u8, + ] + { + let call = ExternalProposeDefault { proposal_hash }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Schedule the currently externally-proposed majority-carries referendum to be tabled"] #[doc = "immediately. If there is no externally-proposed referendum currently, or if there is one"] @@ -7681,20 +11138,34 @@ pub mod api { proposal_hash: ::subxt::sp_core::H256, voting_period: ::core::primitive::u32, delay: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - FastTrack, - DispatchError, - root_mod::Event, - > { - let call = FastTrack { - proposal_hash, - voting_period, - delay, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + FastTrack, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 232u8, 255u8, 150u8, 13u8, 151u8, 28u8, 253u8, 37u8, 183u8, + 127u8, 53u8, 228u8, 160u8, 11u8, 223u8, 48u8, 74u8, 5u8, + 37u8, 3u8, 84u8, 224u8, 79u8, 172u8, 120u8, 220u8, 158u8, + 191u8, 127u8, 55u8, 126u8, 135u8, + ] + { + let call = FastTrack { + proposal_hash, + voting_period, + delay, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Veto and blacklist the external proposal hash."] #[doc = ""] @@ -7708,16 +11179,30 @@ pub mod api { pub fn veto_external( &self, proposal_hash: ::subxt::sp_core::H256, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - VetoExternal, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + VetoExternal, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = VetoExternal { proposal_hash }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 230u8, 207u8, 43u8, 137u8, 173u8, 97u8, 143u8, 183u8, 193u8, + 78u8, 252u8, 104u8, 237u8, 32u8, 151u8, 164u8, 91u8, 247u8, + 233u8, 36u8, 198u8, 88u8, 63u8, 176u8, 77u8, 87u8, 26u8, + 242u8, 211u8, 47u8, 193u8, 180u8, + ] + { + let call = VetoExternal { proposal_hash }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Remove a referendum."] #[doc = ""] @@ -7729,16 +11214,30 @@ pub mod api { pub fn cancel_referendum( &self, ref_index: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - CancelReferendum, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + CancelReferendum, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = CancelReferendum { ref_index }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 107u8, 144u8, 114u8, 224u8, 39u8, 217u8, 156u8, 202u8, 62u8, + 4u8, 196u8, 63u8, 145u8, 196u8, 107u8, 241u8, 3u8, 61u8, + 202u8, 20u8, 123u8, 158u8, 153u8, 45u8, 192u8, 192u8, 244u8, + 42u8, 224u8, 23u8, 243u8, 225u8, + ] + { + let call = CancelReferendum { ref_index }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Cancel a proposal queued for enactment."] #[doc = ""] @@ -7750,16 +11249,30 @@ pub mod api { pub fn cancel_queued( &self, which: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - CancelQueued, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + CancelQueued, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = CancelQueued { which }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 130u8, 218u8, 212u8, 143u8, 89u8, 134u8, 207u8, 161u8, 165u8, + 202u8, 237u8, 237u8, 81u8, 125u8, 165u8, 147u8, 222u8, 198u8, + 236u8, 1u8, 223u8, 74u8, 200u8, 6u8, 208u8, 128u8, 215u8, + 50u8, 46u8, 117u8, 16u8, 143u8, + ] + { + let call = CancelQueued { which }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Delegate the voting power (with some given conviction) of the sending account."] #[doc = ""] @@ -7786,20 +11299,34 @@ pub mod api { to: ::subxt::sp_core::crypto::AccountId32, conviction: runtime_types::pallet_democracy::conviction::Conviction, balance: ::core::primitive::u128, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Delegate, - DispatchError, - root_mod::Event, - > { - let call = Delegate { - to, - conviction, - balance, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Delegate, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 33u8, 155u8, 180u8, 53u8, 39u8, 251u8, 59u8, 100u8, 16u8, + 124u8, 209u8, 40u8, 42u8, 152u8, 3u8, 109u8, 97u8, 211u8, + 129u8, 151u8, 82u8, 45u8, 16u8, 98u8, 114u8, 250u8, 145u8, + 176u8, 244u8, 39u8, 64u8, 11u8, + ] + { + let call = Delegate { + to, + conviction, + balance, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Undelegate the voting power of the sending account."] #[doc = ""] @@ -7815,16 +11342,30 @@ pub mod api { #[doc = " voted on. Weight is charged as if maximum votes."] pub fn undelegate( &self, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Undelegate, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Undelegate, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = Undelegate {}; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 165u8, 40u8, 183u8, 209u8, 57u8, 153u8, 111u8, 29u8, 114u8, + 109u8, 107u8, 235u8, 97u8, 61u8, 53u8, 155u8, 44u8, 245u8, + 28u8, 220u8, 56u8, 134u8, 43u8, 122u8, 248u8, 156u8, 191u8, + 154u8, 4u8, 121u8, 152u8, 153u8, + ] + { + let call = Undelegate {}; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Clears all public proposals."] #[doc = ""] @@ -7833,16 +11374,30 @@ pub mod api { #[doc = "Weight: `O(1)`."] pub fn clear_public_proposals( &self, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ClearPublicProposals, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ClearPublicProposals, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ClearPublicProposals {}; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 59u8, 126u8, 254u8, 223u8, 252u8, 225u8, 75u8, 185u8, 188u8, + 181u8, 42u8, 179u8, 211u8, 73u8, 12u8, 141u8, 243u8, 197u8, + 46u8, 130u8, 215u8, 196u8, 225u8, 88u8, 48u8, 199u8, 231u8, + 249u8, 195u8, 53u8, 184u8, 204u8, + ] + { + let call = ClearPublicProposals {}; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Register the preimage for an upcoming proposal. This doesn't require the proposal to be"] #[doc = "in the dispatch queue but does require a deposit, returned once enacted."] @@ -7857,31 +11412,62 @@ pub mod api { pub fn note_preimage( &self, encoded_proposal: ::std::vec::Vec<::core::primitive::u8>, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - NotePreimage, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + NotePreimage, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = NotePreimage { encoded_proposal }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 121u8, 179u8, 204u8, 32u8, 104u8, 133u8, 99u8, 153u8, 226u8, + 190u8, 89u8, 121u8, 232u8, 154u8, 89u8, 133u8, 124u8, 222u8, + 237u8, 39u8, 50u8, 128u8, 80u8, 115u8, 186u8, 180u8, 151u8, + 139u8, 73u8, 112u8, 148u8, 232u8, + ] + { + let call = NotePreimage { encoded_proposal }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Same as `note_preimage` but origin is `OperationalPreimageOrigin`."] pub fn note_preimage_operational( &self, encoded_proposal: ::std::vec::Vec<::core::primitive::u8>, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - NotePreimageOperational, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + NotePreimageOperational, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = NotePreimageOperational { encoded_proposal }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 102u8, 20u8, 213u8, 32u8, 64u8, 28u8, 150u8, 241u8, 173u8, + 182u8, 201u8, 70u8, 52u8, 211u8, 95u8, 211u8, 127u8, 12u8, + 249u8, 57u8, 128u8, 64u8, 185u8, 239u8, 255u8, 191u8, 203u8, + 222u8, 123u8, 187u8, 106u8, 12u8, + ] + { + let call = NotePreimageOperational { encoded_proposal }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Register the preimage for an upcoming proposal. This requires the proposal to be"] #[doc = "in the dispatch queue. No deposit is needed. When this call is successful, i.e."] @@ -7898,31 +11484,62 @@ pub mod api { pub fn note_imminent_preimage( &self, encoded_proposal: ::std::vec::Vec<::core::primitive::u8>, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - NoteImminentPreimage, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + NoteImminentPreimage, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = NoteImminentPreimage { encoded_proposal }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 240u8, 77u8, 42u8, 178u8, 110u8, 117u8, 152u8, 158u8, 64u8, + 26u8, 49u8, 37u8, 177u8, 178u8, 203u8, 227u8, 23u8, 251u8, + 242u8, 112u8, 184u8, 234u8, 95u8, 73u8, 86u8, 37u8, 148u8, + 150u8, 6u8, 50u8, 239u8, 64u8, + ] + { + let call = NoteImminentPreimage { encoded_proposal }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Same as `note_imminent_preimage` but origin is `OperationalPreimageOrigin`."] pub fn note_imminent_preimage_operational( &self, encoded_proposal: ::std::vec::Vec<::core::primitive::u8>, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - NoteImminentPreimageOperational, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + NoteImminentPreimageOperational, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = NoteImminentPreimageOperational { encoded_proposal }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 119u8, 17u8, 140u8, 81u8, 7u8, 103u8, 162u8, 112u8, 160u8, + 179u8, 116u8, 34u8, 126u8, 150u8, 64u8, 117u8, 93u8, 225u8, + 197u8, 40u8, 62u8, 238u8, 174u8, 63u8, 148u8, 248u8, 214u8, + 212u8, 228u8, 86u8, 87u8, 195u8, + ] + { + let call = NoteImminentPreimageOperational { encoded_proposal }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Remove an expired proposal preimage and collect the deposit."] #[doc = ""] @@ -7943,19 +11560,33 @@ pub mod api { &self, proposal_hash: ::subxt::sp_core::H256, proposal_len_upper_bound: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ReapPreimage, - DispatchError, - root_mod::Event, - > { - let call = ReapPreimage { - proposal_hash, - proposal_len_upper_bound, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ReapPreimage, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 45u8, 191u8, 46u8, 19u8, 87u8, 216u8, 48u8, 29u8, 124u8, + 205u8, 39u8, 178u8, 158u8, 95u8, 163u8, 116u8, 232u8, 58u8, + 6u8, 242u8, 52u8, 215u8, 251u8, 49u8, 1u8, 234u8, 99u8, + 142u8, 76u8, 182u8, 134u8, 173u8, + ] + { + let call = ReapPreimage { + proposal_hash, + proposal_len_upper_bound, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Unlock tokens that have an expired lock."] #[doc = ""] @@ -7967,16 +11598,30 @@ pub mod api { pub fn unlock( &self, target: ::subxt::sp_core::crypto::AccountId32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Unlock, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Unlock, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = Unlock { target }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 106u8, 17u8, 189u8, 71u8, 208u8, 26u8, 49u8, 71u8, 162u8, + 196u8, 126u8, 192u8, 242u8, 239u8, 77u8, 196u8, 62u8, 171u8, + 58u8, 176u8, 157u8, 81u8, 65u8, 246u8, 210u8, 43u8, 1u8, + 226u8, 143u8, 149u8, 210u8, 192u8, + ] + { + let call = Unlock { target }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Remove a vote for a referendum."] #[doc = ""] @@ -8008,16 +11653,30 @@ pub mod api { pub fn remove_vote( &self, index: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - RemoveVote, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + RemoveVote, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = RemoveVote { index }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 33u8, 72u8, 14u8, 166u8, 152u8, 18u8, 232u8, 153u8, 163u8, + 96u8, 146u8, 180u8, 98u8, 155u8, 119u8, 75u8, 247u8, 175u8, + 246u8, 183u8, 182u8, 108u8, 250u8, 80u8, 148u8, 86u8, 255u8, + 59u8, 93u8, 197u8, 209u8, 226u8, + ] + { + let call = RemoveVote { index }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Remove a vote for a referendum."] #[doc = ""] @@ -8038,35 +11697,63 @@ pub mod api { &self, target: ::subxt::sp_core::crypto::AccountId32, index: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - RemoveOtherVote, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + RemoveOtherVote, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = RemoveOtherVote { target, index }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 43u8, 194u8, 32u8, 219u8, 87u8, 143u8, 240u8, 34u8, 236u8, + 232u8, 128u8, 7u8, 99u8, 113u8, 106u8, 124u8, 92u8, 115u8, + 75u8, 228u8, 39u8, 234u8, 192u8, 134u8, 69u8, 109u8, 119u8, + 133u8, 194u8, 110u8, 167u8, 244u8, + ] + { + let call = RemoveOtherVote { target, index }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Enact a proposal from a referendum. For now we just make the weight be the maximum."] pub fn enact_proposal( &self, proposal_hash: ::subxt::sp_core::H256, index: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - EnactProposal, - DispatchError, - root_mod::Event, - > { - let call = EnactProposal { - proposal_hash, - index, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + EnactProposal, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 246u8, 188u8, 9u8, 244u8, 56u8, 81u8, 201u8, 59u8, 212u8, + 11u8, 204u8, 7u8, 173u8, 7u8, 212u8, 34u8, 173u8, 248u8, + 83u8, 225u8, 209u8, 105u8, 249u8, 167u8, 243u8, 49u8, 119u8, + 167u8, 28u8, 31u8, 60u8, 75u8, + ] + { + let call = EnactProposal { + proposal_hash, + index, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Permanently place a proposal into the blacklist. This prevents it from ever being"] #[doc = "proposed again."] @@ -8087,19 +11774,33 @@ pub mod api { &self, proposal_hash: ::subxt::sp_core::H256, maybe_ref_index: ::core::option::Option<::core::primitive::u32>, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Blacklist, - DispatchError, - root_mod::Event, - > { - let call = Blacklist { - proposal_hash, - maybe_ref_index, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Blacklist, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 105u8, 99u8, 153u8, 150u8, 122u8, 234u8, 105u8, 238u8, 152u8, + 152u8, 121u8, 181u8, 133u8, 246u8, 159u8, 35u8, 8u8, 65u8, + 15u8, 203u8, 206u8, 75u8, 28u8, 214u8, 111u8, 26u8, 40u8, + 141u8, 68u8, 57u8, 217u8, 244u8, + ] + { + let call = Blacklist { + proposal_hash, + maybe_ref_index, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Remove a proposal."] #[doc = ""] @@ -8111,16 +11812,30 @@ pub mod api { pub fn cancel_proposal( &self, prop_index: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - CancelProposal, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + CancelProposal, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = CancelProposal { prop_index }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 26u8, 117u8, 180u8, 24u8, 12u8, 177u8, 77u8, 254u8, 113u8, + 53u8, 146u8, 48u8, 164u8, 255u8, 45u8, 205u8, 207u8, 46u8, + 74u8, 184u8, 73u8, 95u8, 216u8, 190u8, 240u8, 64u8, 121u8, + 104u8, 147u8, 141u8, 128u8, 82u8, + ] + { + let call = CancelProposal { prop_index }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -8508,16 +12223,30 @@ pub mod api { #[doc = " The number of (public) proposals that have been made so far."] pub async fn public_prop_count( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let entry = PublicPropCount; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 91u8, 14u8, 171u8, 94u8, 37u8, 157u8, 46u8, 157u8, 254u8, + 13u8, 68u8, 144u8, 23u8, 146u8, 128u8, 159u8, 9u8, 174u8, + 74u8, 174u8, 218u8, 197u8, 23u8, 235u8, 152u8, 226u8, 216u8, + 4u8, 120u8, 121u8, 27u8, 138u8, + ] + { + let entry = PublicPropCount; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The public proposals. Unsorted. The second item is the proposal's hash."] pub async fn public_props( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec<( ::core::primitive::u32, @@ -8526,8 +12255,22 @@ pub mod api { )>, ::subxt::BasicError, > { - let entry = PublicProps; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 78u8, 208u8, 211u8, 20u8, 85u8, 237u8, 161u8, 149u8, 99u8, + 158u8, 6u8, 54u8, 204u8, 228u8, 132u8, 10u8, 75u8, 247u8, + 148u8, 155u8, 101u8, 183u8, 58u8, 169u8, 21u8, 172u8, 10u8, + 110u8, 130u8, 74u8, 88u8, 52u8, + ] + { + let entry = PublicProps; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Those who have locked a deposit."] #[doc = ""] @@ -8535,7 +12278,7 @@ pub mod api { pub async fn deposit_of( &self, _0: &::core::primitive::u32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<( ::std::vec::Vec<::subxt::sp_core::crypto::AccountId32>, @@ -8543,27 +12286,49 @@ pub mod api { )>, ::subxt::BasicError, > { - let entry = DepositOf(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 116u8, 57u8, 200u8, 96u8, 150u8, 62u8, 162u8, 169u8, 28u8, + 18u8, 134u8, 161u8, 210u8, 217u8, 80u8, 225u8, 22u8, 185u8, + 177u8, 166u8, 243u8, 232u8, 193u8, 64u8, 170u8, 89u8, 216u8, + 198u8, 43u8, 102u8, 178u8, 55u8, + ] + { + let entry = DepositOf(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Those who have locked a deposit."] #[doc = ""] #[doc = " TWOX-NOTE: Safe, as increasing integer keys are safe."] pub async fn deposit_of_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, DepositOf<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 116u8, 57u8, 200u8, 96u8, 150u8, 62u8, 162u8, 169u8, 28u8, + 18u8, 134u8, 161u8, 210u8, 217u8, 80u8, 225u8, 22u8, 185u8, + 177u8, 166u8, 243u8, 232u8, 193u8, 64u8, 170u8, 89u8, 216u8, + 198u8, 43u8, 102u8, 178u8, 55u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Map of hashes to the proposal preimage, along with who registered it and their deposit."] #[doc = " The block number is the block at which it was deposited."] pub async fn preimages( &self, _0: &::subxt::sp_core::H256, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::pallet_democracy::PreimageStatus< @@ -8574,38 +12339,88 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = Preimages(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 20u8, 82u8, 223u8, 51u8, 178u8, 115u8, 71u8, 83u8, 23u8, + 15u8, 85u8, 66u8, 0u8, 69u8, 68u8, 20u8, 28u8, 159u8, 74u8, + 41u8, 225u8, 145u8, 247u8, 23u8, 36u8, 155u8, 101u8, 229u8, + 27u8, 24u8, 93u8, 215u8, + ] + { + let entry = Preimages(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Map of hashes to the proposal preimage, along with who registered it and their deposit."] #[doc = " The block number is the block at which it was deposited."] pub async fn preimages_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Preimages<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 20u8, 82u8, 223u8, 51u8, 178u8, 115u8, 71u8, 83u8, 23u8, + 15u8, 85u8, 66u8, 0u8, 69u8, 68u8, 20u8, 28u8, 159u8, 74u8, + 41u8, 225u8, 145u8, 247u8, 23u8, 36u8, 155u8, 101u8, 229u8, + 27u8, 24u8, 93u8, 215u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The next free referendum index, aka the number of referenda started so far."] pub async fn referendum_count( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let entry = ReferendumCount; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 153u8, 210u8, 106u8, 244u8, 156u8, 70u8, 124u8, 251u8, 123u8, + 75u8, 7u8, 189u8, 199u8, 145u8, 95u8, 119u8, 137u8, 11u8, + 240u8, 160u8, 151u8, 248u8, 229u8, 231u8, 89u8, 222u8, 18u8, + 237u8, 144u8, 78u8, 99u8, 58u8, + ] + { + let entry = ReferendumCount; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The lowest referendum index representing an unbaked referendum. Equal to"] #[doc = " `ReferendumCount` if there isn't a unbaked referendum."] pub async fn lowest_unbaked( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let entry = LowestUnbaked; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 4u8, 51u8, 108u8, 11u8, 48u8, 165u8, 19u8, 251u8, 182u8, + 76u8, 163u8, 73u8, 227u8, 2u8, 212u8, 74u8, 128u8, 27u8, + 165u8, 164u8, 111u8, 22u8, 209u8, 190u8, 103u8, 7u8, 116u8, + 16u8, 160u8, 144u8, 123u8, 64u8, + ] + { + let entry = LowestUnbaked; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Information concerning any given referendum."] #[doc = ""] @@ -8613,7 +12428,7 @@ pub mod api { pub async fn referendum_info_of( &self, _0: &::core::primitive::u32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::pallet_democracy::types::ReferendumInfo< @@ -8624,20 +12439,42 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = ReferendumInfoOf(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 112u8, 206u8, 173u8, 93u8, 255u8, 76u8, 85u8, 122u8, 24u8, + 97u8, 177u8, 67u8, 44u8, 143u8, 53u8, 159u8, 206u8, 135u8, + 63u8, 74u8, 230u8, 47u8, 27u8, 224u8, 138u8, 217u8, 194u8, + 229u8, 148u8, 249u8, 230u8, 114u8, + ] + { + let entry = ReferendumInfoOf(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Information concerning any given referendum."] #[doc = ""] #[doc = " TWOX-NOTE: SAFE as indexes are not under an attacker’s control."] pub async fn referendum_info_of_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, ReferendumInfoOf<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 112u8, 206u8, 173u8, 93u8, 255u8, 76u8, 85u8, 122u8, 24u8, + 97u8, 177u8, 67u8, 44u8, 143u8, 53u8, 159u8, 206u8, 135u8, + 63u8, 74u8, 230u8, 47u8, 27u8, 224u8, 138u8, 217u8, 194u8, + 229u8, 148u8, 249u8, 230u8, 114u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " All votes for a particular voter. We store the balance for the number of votes that we"] #[doc = " have recorded. The second item is the total amount of delegations, that will be added."] @@ -8646,7 +12483,7 @@ pub mod api { pub async fn voting_of( &self, _0: &::subxt::sp_core::crypto::AccountId32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< runtime_types::pallet_democracy::vote::Voting< ::core::primitive::u128, @@ -8655,8 +12492,22 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = VotingOf(_0); - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 194u8, 13u8, 151u8, 207u8, 194u8, 79u8, 233u8, 214u8, 193u8, + 52u8, 78u8, 62u8, 71u8, 35u8, 139u8, 11u8, 41u8, 163u8, + 143u8, 156u8, 236u8, 207u8, 132u8, 138u8, 2u8, 176u8, 56u8, + 224u8, 67u8, 39u8, 190u8, 13u8, + ] + { + let entry = VotingOf(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " All votes for a particular voter. We store the balance for the number of votes that we"] #[doc = " have recorded. The second item is the total amount of delegations, that will be added."] @@ -8664,22 +12515,50 @@ pub mod api { #[doc = " TWOX-NOTE: SAFE as `AccountId`s are crypto hashes anyway."] pub async fn voting_of_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, VotingOf<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 194u8, 13u8, 151u8, 207u8, 194u8, 79u8, 233u8, 214u8, 193u8, + 52u8, 78u8, 62u8, 71u8, 35u8, 139u8, 11u8, 41u8, 163u8, + 143u8, 156u8, 236u8, 207u8, 132u8, 138u8, 2u8, 176u8, 56u8, + 224u8, 67u8, 39u8, 190u8, 13u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " True if the last referendum tabled was submitted externally. False if it was a public"] #[doc = " proposal."] pub async fn last_tabled_was_external( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::bool, ::subxt::BasicError> { - let entry = LastTabledWasExternal; - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 3u8, 67u8, 106u8, 1u8, 89u8, 204u8, 4u8, 145u8, 121u8, 44u8, + 34u8, 76u8, 18u8, 206u8, 65u8, 214u8, 222u8, 82u8, 31u8, + 223u8, 144u8, 169u8, 17u8, 6u8, 138u8, 36u8, 113u8, 155u8, + 241u8, 106u8, 189u8, 218u8, + ] + { + let entry = LastTabledWasExternal; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The referendum to be tabled whenever it would be valid to table an external proposal."] #[doc = " This happens when a referendum needs to be tabled and one of two conditions are met:"] @@ -8687,7 +12566,7 @@ pub mod api { #[doc = " - `PublicProps` is empty."] pub async fn next_external( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<( ::subxt::sp_core::H256, @@ -8695,15 +12574,26 @@ pub mod api { )>, ::subxt::BasicError, > { - let entry = NextExternal; - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 167u8, 226u8, 113u8, 10u8, 12u8, 157u8, 190u8, 117u8, 233u8, + 177u8, 254u8, 126u8, 2u8, 55u8, 100u8, 249u8, 78u8, 127u8, + 148u8, 239u8, 193u8, 246u8, 123u8, 58u8, 150u8, 132u8, 209u8, + 228u8, 105u8, 195u8, 217u8, 99u8, + ] + { + let entry = NextExternal; + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " A record of who vetoed what. Maps proposal hash to a possible existent block number"] #[doc = " (until when it may not be resubmitted) and who vetoed it."] pub async fn blacklist( &self, _0: &::subxt::sp_core::H256, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<( ::core::primitive::u32, @@ -8711,52 +12601,110 @@ pub mod api { )>, ::subxt::BasicError, > { - let entry = Blacklist(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 9u8, 76u8, 174u8, 143u8, 210u8, 103u8, 197u8, 219u8, 152u8, + 134u8, 67u8, 78u8, 109u8, 39u8, 246u8, 214u8, 3u8, 51u8, + 69u8, 208u8, 32u8, 69u8, 247u8, 14u8, 236u8, 37u8, 112u8, + 226u8, 146u8, 169u8, 153u8, 217u8, + ] + { + let entry = Blacklist(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " A record of who vetoed what. Maps proposal hash to a possible existent block number"] #[doc = " (until when it may not be resubmitted) and who vetoed it."] pub async fn blacklist_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Blacklist<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 9u8, 76u8, 174u8, 143u8, 210u8, 103u8, 197u8, 219u8, 152u8, + 134u8, 67u8, 78u8, 109u8, 39u8, 246u8, 214u8, 3u8, 51u8, + 69u8, 208u8, 32u8, 69u8, 247u8, 14u8, 236u8, 37u8, 112u8, + 226u8, 146u8, 169u8, 153u8, 217u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Record of all proposals that have been subject to emergency cancellation."] pub async fn cancellations( &self, _0: &::subxt::sp_core::H256, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::bool, ::subxt::BasicError> { - let entry = Cancellations(_0); - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 176u8, 55u8, 142u8, 79u8, 35u8, 110u8, 215u8, 163u8, 134u8, + 172u8, 171u8, 71u8, 180u8, 175u8, 7u8, 29u8, 126u8, 141u8, + 236u8, 234u8, 214u8, 132u8, 192u8, 197u8, 205u8, 31u8, 106u8, + 122u8, 204u8, 71u8, 155u8, 18u8, + ] + { + let entry = Cancellations(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Record of all proposals that have been subject to emergency cancellation."] pub async fn cancellations_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Cancellations<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 176u8, 55u8, 142u8, 79u8, 35u8, 110u8, 215u8, 163u8, 134u8, + 172u8, 171u8, 71u8, 180u8, 175u8, 7u8, 29u8, 126u8, 141u8, + 236u8, 234u8, 214u8, 132u8, 192u8, 197u8, 205u8, 31u8, 106u8, + 122u8, 204u8, 71u8, 155u8, 18u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Storage version of the pallet."] #[doc = ""] #[doc = " New networks start with last version."] pub async fn storage_version( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option, ::subxt::BasicError, > { - let entry = StorageVersion; - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 39u8, 219u8, 134u8, 64u8, 250u8, 96u8, 95u8, 156u8, 100u8, + 236u8, 18u8, 78u8, 59u8, 146u8, 5u8, 245u8, 113u8, 125u8, + 220u8, 140u8, 125u8, 5u8, 194u8, 134u8, 248u8, 95u8, 250u8, + 108u8, 142u8, 230u8, 21u8, 120u8, + ] + { + let entry = StorageVersion; + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -8778,30 +12726,75 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Democracy")?; - let constant = pallet.constant("EnactmentPeriod")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Democracy", "EnactmentPeriod")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Democracy")?; + let constant = pallet.constant("EnactmentPeriod")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " How often (in blocks) new public referenda are launched."] pub fn launch_period( &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Democracy")?; - let constant = pallet.constant("LaunchPeriod")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Democracy", "LaunchPeriod")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Democracy")?; + let constant = pallet.constant("LaunchPeriod")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " How often (in blocks) to check for new votes."] pub fn voting_period( &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Democracy")?; - let constant = pallet.constant("VotingPeriod")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Democracy", "VotingPeriod")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Democracy")?; + let constant = pallet.constant("VotingPeriod")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The minimum period of vote locking."] #[doc = ""] @@ -8811,20 +12804,50 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Democracy")?; - let constant = pallet.constant("VoteLockingPeriod")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Democracy", "VoteLockingPeriod")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Democracy")?; + let constant = pallet.constant("VoteLockingPeriod")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The minimum amount to be used as a deposit for a public referendum proposal."] pub fn minimum_deposit( &self, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Democracy")?; - let constant = pallet.constant("MinimumDeposit")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Democracy", "MinimumDeposit")? + == [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, + 200u8, 214u8, 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, + 101u8, 54u8, 210u8, 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, + 15u8, 178u8, 98u8, 148u8, 156u8, + ] + { + let pallet = self.client.metadata().pallet("Democracy")?; + let constant = pallet.constant("MinimumDeposit")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Indicator for whether an emergency origin is even allowed to happen. Some chains may"] #[doc = " want to set this permanently to `false`, others may want to condition it on things such"] @@ -8833,40 +12856,100 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::bool, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Democracy")?; - let constant = pallet.constant("InstantAllowed")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Democracy", "InstantAllowed")? + == [ + 165u8, 28u8, 112u8, 190u8, 18u8, 129u8, 182u8, 206u8, 237u8, + 1u8, 68u8, 252u8, 125u8, 234u8, 185u8, 50u8, 149u8, 164u8, + 47u8, 126u8, 134u8, 100u8, 14u8, 86u8, 209u8, 39u8, 20u8, + 4u8, 233u8, 115u8, 102u8, 131u8, + ] + { + let pallet = self.client.metadata().pallet("Democracy")?; + let constant = pallet.constant("InstantAllowed")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Minimum voting period allowed for a fast-track referendum."] pub fn fast_track_voting_period( &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Democracy")?; - let constant = pallet.constant("FastTrackVotingPeriod")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Democracy", "FastTrackVotingPeriod")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Democracy")?; + let constant = pallet.constant("FastTrackVotingPeriod")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Period in blocks where an external proposal may not be re-submitted after being vetoed."] pub fn cooloff_period( &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Democracy")?; - let constant = pallet.constant("CooloffPeriod")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Democracy", "CooloffPeriod")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Democracy")?; + let constant = pallet.constant("CooloffPeriod")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The amount of balance that must be deposited per byte of preimage stored."] pub fn preimage_byte_deposit( &self, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Democracy")?; - let constant = pallet.constant("PreimageByteDeposit")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Democracy", "PreimageByteDeposit")? + == [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, + 200u8, 214u8, 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, + 101u8, 54u8, 210u8, 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, + 15u8, 178u8, 98u8, 148u8, 156u8, + ] + { + let pallet = self.client.metadata().pallet("Democracy")?; + let constant = pallet.constant("PreimageByteDeposit")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The maximum number of votes for an account."] #[doc = ""] @@ -8876,20 +12959,50 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Democracy")?; - let constant = pallet.constant("MaxVotes")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Democracy", "MaxVotes")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Democracy")?; + let constant = pallet.constant("MaxVotes")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The maximum number of public proposals that can exist at any time."] pub fn max_proposals( &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Democracy")?; - let constant = pallet.constant("MaxProposals")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Democracy", "MaxProposals")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Democracy")?; + let constant = pallet.constant("MaxProposals")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -9022,20 +13135,34 @@ pub mod api { new_members: ::std::vec::Vec<::subxt::sp_core::crypto::AccountId32>, prime: ::core::option::Option<::subxt::sp_core::crypto::AccountId32>, old_count: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetMembers, - DispatchError, - root_mod::Event, - > { - let call = SetMembers { - new_members, - prime, - old_count, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetMembers, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 228u8, 186u8, 17u8, 12u8, 231u8, 231u8, 139u8, 15u8, 96u8, + 200u8, 68u8, 27u8, 61u8, 106u8, 245u8, 199u8, 120u8, 141u8, + 95u8, 215u8, 36u8, 49u8, 0u8, 163u8, 172u8, 252u8, 221u8, + 9u8, 1u8, 222u8, 44u8, 214u8, + ] + { + let call = SetMembers { + new_members, + prime, + old_count, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Dispatch a proposal from a member using the `Member` origin."] #[doc = ""] @@ -9052,19 +13179,33 @@ pub mod api { &self, proposal: runtime_types::polkadot_runtime::Call, length_bound: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Execute, - DispatchError, - root_mod::Event, - > { - let call = Execute { - proposal: ::std::boxed::Box::new(proposal), - length_bound, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Execute, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 170u8, 77u8, 65u8, 3u8, 95u8, 88u8, 81u8, 103u8, 220u8, 72u8, + 237u8, 80u8, 181u8, 46u8, 196u8, 106u8, 142u8, 55u8, 244u8, + 204u8, 219u8, 152u8, 219u8, 17u8, 80u8, 55u8, 178u8, 56u8, + 161u8, 169u8, 50u8, 37u8, + ] + { + let call = Execute { + proposal: ::std::boxed::Box::new(proposal), + length_bound, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Add a new proposal to either be voted on or executed directly."] #[doc = ""] @@ -9098,20 +13239,34 @@ pub mod api { threshold: ::core::primitive::u32, proposal: runtime_types::polkadot_runtime::Call, length_bound: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Propose, - DispatchError, - root_mod::Event, - > { - let call = Propose { - threshold, - proposal: ::std::boxed::Box::new(proposal), - length_bound, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Propose, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 180u8, 170u8, 72u8, 21u8, 96u8, 25u8, 177u8, 147u8, 98u8, + 143u8, 186u8, 112u8, 99u8, 197u8, 146u8, 170u8, 35u8, 195u8, + 154u8, 87u8, 119u8, 190u8, 148u8, 82u8, 134u8, 3u8, 163u8, + 182u8, 132u8, 130u8, 2u8, 48u8, + ] + { + let call = Propose { + threshold, + proposal: ::std::boxed::Box::new(proposal), + length_bound, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Add an aye or nay vote for the sender to the given proposal."] #[doc = ""] @@ -9133,20 +13288,34 @@ pub mod api { proposal: ::subxt::sp_core::H256, index: ::core::primitive::u32, approve: ::core::primitive::bool, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Vote, - DispatchError, - root_mod::Event, - > { - let call = Vote { - proposal, - index, - approve, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Vote, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 184u8, 236u8, 80u8, 133u8, 26u8, 207u8, 3u8, 2u8, 120u8, + 27u8, 38u8, 135u8, 195u8, 86u8, 169u8, 229u8, 125u8, 253u8, + 220u8, 120u8, 231u8, 181u8, 101u8, 84u8, 151u8, 161u8, 39u8, + 154u8, 183u8, 142u8, 165u8, 161u8, + ] + { + let call = Vote { + proposal, + index, + approve, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Close a vote that is either approved, disapproved or whose voting period has ended."] #[doc = ""] @@ -9186,21 +13355,35 @@ pub mod api { index: ::core::primitive::u32, proposal_weight_bound: ::core::primitive::u64, length_bound: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Close, - DispatchError, - root_mod::Event, - > { - let call = Close { - proposal_hash, - index, - proposal_weight_bound, - length_bound, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Close, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 242u8, 208u8, 108u8, 202u8, 24u8, 139u8, 8u8, 150u8, 108u8, + 217u8, 30u8, 209u8, 178u8, 1u8, 80u8, 25u8, 154u8, 146u8, + 173u8, 172u8, 227u8, 4u8, 140u8, 228u8, 58u8, 221u8, 189u8, + 135u8, 203u8, 69u8, 105u8, 47u8, + ] + { + let call = Close { + proposal_hash, + index, + proposal_weight_bound, + length_bound, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Disapprove a proposal, close, and remove it from the system, regardless of its current"] #[doc = "state."] @@ -9219,16 +13402,30 @@ pub mod api { pub fn disapprove_proposal( &self, proposal_hash: ::subxt::sp_core::H256, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - DisapproveProposal, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + DisapproveProposal, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = DisapproveProposal { proposal_hash }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 199u8, 113u8, 221u8, 167u8, 60u8, 241u8, 77u8, 166u8, 205u8, + 191u8, 183u8, 121u8, 191u8, 206u8, 230u8, 212u8, 215u8, + 219u8, 30u8, 51u8, 123u8, 18u8, 17u8, 218u8, 77u8, 227u8, + 197u8, 95u8, 232u8, 59u8, 169u8, 133u8, + ] + { + let call = DisapproveProposal { proposal_hash }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -9392,43 +13589,79 @@ pub mod api { #[doc = " The hashes of the active proposals."] pub async fn proposals( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< runtime_types::frame_support::storage::bounded_vec::BoundedVec< ::subxt::sp_core::H256, >, ::subxt::BasicError, > { - let entry = Proposals; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 174u8, 75u8, 108u8, 245u8, 86u8, 50u8, 107u8, 212u8, 244u8, + 113u8, 232u8, 168u8, 194u8, 33u8, 247u8, 97u8, 54u8, 115u8, + 236u8, 189u8, 59u8, 2u8, 252u8, 84u8, 199u8, 127u8, 197u8, + 72u8, 23u8, 1u8, 118u8, 95u8, + ] + { + let entry = Proposals; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Actual proposal for a given hash, if it's current."] pub async fn proposal_of( &self, _0: &::subxt::sp_core::H256, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option, ::subxt::BasicError, > { - let entry = ProposalOf(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 75u8, 36u8, 235u8, 242u8, 206u8, 251u8, 227u8, 94u8, 96u8, + 26u8, 160u8, 127u8, 226u8, 27u8, 55u8, 177u8, 75u8, 102u8, + 124u8, 107u8, 33u8, 214u8, 101u8, 215u8, 174u8, 149u8, 162u8, + 189u8, 198u8, 68u8, 189u8, 218u8, + ] + { + let entry = ProposalOf(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Actual proposal for a given hash, if it's current."] pub async fn proposal_of_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, ProposalOf<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 75u8, 36u8, 235u8, 242u8, 206u8, 251u8, 227u8, 94u8, 96u8, + 26u8, 160u8, 127u8, 226u8, 27u8, 55u8, 177u8, 75u8, 102u8, + 124u8, 107u8, 33u8, 214u8, 101u8, 215u8, 174u8, 149u8, 162u8, + 189u8, 198u8, 68u8, 189u8, 218u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Votes on a given proposal, if it is ongoing."] pub async fn voting( &self, _0: &::subxt::sp_core::H256, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::pallet_collective::Votes< @@ -9438,49 +13671,110 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = Voting(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 145u8, 223u8, 203u8, 2u8, 137u8, 33u8, 22u8, 239u8, 175u8, + 149u8, 254u8, 185u8, 0u8, 139u8, 71u8, 134u8, 109u8, 95u8, + 45u8, 75u8, 33u8, 228u8, 127u8, 67u8, 53u8, 119u8, 188u8, + 198u8, 11u8, 92u8, 4u8, 177u8, + ] + { + let entry = Voting(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Votes on a given proposal, if it is ongoing."] pub async fn voting_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Voting<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 145u8, 223u8, 203u8, 2u8, 137u8, 33u8, 22u8, 239u8, 175u8, + 149u8, 254u8, 185u8, 0u8, 139u8, 71u8, 134u8, 109u8, 95u8, + 45u8, 75u8, 33u8, 228u8, 127u8, 67u8, 53u8, 119u8, 188u8, + 198u8, 11u8, 92u8, 4u8, 177u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Proposals so far."] pub async fn proposal_count( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let entry = ProposalCount; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 132u8, 145u8, 78u8, 218u8, 51u8, 189u8, 55u8, 172u8, 143u8, + 33u8, 140u8, 99u8, 124u8, 208u8, 57u8, 232u8, 154u8, 110u8, + 32u8, 142u8, 24u8, 149u8, 109u8, 105u8, 30u8, 83u8, 39u8, + 177u8, 127u8, 160u8, 34u8, 70u8, + ] + { + let entry = ProposalCount; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The current members of the collective. This is stored sorted (just by value)."] pub async fn members( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec<::subxt::sp_core::crypto::AccountId32>, ::subxt::BasicError, > { - let entry = Members; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 136u8, 91u8, 140u8, 173u8, 238u8, 221u8, 4u8, 132u8, 238u8, + 99u8, 195u8, 142u8, 10u8, 35u8, 210u8, 227u8, 22u8, 72u8, + 218u8, 222u8, 227u8, 51u8, 55u8, 31u8, 252u8, 78u8, 195u8, + 11u8, 195u8, 242u8, 171u8, 75u8, + ] + { + let entry = Members; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The prime member that helps determine the default vote behavior in case of absentations."] pub async fn prime( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<::subxt::sp_core::crypto::AccountId32>, ::subxt::BasicError, > { - let entry = Prime; - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 70u8, 101u8, 20u8, 160u8, 173u8, 87u8, 190u8, 85u8, 60u8, + 249u8, 144u8, 77u8, 175u8, 195u8, 51u8, 196u8, 234u8, 62u8, + 243u8, 199u8, 126u8, 12u8, 88u8, 252u8, 1u8, 210u8, 65u8, + 210u8, 33u8, 19u8, 222u8, 11u8, + ] + { + let entry = Prime; + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -9613,20 +13907,34 @@ pub mod api { new_members: ::std::vec::Vec<::subxt::sp_core::crypto::AccountId32>, prime: ::core::option::Option<::subxt::sp_core::crypto::AccountId32>, old_count: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetMembers, - DispatchError, - root_mod::Event, - > { - let call = SetMembers { - new_members, - prime, - old_count, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetMembers, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 228u8, 186u8, 17u8, 12u8, 231u8, 231u8, 139u8, 15u8, 96u8, + 200u8, 68u8, 27u8, 61u8, 106u8, 245u8, 199u8, 120u8, 141u8, + 95u8, 215u8, 36u8, 49u8, 0u8, 163u8, 172u8, 252u8, 221u8, + 9u8, 1u8, 222u8, 44u8, 214u8, + ] + { + let call = SetMembers { + new_members, + prime, + old_count, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Dispatch a proposal from a member using the `Member` origin."] #[doc = ""] @@ -9643,19 +13951,33 @@ pub mod api { &self, proposal: runtime_types::polkadot_runtime::Call, length_bound: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Execute, - DispatchError, - root_mod::Event, - > { - let call = Execute { - proposal: ::std::boxed::Box::new(proposal), - length_bound, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Execute, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 170u8, 77u8, 65u8, 3u8, 95u8, 88u8, 81u8, 103u8, 220u8, 72u8, + 237u8, 80u8, 181u8, 46u8, 196u8, 106u8, 142u8, 55u8, 244u8, + 204u8, 219u8, 152u8, 219u8, 17u8, 80u8, 55u8, 178u8, 56u8, + 161u8, 169u8, 50u8, 37u8, + ] + { + let call = Execute { + proposal: ::std::boxed::Box::new(proposal), + length_bound, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Add a new proposal to either be voted on or executed directly."] #[doc = ""] @@ -9689,20 +14011,34 @@ pub mod api { threshold: ::core::primitive::u32, proposal: runtime_types::polkadot_runtime::Call, length_bound: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Propose, - DispatchError, - root_mod::Event, - > { - let call = Propose { - threshold, - proposal: ::std::boxed::Box::new(proposal), - length_bound, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Propose, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 180u8, 170u8, 72u8, 21u8, 96u8, 25u8, 177u8, 147u8, 98u8, + 143u8, 186u8, 112u8, 99u8, 197u8, 146u8, 170u8, 35u8, 195u8, + 154u8, 87u8, 119u8, 190u8, 148u8, 82u8, 134u8, 3u8, 163u8, + 182u8, 132u8, 130u8, 2u8, 48u8, + ] + { + let call = Propose { + threshold, + proposal: ::std::boxed::Box::new(proposal), + length_bound, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Add an aye or nay vote for the sender to the given proposal."] #[doc = ""] @@ -9724,20 +14060,34 @@ pub mod api { proposal: ::subxt::sp_core::H256, index: ::core::primitive::u32, approve: ::core::primitive::bool, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Vote, - DispatchError, - root_mod::Event, - > { - let call = Vote { - proposal, - index, - approve, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Vote, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 184u8, 236u8, 80u8, 133u8, 26u8, 207u8, 3u8, 2u8, 120u8, + 27u8, 38u8, 135u8, 195u8, 86u8, 169u8, 229u8, 125u8, 253u8, + 220u8, 120u8, 231u8, 181u8, 101u8, 84u8, 151u8, 161u8, 39u8, + 154u8, 183u8, 142u8, 165u8, 161u8, + ] + { + let call = Vote { + proposal, + index, + approve, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Close a vote that is either approved, disapproved or whose voting period has ended."] #[doc = ""] @@ -9777,21 +14127,35 @@ pub mod api { index: ::core::primitive::u32, proposal_weight_bound: ::core::primitive::u64, length_bound: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Close, - DispatchError, - root_mod::Event, - > { - let call = Close { - proposal_hash, - index, - proposal_weight_bound, - length_bound, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Close, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 242u8, 208u8, 108u8, 202u8, 24u8, 139u8, 8u8, 150u8, 108u8, + 217u8, 30u8, 209u8, 178u8, 1u8, 80u8, 25u8, 154u8, 146u8, + 173u8, 172u8, 227u8, 4u8, 140u8, 228u8, 58u8, 221u8, 189u8, + 135u8, 203u8, 69u8, 105u8, 47u8, + ] + { + let call = Close { + proposal_hash, + index, + proposal_weight_bound, + length_bound, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Disapprove a proposal, close, and remove it from the system, regardless of its current"] #[doc = "state."] @@ -9810,16 +14174,30 @@ pub mod api { pub fn disapprove_proposal( &self, proposal_hash: ::subxt::sp_core::H256, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - DisapproveProposal, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + DisapproveProposal, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = DisapproveProposal { proposal_hash }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 199u8, 113u8, 221u8, 167u8, 60u8, 241u8, 77u8, 166u8, 205u8, + 191u8, 183u8, 121u8, 191u8, 206u8, 230u8, 212u8, 215u8, + 219u8, 30u8, 51u8, 123u8, 18u8, 17u8, 218u8, 77u8, 227u8, + 197u8, 95u8, 232u8, 59u8, 169u8, 133u8, + ] + { + let call = DisapproveProposal { proposal_hash }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -9983,43 +14361,79 @@ pub mod api { #[doc = " The hashes of the active proposals."] pub async fn proposals( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< runtime_types::frame_support::storage::bounded_vec::BoundedVec< ::subxt::sp_core::H256, >, ::subxt::BasicError, > { - let entry = Proposals; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 174u8, 75u8, 108u8, 245u8, 86u8, 50u8, 107u8, 212u8, 244u8, + 113u8, 232u8, 168u8, 194u8, 33u8, 247u8, 97u8, 54u8, 115u8, + 236u8, 189u8, 59u8, 2u8, 252u8, 84u8, 199u8, 127u8, 197u8, + 72u8, 23u8, 1u8, 118u8, 95u8, + ] + { + let entry = Proposals; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Actual proposal for a given hash, if it's current."] pub async fn proposal_of( &self, _0: &::subxt::sp_core::H256, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option, ::subxt::BasicError, > { - let entry = ProposalOf(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 75u8, 36u8, 235u8, 242u8, 206u8, 251u8, 227u8, 94u8, 96u8, + 26u8, 160u8, 127u8, 226u8, 27u8, 55u8, 177u8, 75u8, 102u8, + 124u8, 107u8, 33u8, 214u8, 101u8, 215u8, 174u8, 149u8, 162u8, + 189u8, 198u8, 68u8, 189u8, 218u8, + ] + { + let entry = ProposalOf(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Actual proposal for a given hash, if it's current."] pub async fn proposal_of_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, ProposalOf<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 75u8, 36u8, 235u8, 242u8, 206u8, 251u8, 227u8, 94u8, 96u8, + 26u8, 160u8, 127u8, 226u8, 27u8, 55u8, 177u8, 75u8, 102u8, + 124u8, 107u8, 33u8, 214u8, 101u8, 215u8, 174u8, 149u8, 162u8, + 189u8, 198u8, 68u8, 189u8, 218u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Votes on a given proposal, if it is ongoing."] pub async fn voting( &self, _0: &::subxt::sp_core::H256, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::pallet_collective::Votes< @@ -10029,49 +14443,110 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = Voting(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 145u8, 223u8, 203u8, 2u8, 137u8, 33u8, 22u8, 239u8, 175u8, + 149u8, 254u8, 185u8, 0u8, 139u8, 71u8, 134u8, 109u8, 95u8, + 45u8, 75u8, 33u8, 228u8, 127u8, 67u8, 53u8, 119u8, 188u8, + 198u8, 11u8, 92u8, 4u8, 177u8, + ] + { + let entry = Voting(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Votes on a given proposal, if it is ongoing."] pub async fn voting_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Voting<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 145u8, 223u8, 203u8, 2u8, 137u8, 33u8, 22u8, 239u8, 175u8, + 149u8, 254u8, 185u8, 0u8, 139u8, 71u8, 134u8, 109u8, 95u8, + 45u8, 75u8, 33u8, 228u8, 127u8, 67u8, 53u8, 119u8, 188u8, + 198u8, 11u8, 92u8, 4u8, 177u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Proposals so far."] pub async fn proposal_count( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let entry = ProposalCount; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 132u8, 145u8, 78u8, 218u8, 51u8, 189u8, 55u8, 172u8, 143u8, + 33u8, 140u8, 99u8, 124u8, 208u8, 57u8, 232u8, 154u8, 110u8, + 32u8, 142u8, 24u8, 149u8, 109u8, 105u8, 30u8, 83u8, 39u8, + 177u8, 127u8, 160u8, 34u8, 70u8, + ] + { + let entry = ProposalCount; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The current members of the collective. This is stored sorted (just by value)."] pub async fn members( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec<::subxt::sp_core::crypto::AccountId32>, ::subxt::BasicError, > { - let entry = Members; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 136u8, 91u8, 140u8, 173u8, 238u8, 221u8, 4u8, 132u8, 238u8, + 99u8, 195u8, 142u8, 10u8, 35u8, 210u8, 227u8, 22u8, 72u8, + 218u8, 222u8, 227u8, 51u8, 55u8, 31u8, 252u8, 78u8, 195u8, + 11u8, 195u8, 242u8, 171u8, 75u8, + ] + { + let entry = Members; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The prime member that helps determine the default vote behavior in case of absentations."] pub async fn prime( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<::subxt::sp_core::crypto::AccountId32>, ::subxt::BasicError, > { - let entry = Prime; - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 70u8, 101u8, 20u8, 160u8, 173u8, 87u8, 190u8, 85u8, 60u8, + 249u8, 144u8, 77u8, 175u8, 195u8, 51u8, 196u8, 234u8, 62u8, + 243u8, 199u8, 126u8, 12u8, 88u8, 252u8, 1u8, 210u8, 65u8, + 210u8, 33u8, 19u8, 222u8, 11u8, + ] + { + let entry = Prime; + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -10183,16 +14658,30 @@ pub mod api { &self, votes: ::std::vec::Vec<::subxt::sp_core::crypto::AccountId32>, value: ::core::primitive::u128, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Vote, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Vote, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = Vote { votes, value }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 245u8, 122u8, 160u8, 64u8, 234u8, 121u8, 191u8, 224u8, 12u8, + 16u8, 153u8, 70u8, 41u8, 236u8, 211u8, 145u8, 238u8, 112u8, + 11u8, 94u8, 92u8, 160u8, 67u8, 176u8, 126u8, 232u8, 63u8, + 226u8, 207u8, 205u8, 90u8, 61u8, + ] + { + let call = Vote { votes, value }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Remove `origin` as a voter."] #[doc = ""] @@ -10201,16 +14690,30 @@ pub mod api { #[doc = "The dispatch origin of this call must be signed and be a voter."] pub fn remove_voter( &self, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - RemoveVoter, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + RemoveVoter, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = RemoveVoter {}; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 254u8, 46u8, 140u8, 4u8, 218u8, 45u8, 150u8, 72u8, 67u8, + 131u8, 108u8, 201u8, 46u8, 157u8, 104u8, 161u8, 53u8, 155u8, + 130u8, 50u8, 88u8, 149u8, 255u8, 12u8, 17u8, 85u8, 95u8, + 69u8, 153u8, 130u8, 221u8, 1u8, + ] + { + let call = RemoveVoter {}; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Submit oneself for candidacy. A fixed amount of deposit is recorded."] #[doc = ""] @@ -10230,16 +14733,30 @@ pub mod api { pub fn submit_candidacy( &self, candidate_count: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SubmitCandidacy, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SubmitCandidacy, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SubmitCandidacy { candidate_count }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 100u8, 38u8, 146u8, 5u8, 234u8, 101u8, 193u8, 9u8, 245u8, + 237u8, 220u8, 21u8, 36u8, 64u8, 205u8, 103u8, 11u8, 194u8, + 18u8, 96u8, 44u8, 231u8, 125u8, 82u8, 63u8, 51u8, 51u8, + 183u8, 28u8, 33u8, 121u8, 89u8, + ] + { + let call = SubmitCandidacy { candidate_count }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Renounce one's intention to be a candidate for the next election round. 3 potential"] #[doc = "outcomes exist:"] @@ -10262,16 +14779,30 @@ pub mod api { pub fn renounce_candidacy( &self, renouncing: runtime_types::pallet_elections_phragmen::Renouncing, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - RenounceCandidacy, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + RenounceCandidacy, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = RenounceCandidacy { renouncing }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 184u8, 45u8, 220u8, 198u8, 21u8, 54u8, 15u8, 235u8, 192u8, + 78u8, 96u8, 172u8, 12u8, 152u8, 147u8, 183u8, 172u8, 85u8, + 26u8, 243u8, 250u8, 248u8, 104u8, 76u8, 88u8, 150u8, 197u8, + 130u8, 221u8, 234u8, 53u8, 174u8, + ] + { + let call = RenounceCandidacy { renouncing }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Remove a particular member from the set. This is effective immediately and the bond of"] #[doc = "the outgoing member is slashed."] @@ -10294,19 +14825,33 @@ pub mod api { (), >, has_replacement: ::core::primitive::bool, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - RemoveMember, - DispatchError, - root_mod::Event, - > { - let call = RemoveMember { - who, - has_replacement, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + RemoveMember, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 0u8, 99u8, 154u8, 250u8, 4u8, 102u8, 172u8, 220u8, 86u8, + 147u8, 113u8, 248u8, 152u8, 189u8, 179u8, 149u8, 73u8, 97u8, + 201u8, 143u8, 83u8, 11u8, 94u8, 123u8, 149u8, 253u8, 179u8, + 154u8, 132u8, 42u8, 70u8, 189u8, + ] + { + let call = RemoveMember { + who, + has_replacement, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Clean all voters who are defunct (i.e. they do not serve any purpose at all). The"] #[doc = "deposit of the removed voters are returned."] @@ -10322,19 +14867,33 @@ pub mod api { &self, num_voters: ::core::primitive::u32, num_defunct: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - CleanDefunctVoters, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + CleanDefunctVoters, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = CleanDefunctVoters { - num_voters, - num_defunct, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 80u8, 248u8, 122u8, 6u8, 88u8, 255u8, 17u8, 206u8, 104u8, + 208u8, 66u8, 191u8, 118u8, 163u8, 154u8, 9u8, 37u8, 106u8, + 232u8, 178u8, 17u8, 177u8, 225u8, 101u8, 76u8, 207u8, 175u8, + 117u8, 21u8, 203u8, 229u8, 140u8, + ] + { + let call = CleanDefunctVoters { + num_voters, + num_defunct, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -10493,7 +15052,7 @@ pub mod api { #[doc = " Invariant: Always sorted based on account id."] pub async fn members( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec< runtime_types::pallet_elections_phragmen::SeatHolder< @@ -10503,8 +15062,22 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = Members; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 193u8, 166u8, 79u8, 96u8, 31u8, 4u8, 133u8, 133u8, 115u8, + 236u8, 253u8, 177u8, 176u8, 10u8, 50u8, 97u8, 254u8, 234u8, + 169u8, 236u8, 77u8, 243u8, 173u8, 187u8, 129u8, 122u8, 160u8, + 73u8, 25u8, 150u8, 140u8, 56u8, + ] + { + let entry = Members; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The current reserved runners-up."] #[doc = ""] @@ -10512,7 +15085,7 @@ pub mod api { #[doc = " last (i.e. _best_) runner-up will be replaced."] pub async fn runners_up( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec< runtime_types::pallet_elections_phragmen::SeatHolder< @@ -10522,8 +15095,22 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = RunnersUp; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 59u8, 65u8, 218u8, 225u8, 49u8, 140u8, 168u8, 143u8, 195u8, + 106u8, 207u8, 181u8, 157u8, 129u8, 140u8, 122u8, 145u8, + 207u8, 179u8, 144u8, 146u8, 206u8, 204u8, 245u8, 6u8, 201u8, + 192u8, 232u8, 84u8, 108u8, 86u8, 187u8, + ] + { + let entry = RunnersUp; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The present candidate list. A current member or runner-up can never enter this vector"] #[doc = " and is always implicitly assumed to be a candidate."] @@ -10533,7 +15120,7 @@ pub mod api { #[doc = " Invariant: Always sorted based on account id."] pub async fn candidates( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec<( ::subxt::sp_core::crypto::AccountId32, @@ -10541,17 +15128,45 @@ pub mod api { )>, ::subxt::BasicError, > { - let entry = Candidates; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 172u8, 196u8, 249u8, 114u8, 195u8, 161u8, 43u8, 219u8, 208u8, + 127u8, 144u8, 87u8, 13u8, 253u8, 114u8, 209u8, 199u8, 65u8, + 77u8, 7u8, 131u8, 166u8, 212u8, 94u8, 253u8, 166u8, 234u8, + 42u8, 36u8, 175u8, 100u8, 14u8, + ] + { + let entry = Candidates; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The total number of vote rounds that have happened, excluding the upcoming one."] pub async fn election_rounds( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let entry = ElectionRounds; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 144u8, 146u8, 10u8, 32u8, 149u8, 147u8, 59u8, 205u8, 61u8, + 246u8, 28u8, 169u8, 130u8, 136u8, 143u8, 104u8, 253u8, 86u8, + 228u8, 68u8, 19u8, 184u8, 166u8, 214u8, 58u8, 103u8, 176u8, + 160u8, 240u8, 249u8, 117u8, 115u8, + ] + { + let entry = ElectionRounds; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Votes and locked stake of a particular voter."] #[doc = ""] @@ -10559,7 +15174,7 @@ pub mod api { pub async fn voting( &self, _0: &::subxt::sp_core::crypto::AccountId32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< runtime_types::pallet_elections_phragmen::Voter< ::subxt::sp_core::crypto::AccountId32, @@ -10567,20 +15182,45 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = Voting(_0); - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 107u8, 14u8, 228u8, 167u8, 43u8, 105u8, 221u8, 70u8, 234u8, + 157u8, 36u8, 16u8, 63u8, 225u8, 89u8, 111u8, 201u8, 172u8, + 98u8, 169u8, 232u8, 175u8, 172u8, 20u8, 223u8, 80u8, 107u8, + 183u8, 252u8, 175u8, 50u8, 171u8, + ] + { + let entry = Voting(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Votes and locked stake of a particular voter."] #[doc = ""] #[doc = " TWOX-NOTE: SAFE as `AccountId` is a crypto hash."] pub async fn voting_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Voting<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 107u8, 14u8, 228u8, 167u8, 43u8, 105u8, 221u8, 70u8, 234u8, + 157u8, 36u8, 16u8, 63u8, 225u8, 89u8, 111u8, 201u8, 172u8, + 98u8, 169u8, 232u8, 175u8, 172u8, 20u8, 223u8, 80u8, 107u8, + 183u8, 252u8, 175u8, 50u8, 171u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -10600,20 +15240,50 @@ pub mod api { [::core::primitive::u8; 8usize], ::subxt::BasicError, > { - let pallet = self.client.metadata().pallet("PhragmenElection")?; - let constant = pallet.constant("PalletId")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("PhragmenElection", "PalletId")? + == [ + 224u8, 197u8, 247u8, 125u8, 62u8, 180u8, 69u8, 91u8, 226u8, + 36u8, 82u8, 148u8, 70u8, 147u8, 209u8, 40u8, 210u8, 229u8, + 181u8, 191u8, 170u8, 205u8, 138u8, 97u8, 127u8, 59u8, 124u8, + 244u8, 252u8, 30u8, 213u8, 179u8, + ] + { + let pallet = self.client.metadata().pallet("PhragmenElection")?; + let constant = pallet.constant("PalletId")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " How much should be locked up in order to submit one's candidacy."] pub fn candidacy_bond( &self, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("PhragmenElection")?; - let constant = pallet.constant("CandidacyBond")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("PhragmenElection", "CandidacyBond")? + == [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, + 200u8, 214u8, 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, + 101u8, 54u8, 210u8, 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, + 15u8, 178u8, 98u8, 148u8, 156u8, + ] + { + let pallet = self.client.metadata().pallet("PhragmenElection")?; + let constant = pallet.constant("CandidacyBond")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Base deposit associated with voting."] #[doc = ""] @@ -10623,40 +15293,100 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("PhragmenElection")?; - let constant = pallet.constant("VotingBondBase")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("PhragmenElection", "VotingBondBase")? + == [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, + 200u8, 214u8, 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, + 101u8, 54u8, 210u8, 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, + 15u8, 178u8, 98u8, 148u8, 156u8, + ] + { + let pallet = self.client.metadata().pallet("PhragmenElection")?; + let constant = pallet.constant("VotingBondBase")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The amount of bond that need to be locked for each vote (32 bytes)."] pub fn voting_bond_factor( &self, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("PhragmenElection")?; - let constant = pallet.constant("VotingBondFactor")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("PhragmenElection", "VotingBondFactor")? + == [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, + 200u8, 214u8, 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, + 101u8, 54u8, 210u8, 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, + 15u8, 178u8, 98u8, 148u8, 156u8, + ] + { + let pallet = self.client.metadata().pallet("PhragmenElection")?; + let constant = pallet.constant("VotingBondFactor")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Number of members to elect."] pub fn desired_members( &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("PhragmenElection")?; - let constant = pallet.constant("DesiredMembers")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) - } + if self + .client + .metadata() + .constant_hash("PhragmenElection", "DesiredMembers")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("PhragmenElection")?; + let constant = pallet.constant("DesiredMembers")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } + } #[doc = " Number of runners_up to keep."] pub fn desired_runners_up( &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("PhragmenElection")?; - let constant = pallet.constant("DesiredRunnersUp")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("PhragmenElection", "DesiredRunnersUp")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("PhragmenElection")?; + let constant = pallet.constant("DesiredRunnersUp")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " How long each seat is kept. This defines the next block number at which an election"] #[doc = " round will happen. If set to zero, no elections are ever triggered and the module will"] @@ -10665,10 +15395,25 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("PhragmenElection")?; - let constant = pallet.constant("TermDuration")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("PhragmenElection", "TermDuration")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("PhragmenElection")?; + let constant = pallet.constant("TermDuration")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -10760,16 +15505,30 @@ pub mod api { pub fn add_member( &self, who: ::subxt::sp_core::crypto::AccountId32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - AddMember, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + AddMember, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = AddMember { who }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 1u8, 149u8, 115u8, 222u8, 93u8, 9u8, 208u8, 58u8, 22u8, + 148u8, 215u8, 141u8, 204u8, 48u8, 107u8, 210u8, 202u8, 165u8, + 43u8, 159u8, 45u8, 161u8, 255u8, 127u8, 225u8, 100u8, 161u8, + 195u8, 197u8, 206u8, 57u8, 166u8, + ] + { + let call = AddMember { who }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Remove a member `who` from the set."] #[doc = ""] @@ -10777,16 +15536,30 @@ pub mod api { pub fn remove_member( &self, who: ::subxt::sp_core::crypto::AccountId32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - RemoveMember, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + RemoveMember, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = RemoveMember { who }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 137u8, 249u8, 148u8, 139u8, 147u8, 47u8, 226u8, 228u8, 139u8, + 219u8, 109u8, 128u8, 254u8, 51u8, 227u8, 154u8, 105u8, 91u8, + 229u8, 69u8, 217u8, 241u8, 107u8, 229u8, 41u8, 202u8, 228u8, + 227u8, 160u8, 162u8, 45u8, 211u8, + ] + { + let call = RemoveMember { who }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Swap out one member `remove` for another `add`."] #[doc = ""] @@ -10797,16 +15570,30 @@ pub mod api { &self, remove: ::subxt::sp_core::crypto::AccountId32, add: ::subxt::sp_core::crypto::AccountId32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SwapMember, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SwapMember, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SwapMember { remove, add }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 159u8, 62u8, 254u8, 117u8, 56u8, 185u8, 99u8, 29u8, 146u8, + 210u8, 40u8, 77u8, 169u8, 224u8, 215u8, 34u8, 106u8, 95u8, + 204u8, 109u8, 72u8, 67u8, 11u8, 183u8, 33u8, 84u8, 133u8, + 4u8, 5u8, 13u8, 188u8, 123u8, + ] + { + let call = SwapMember { remove, add }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Change the membership to a new set, disregarding the existing membership. Be nice and"] #[doc = "pass `members` pre-sorted."] @@ -10815,16 +15602,30 @@ pub mod api { pub fn reset_members( &self, members: ::std::vec::Vec<::subxt::sp_core::crypto::AccountId32>, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ResetMembers, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ResetMembers, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ResetMembers { members }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 246u8, 84u8, 91u8, 191u8, 61u8, 245u8, 171u8, 80u8, 18u8, + 120u8, 61u8, 86u8, 23u8, 115u8, 161u8, 203u8, 128u8, 34u8, + 166u8, 128u8, 33u8, 28u8, 229u8, 81u8, 103u8, 217u8, 173u8, + 151u8, 31u8, 118u8, 151u8, 217u8, + ] + { + let call = ResetMembers { members }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Swap out the sending member for some other key `new`."] #[doc = ""] @@ -10834,16 +15635,30 @@ pub mod api { pub fn change_key( &self, new: ::subxt::sp_core::crypto::AccountId32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ChangeKey, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ChangeKey, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ChangeKey { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 198u8, 93u8, 41u8, 52u8, 241u8, 11u8, 225u8, 82u8, 30u8, + 114u8, 111u8, 204u8, 13u8, 31u8, 34u8, 82u8, 171u8, 58u8, + 180u8, 65u8, 3u8, 246u8, 33u8, 167u8, 200u8, 23u8, 150u8, + 235u8, 130u8, 172u8, 202u8, 216u8, + ] + { + let call = ChangeKey { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set the prime member. Must be a current member."] #[doc = ""] @@ -10851,32 +15666,60 @@ pub mod api { pub fn set_prime( &self, who: ::subxt::sp_core::crypto::AccountId32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetPrime, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetPrime, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetPrime { who }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 185u8, 53u8, 61u8, 154u8, 234u8, 77u8, 195u8, 126u8, 19u8, + 39u8, 78u8, 205u8, 109u8, 210u8, 137u8, 245u8, 128u8, 110u8, + 2u8, 201u8, 20u8, 153u8, 146u8, 177u8, 4u8, 144u8, 229u8, + 125u8, 91u8, 131u8, 199u8, 15u8, + ] + { + let call = SetPrime { who }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Remove the prime member if it exists."] #[doc = ""] #[doc = "May only be called from `T::PrimeOrigin`."] pub fn clear_prime( &self, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ClearPrime, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ClearPrime, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ClearPrime {}; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 186u8, 182u8, 225u8, 90u8, 71u8, 124u8, 69u8, 100u8, 234u8, + 25u8, 53u8, 23u8, 182u8, 32u8, 176u8, 81u8, 54u8, 140u8, + 235u8, 126u8, 247u8, 7u8, 155u8, 62u8, 35u8, 135u8, 48u8, + 61u8, 88u8, 160u8, 183u8, 72u8, + ] + { + let call = ClearPrime {}; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -10956,24 +15799,49 @@ pub mod api { #[doc = " The current membership, stored as an ordered Vec."] pub async fn members( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec<::subxt::sp_core::crypto::AccountId32>, ::subxt::BasicError, > { - let entry = Members; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 136u8, 91u8, 140u8, 173u8, 238u8, 221u8, 4u8, 132u8, 238u8, + 99u8, 195u8, 142u8, 10u8, 35u8, 210u8, 227u8, 22u8, 72u8, + 218u8, 222u8, 227u8, 51u8, 55u8, 31u8, 252u8, 78u8, 195u8, + 11u8, 195u8, 242u8, 171u8, 75u8, + ] + { + let entry = Members; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The current prime member, if one exists."] pub async fn prime( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<::subxt::sp_core::crypto::AccountId32>, ::subxt::BasicError, > { - let entry = Prime; - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 70u8, 101u8, 20u8, 160u8, 173u8, 87u8, 190u8, 85u8, 60u8, + 249u8, 144u8, 77u8, 175u8, 195u8, 51u8, 196u8, 234u8, 62u8, + 243u8, 199u8, 126u8, 12u8, 88u8, 252u8, 1u8, 210u8, 65u8, + 210u8, 33u8, 19u8, 222u8, 11u8, + ] + { + let entry = Prime; + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -11051,16 +15919,30 @@ pub mod api { ::subxt::sp_core::crypto::AccountId32, (), >, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ProposeSpend, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ProposeSpend, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ProposeSpend { value, beneficiary }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 117u8, 11u8, 194u8, 76u8, 160u8, 114u8, 119u8, 94u8, 47u8, + 239u8, 193u8, 54u8, 42u8, 208u8, 225u8, 47u8, 22u8, 90u8, + 166u8, 169u8, 192u8, 145u8, 159u8, 38u8, 209u8, 134u8, 102u8, + 91u8, 65u8, 129u8, 251u8, 3u8, + ] + { + let call = ProposeSpend { value, beneficiary }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Reject a proposed spend. The original deposit will be slashed."] #[doc = ""] @@ -11074,16 +15956,30 @@ pub mod api { pub fn reject_proposal( &self, proposal_id: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - RejectProposal, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + RejectProposal, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = RejectProposal { proposal_id }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 153u8, 238u8, 223u8, 212u8, 86u8, 178u8, 184u8, 150u8, 117u8, + 91u8, 69u8, 30u8, 196u8, 134u8, 56u8, 54u8, 236u8, 145u8, + 202u8, 139u8, 135u8, 254u8, 80u8, 189u8, 40u8, 56u8, 148u8, + 108u8, 42u8, 118u8, 74u8, 242u8, + ] + { + let call = RejectProposal { proposal_id }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Approve a proposal. At a later time, the proposal will be allocated to the beneficiary"] #[doc = "and the original deposit will be returned."] @@ -11098,16 +15994,30 @@ pub mod api { pub fn approve_proposal( &self, proposal_id: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ApproveProposal, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ApproveProposal, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ApproveProposal { proposal_id }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 191u8, 81u8, 78u8, 230u8, 230u8, 192u8, 144u8, 232u8, 81u8, + 70u8, 227u8, 212u8, 194u8, 228u8, 231u8, 147u8, 57u8, 222u8, + 156u8, 77u8, 173u8, 60u8, 92u8, 84u8, 255u8, 64u8, 240u8, + 45u8, 131u8, 200u8, 206u8, 231u8, + ] + { + let call = ApproveProposal { proposal_id }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -11254,17 +16164,31 @@ pub mod api { #[doc = " Number of proposals that have been made."] pub async fn proposal_count( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let entry = ProposalCount; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 132u8, 145u8, 78u8, 218u8, 51u8, 189u8, 55u8, 172u8, 143u8, + 33u8, 140u8, 99u8, 124u8, 208u8, 57u8, 232u8, 154u8, 110u8, + 32u8, 142u8, 24u8, 149u8, 109u8, 105u8, 30u8, 83u8, 39u8, + 177u8, 127u8, 160u8, 34u8, 70u8, + ] + { + let entry = ProposalCount; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Proposals that have been made."] pub async fn proposals( &self, _0: &::core::primitive::u32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::pallet_treasury::Proposal< @@ -11274,31 +16198,67 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = Proposals(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 46u8, 242u8, 203u8, 56u8, 166u8, 200u8, 95u8, 110u8, 47u8, + 71u8, 71u8, 45u8, 12u8, 93u8, 222u8, 120u8, 40u8, 130u8, + 29u8, 236u8, 189u8, 49u8, 115u8, 238u8, 135u8, 64u8, 252u8, + 171u8, 29u8, 229u8, 63u8, 31u8, + ] + { + let entry = Proposals(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Proposals that have been made."] pub async fn proposals_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Proposals<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 46u8, 242u8, 203u8, 56u8, 166u8, 200u8, 95u8, 110u8, 47u8, + 71u8, 71u8, 45u8, 12u8, 93u8, 222u8, 120u8, 40u8, 130u8, + 29u8, 236u8, 189u8, 49u8, 115u8, 238u8, 135u8, 64u8, 252u8, + 171u8, 29u8, 229u8, 63u8, 31u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Proposal indices that have been approved but not yet awarded."] pub async fn approvals( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< runtime_types::frame_support::storage::bounded_vec::BoundedVec< ::core::primitive::u32, >, ::subxt::BasicError, > { - let entry = Approvals; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 152u8, 185u8, 127u8, 54u8, 169u8, 155u8, 124u8, 22u8, 142u8, + 132u8, 254u8, 197u8, 162u8, 152u8, 15u8, 18u8, 192u8, 138u8, + 196u8, 231u8, 234u8, 178u8, 111u8, 181u8, 20u8, 131u8, 149u8, + 36u8, 222u8, 4u8, 119u8, 135u8, + ] + { + let entry = Approvals; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -11319,20 +16279,50 @@ pub mod api { runtime_types::sp_arithmetic::per_things::Permill, ::subxt::BasicError, > { - let pallet = self.client.metadata().pallet("Treasury")?; - let constant = pallet.constant("ProposalBond")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Treasury", "ProposalBond")? + == [ + 26u8, 148u8, 47u8, 190u8, 51u8, 71u8, 203u8, 119u8, 167u8, + 91u8, 70u8, 11u8, 149u8, 155u8, 138u8, 91u8, 119u8, 0u8, + 74u8, 83u8, 16u8, 47u8, 129u8, 11u8, 81u8, 169u8, 79u8, 31u8, + 161u8, 119u8, 2u8, 38u8, + ] + { + let pallet = self.client.metadata().pallet("Treasury")?; + let constant = pallet.constant("ProposalBond")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Minimum amount of funds that should be placed in a deposit for making a proposal."] pub fn proposal_bond_minimum( &self, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Treasury")?; - let constant = pallet.constant("ProposalBondMinimum")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Treasury", "ProposalBondMinimum")? + == [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, + 200u8, 214u8, 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, + 101u8, 54u8, 210u8, 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, + 15u8, 178u8, 98u8, 148u8, 156u8, + ] + { + let pallet = self.client.metadata().pallet("Treasury")?; + let constant = pallet.constant("ProposalBondMinimum")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Maximum amount of funds that should be placed in a deposit for making a proposal."] pub fn proposal_bond_maximum( @@ -11341,20 +16331,50 @@ pub mod api { ::core::option::Option<::core::primitive::u128>, ::subxt::BasicError, > { - let pallet = self.client.metadata().pallet("Treasury")?; - let constant = pallet.constant("ProposalBondMaximum")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Treasury", "ProposalBondMaximum")? + == [ + 84u8, 154u8, 218u8, 83u8, 84u8, 189u8, 32u8, 20u8, 120u8, + 194u8, 88u8, 205u8, 109u8, 216u8, 114u8, 193u8, 120u8, 198u8, + 154u8, 237u8, 134u8, 204u8, 102u8, 247u8, 52u8, 103u8, 231u8, + 43u8, 243u8, 122u8, 60u8, 216u8, + ] + { + let pallet = self.client.metadata().pallet("Treasury")?; + let constant = pallet.constant("ProposalBondMaximum")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Period between successive spends."] pub fn spend_period( &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Treasury")?; - let constant = pallet.constant("SpendPeriod")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Treasury", "SpendPeriod")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Treasury")?; + let constant = pallet.constant("SpendPeriod")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Percentage of spare funds (if any) that are burnt per spend period."] pub fn burn( @@ -11363,10 +16383,22 @@ pub mod api { runtime_types::sp_arithmetic::per_things::Permill, ::subxt::BasicError, > { - let pallet = self.client.metadata().pallet("Treasury")?; - let constant = pallet.constant("Burn")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self.client.metadata().constant_hash("Treasury", "Burn")? + == [ + 26u8, 148u8, 47u8, 190u8, 51u8, 71u8, 203u8, 119u8, 167u8, + 91u8, 70u8, 11u8, 149u8, 155u8, 138u8, 91u8, 119u8, 0u8, + 74u8, 83u8, 16u8, 47u8, 129u8, 11u8, 81u8, 169u8, 79u8, 31u8, + 161u8, 119u8, 2u8, 38u8, + ] + { + let pallet = self.client.metadata().pallet("Treasury")?; + let constant = pallet.constant("Burn")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The treasury's pallet id, used for deriving its sovereign account ID."] pub fn pallet_id( @@ -11375,10 +16407,25 @@ pub mod api { runtime_types::frame_support::PalletId, ::subxt::BasicError, > { - let pallet = self.client.metadata().pallet("Treasury")?; - let constant = pallet.constant("PalletId")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Treasury", "PalletId")? + == [ + 11u8, 72u8, 189u8, 18u8, 254u8, 229u8, 67u8, 29u8, 4u8, + 241u8, 192u8, 5u8, 210u8, 194u8, 124u8, 31u8, 19u8, 174u8, + 240u8, 245u8, 169u8, 141u8, 67u8, 251u8, 106u8, 103u8, 15u8, + 167u8, 107u8, 31u8, 121u8, 239u8, + ] + { + let pallet = self.client.metadata().pallet("Treasury")?; + let constant = pallet.constant("PalletId")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The maximum number of approvals that can wait in the spending queue."] #[doc = ""] @@ -11387,10 +16434,25 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Treasury")?; - let constant = pallet.constant("MaxApprovals")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Treasury", "MaxApprovals")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Treasury")?; + let constant = pallet.constant("MaxApprovals")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -11506,19 +16568,33 @@ pub mod api { &self, dest: ::subxt::sp_core::crypto::AccountId32, ethereum_signature : runtime_types :: polkadot_runtime_common :: claims :: EcdsaSignature, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Claim, - DispatchError, - root_mod::Event, - > { - let call = Claim { - dest, - ethereum_signature, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Claim, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 8u8, 205u8, 188u8, 57u8, 197u8, 203u8, 156u8, 65u8, 246u8, + 236u8, 199u8, 6u8, 152u8, 34u8, 251u8, 178u8, 206u8, 127u8, + 167u8, 59u8, 43u8, 162u8, 154u8, 89u8, 215u8, 192u8, 18u8, + 100u8, 66u8, 7u8, 97u8, 229u8, + ] + { + let call = Claim { + dest, + ethereum_signature, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Mint a new claim to collect DOTs."] #[doc = ""] @@ -11547,21 +16623,35 @@ pub mod api { statement: ::core::option::Option< runtime_types::polkadot_runtime_common::claims::StatementKind, >, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - MintClaim, - DispatchError, - root_mod::Event, - > { - let call = MintClaim { - who, - value, - vesting_schedule, - statement, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + MintClaim, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 10u8, 141u8, 200u8, 102u8, 21u8, 205u8, 178u8, 247u8, 154u8, + 245u8, 172u8, 178u8, 26u8, 249u8, 179u8, 236u8, 198u8, 4u8, + 183u8, 239u8, 39u8, 188u8, 146u8, 231u8, 244u8, 6u8, 31u8, + 180u8, 101u8, 157u8, 53u8, 59u8, + ] + { + let call = MintClaim { + who, + value, + vesting_schedule, + statement, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Make a claim to collect your DOTs by signing a statement."] #[doc = ""] @@ -11594,20 +16684,34 @@ pub mod api { dest: ::subxt::sp_core::crypto::AccountId32, ethereum_signature : runtime_types :: polkadot_runtime_common :: claims :: EcdsaSignature, statement: ::std::vec::Vec<::core::primitive::u8>, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ClaimAttest, - DispatchError, - root_mod::Event, - > { - let call = ClaimAttest { - dest, - ethereum_signature, - statement, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ClaimAttest, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 116u8, 181u8, 28u8, 215u8, 245u8, 86u8, 215u8, 114u8, 201u8, + 250u8, 168u8, 43u8, 91u8, 74u8, 0u8, 61u8, 40u8, 135u8, 6u8, + 241u8, 18u8, 24u8, 153u8, 152u8, 22u8, 165u8, 172u8, 94u8, + 200u8, 53u8, 92u8, 212u8, + ] + { + let call = ClaimAttest { + dest, + ethereum_signature, + statement, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Attest to a statement, needed to finalize the claims process."] #[doc = ""] @@ -11629,16 +16733,30 @@ pub mod api { pub fn attest( &self, statement: ::std::vec::Vec<::core::primitive::u8>, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Attest, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Attest, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = Attest { statement }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 7u8, 206u8, 87u8, 155u8, 225u8, 220u8, 145u8, 206u8, 87u8, + 132u8, 171u8, 67u8, 104u8, 91u8, 247u8, 39u8, 114u8, 156u8, + 185u8, 28u8, 194u8, 104u8, 32u8, 25u8, 50u8, 94u8, 249u8, + 196u8, 83u8, 36u8, 123u8, 106u8, + ] + { + let call = Attest { statement }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } pub fn move_claim( &self, @@ -11647,20 +16765,34 @@ pub mod api { maybe_preclaim: ::core::option::Option< ::subxt::sp_core::crypto::AccountId32, >, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - MoveClaim, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + MoveClaim, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = MoveClaim { - old, - new, - maybe_preclaim, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 7u8, 59u8, 57u8, 165u8, 149u8, 105u8, 40u8, 11u8, 62u8, + 212u8, 35u8, 185u8, 38u8, 244u8, 14u8, 170u8, 73u8, 160u8, + 100u8, 124u8, 20u8, 147u8, 12u8, 208u8, 124u8, 122u8, 148u8, + 12u8, 173u8, 61u8, 137u8, 20u8, + ] + { + let call = MoveClaim { + old, + new, + maybe_preclaim, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -11760,30 +16892,66 @@ pub mod api { pub async fn claims( &self, _0: &runtime_types::polkadot_runtime_common::claims::EthereumAddress, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<::core::primitive::u128>, ::subxt::BasicError, > { - let entry = Claims(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 66u8, 232u8, 109u8, 190u8, 15u8, 207u8, 114u8, 12u8, 91u8, + 228u8, 103u8, 37u8, 152u8, 245u8, 51u8, 121u8, 179u8, 228u8, + 187u8, 121u8, 141u8, 225u8, 122u8, 235u8, 201u8, 94u8, 207u8, + 50u8, 51u8, 166u8, 32u8, 119u8, + ] + { + let entry = Claims(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } pub async fn claims_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Claims<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 66u8, 232u8, 109u8, 190u8, 15u8, 207u8, 114u8, 12u8, 91u8, + 228u8, 103u8, 37u8, 152u8, 245u8, 51u8, 121u8, 179u8, 228u8, + 187u8, 121u8, 141u8, 225u8, 122u8, 235u8, 201u8, 94u8, 207u8, + 50u8, 51u8, 166u8, 32u8, 119u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } pub async fn total( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let entry = Total; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 162u8, 59u8, 237u8, 63u8, 23u8, 44u8, 74u8, 169u8, 131u8, + 166u8, 174u8, 61u8, 127u8, 165u8, 32u8, 115u8, 73u8, 171u8, + 36u8, 10u8, 6u8, 23u8, 19u8, 202u8, 3u8, 189u8, 29u8, 169u8, + 144u8, 187u8, 235u8, 77u8, + ] + { + let entry = Total; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Vesting schedule for a claim."] #[doc = " First balance is the total amount that should be held for vesting."] @@ -11792,7 +16960,7 @@ pub mod api { pub async fn vesting( &self, _0: &runtime_types::polkadot_runtime_common::claims::EthereumAddress, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<( ::core::primitive::u128, @@ -11801,8 +16969,19 @@ pub mod api { )>, ::subxt::BasicError, > { - let entry = Vesting(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 22u8, 177u8, 83u8, 172u8, 137u8, 213u8, 11u8, 74u8, 192u8, + 92u8, 96u8, 63u8, 139u8, 156u8, 62u8, 207u8, 47u8, 156u8, + 185u8, 145u8, 149u8, 112u8, 101u8, 17u8, 183u8, 4u8, 220u8, + 31u8, 56u8, 175u8, 97u8, 12u8, + ] + { + let entry = Vesting(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Vesting schedule for a claim."] #[doc = " First balance is the total amount that should be held for vesting."] @@ -11810,60 +16989,115 @@ pub mod api { #[doc = " The block number is when the vesting should start."] pub async fn vesting_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Vesting<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 22u8, 177u8, 83u8, 172u8, 137u8, 213u8, 11u8, 74u8, 192u8, + 92u8, 96u8, 63u8, 139u8, 156u8, 62u8, 207u8, 47u8, 156u8, + 185u8, 145u8, 149u8, 112u8, 101u8, 17u8, 183u8, 4u8, 220u8, + 31u8, 56u8, 175u8, 97u8, 12u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The statement kind that must be signed, if any."] pub async fn signing( &self, _0: &runtime_types::polkadot_runtime_common::claims::EthereumAddress, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::polkadot_runtime_common::claims::StatementKind, >, ::subxt::BasicError, > { - let entry = Signing(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 85u8, 167u8, 23u8, 218u8, 101u8, 189u8, 129u8, 64u8, 189u8, + 159u8, 108u8, 22u8, 234u8, 189u8, 122u8, 145u8, 225u8, 202u8, + 158u8, 244u8, 1u8, 19u8, 66u8, 78u8, 250u8, 208u8, 116u8, + 222u8, 118u8, 231u8, 45u8, 170u8, + ] + { + let entry = Signing(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The statement kind that must be signed, if any."] pub async fn signing_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Signing<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 85u8, 167u8, 23u8, 218u8, 101u8, 189u8, 129u8, 64u8, 189u8, + 159u8, 108u8, 22u8, 234u8, 189u8, 122u8, 145u8, 225u8, 202u8, + 158u8, 244u8, 1u8, 19u8, 66u8, 78u8, 250u8, 208u8, 116u8, + 222u8, 118u8, 231u8, 45u8, 170u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Pre-claimed Ethereum accounts, by the Account ID that they are claimed to."] pub async fn preclaims( &self, _0: &::subxt::sp_core::crypto::AccountId32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::polkadot_runtime_common::claims::EthereumAddress, >, ::subxt::BasicError, > { - let entry = Preclaims(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 174u8, 208u8, 119u8, 9u8, 98u8, 68u8, 27u8, 159u8, 132u8, + 22u8, 72u8, 80u8, 83u8, 147u8, 224u8, 241u8, 98u8, 143u8, + 219u8, 240u8, 199u8, 54u8, 36u8, 188u8, 187u8, 255u8, 12u8, + 163u8, 136u8, 53u8, 210u8, 206u8, + ] + { + let entry = Preclaims(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Pre-claimed Ethereum accounts, by the Account ID that they are claimed to."] pub async fn preclaims_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Preclaims<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 174u8, 208u8, 119u8, 9u8, 98u8, 68u8, 27u8, 159u8, 132u8, + 22u8, 72u8, 80u8, 83u8, 147u8, 224u8, 241u8, 98u8, 143u8, + 219u8, 240u8, 199u8, 54u8, 36u8, 188u8, 187u8, 255u8, 12u8, + 163u8, 136u8, 53u8, 210u8, 206u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -11882,10 +17116,22 @@ pub mod api { ::std::vec::Vec<::core::primitive::u8>, ::subxt::BasicError, > { - let pallet = self.client.metadata().pallet("Claims")?; - let constant = pallet.constant("Prefix")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self.client.metadata().constant_hash("Claims", "Prefix")? + == [ + 106u8, 50u8, 57u8, 116u8, 43u8, 202u8, 37u8, 248u8, 102u8, + 22u8, 62u8, 22u8, 242u8, 54u8, 152u8, 168u8, 107u8, 64u8, + 72u8, 172u8, 124u8, 40u8, 42u8, 110u8, 104u8, 145u8, 31u8, + 144u8, 242u8, 189u8, 145u8, 208u8, + ] + { + let pallet = self.client.metadata().pallet("Claims")?; + let constant = pallet.constant("Prefix")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -11991,16 +17237,30 @@ pub mod api { #[doc = "# "] pub fn vest( &self, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Vest, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Vest, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = Vest {}; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 123u8, 54u8, 10u8, 208u8, 154u8, 24u8, 39u8, 166u8, 64u8, + 27u8, 74u8, 29u8, 243u8, 97u8, 155u8, 5u8, 130u8, 155u8, + 65u8, 181u8, 196u8, 125u8, 45u8, 133u8, 25u8, 33u8, 3u8, + 34u8, 21u8, 167u8, 172u8, 54u8, + ] + { + let call = Vest {}; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Unlock any vested funds of a `target` account."] #[doc = ""] @@ -12023,16 +17283,30 @@ pub mod api { ::subxt::sp_core::crypto::AccountId32, (), >, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - VestOther, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + VestOther, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = VestOther { target }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 220u8, 214u8, 201u8, 84u8, 89u8, 137u8, 126u8, 80u8, 57u8, + 1u8, 178u8, 144u8, 1u8, 79u8, 232u8, 136u8, 62u8, 227u8, + 26u8, 148u8, 78u8, 92u8, 222u8, 210u8, 5u8, 108u8, 245u8, + 51u8, 208u8, 98u8, 184u8, 8u8, + ] + { + let call = VestOther { target }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Create a vested transfer."] #[doc = ""] @@ -12061,16 +17335,30 @@ pub mod api { ::core::primitive::u128, ::core::primitive::u32, >, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - VestedTransfer, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + VestedTransfer, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = VestedTransfer { target, schedule }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 117u8, 107u8, 28u8, 234u8, 240u8, 253u8, 122u8, 25u8, 134u8, + 41u8, 162u8, 36u8, 157u8, 82u8, 214u8, 174u8, 132u8, 24u8, + 241u8, 68u8, 126u8, 122u8, 162u8, 130u8, 62u8, 43u8, 145u8, + 90u8, 49u8, 200u8, 25u8, 137u8, + ] + { + let call = VestedTransfer { target, schedule }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Force a vested transfer."] #[doc = ""] @@ -12104,20 +17392,34 @@ pub mod api { ::core::primitive::u128, ::core::primitive::u32, >, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ForceVestedTransfer, - DispatchError, - root_mod::Event, - > { - let call = ForceVestedTransfer { - source, - target, - schedule, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ForceVestedTransfer, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 32u8, 195u8, 99u8, 57u8, 6u8, 182u8, 106u8, 47u8, 9u8, 19u8, + 255u8, 80u8, 244u8, 205u8, 129u8, 78u8, 6u8, 215u8, 224u8, + 151u8, 14u8, 219u8, 46u8, 11u8, 200u8, 160u8, 79u8, 193u8, + 49u8, 252u8, 180u8, 151u8, + ] + { + let call = ForceVestedTransfer { + source, + target, + schedule, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Merge two vesting schedules together, creating a new vesting schedule that unlocks over"] #[doc = "the highest possible start and end blocks. If both schedules have already started the"] @@ -12144,19 +17446,33 @@ pub mod api { &self, schedule1_index: ::core::primitive::u32, schedule2_index: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - MergeSchedules, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + MergeSchedules, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = MergeSchedules { - schedule1_index, - schedule2_index, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 185u8, 253u8, 214u8, 24u8, 208u8, 226u8, 0u8, 212u8, 92u8, + 174u8, 252u8, 44u8, 250u8, 96u8, 66u8, 55u8, 88u8, 252u8, + 152u8, 238u8, 186u8, 85u8, 45u8, 213u8, 49u8, 42u8, 50u8, + 127u8, 30u8, 53u8, 73u8, 7u8, + ] + { + let call = MergeSchedules { + schedule1_index, + schedule2_index, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -12224,7 +17540,7 @@ pub mod api { pub async fn vesting( &self, _0: &::subxt::sp_core::crypto::AccountId32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::frame_support::storage::bounded_vec::BoundedVec< @@ -12236,31 +17552,67 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = Vesting(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 237u8, 216u8, 145u8, 89u8, 52u8, 38u8, 126u8, 212u8, 173u8, + 3u8, 57u8, 156u8, 208u8, 160u8, 249u8, 177u8, 83u8, 140u8, + 178u8, 221u8, 106u8, 66u8, 171u8, 25u8, 230u8, 69u8, 78u8, + 223u8, 182u8, 156u8, 218u8, 206u8, + ] + { + let entry = Vesting(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Information regarding the vesting of a given account."] pub async fn vesting_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Vesting<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 237u8, 216u8, 145u8, 89u8, 52u8, 38u8, 126u8, 212u8, 173u8, + 3u8, 57u8, 156u8, 208u8, 160u8, 249u8, 177u8, 83u8, 140u8, + 178u8, 221u8, 106u8, 66u8, 171u8, 25u8, 230u8, 69u8, 78u8, + 223u8, 182u8, 156u8, 218u8, 206u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Storage version of the pallet."] #[doc = ""] #[doc = " New networks start with latest version, as determined by the genesis build."] pub async fn storage_version( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< runtime_types::pallet_vesting::Releases, ::subxt::BasicError, > { - let entry = StorageVersion; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 50u8, 143u8, 26u8, 88u8, 129u8, 31u8, 61u8, 118u8, 19u8, + 202u8, 119u8, 160u8, 34u8, 219u8, 60u8, 57u8, 189u8, 66u8, + 93u8, 239u8, 121u8, 114u8, 241u8, 116u8, 0u8, 122u8, 232u8, + 94u8, 189u8, 23u8, 45u8, 191u8, + ] + { + let entry = StorageVersion; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -12278,19 +17630,49 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Vesting")?; - let constant = pallet.constant("MinVestedTransfer")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Vesting", "MinVestedTransfer")? + == [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, + 200u8, 214u8, 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, + 101u8, 54u8, 210u8, 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, + 15u8, 178u8, 98u8, 148u8, 156u8, + ] + { + let pallet = self.client.metadata().pallet("Vesting")?; + let constant = pallet.constant("MinVestedTransfer")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } pub fn max_vesting_schedules( &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Vesting")?; - let constant = pallet.constant("MaxVestingSchedules")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Vesting", "MaxVestingSchedules")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Vesting")?; + let constant = pallet.constant("MaxVestingSchedules")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -12378,16 +17760,30 @@ pub mod api { pub fn batch( &self, calls: ::std::vec::Vec, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Batch, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Batch, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = Batch { calls }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 102u8, 106u8, 179u8, 188u8, 99u8, 111u8, 210u8, 69u8, 179u8, + 206u8, 207u8, 163u8, 116u8, 184u8, 55u8, 228u8, 157u8, 241u8, + 23u8, 78u8, 112u8, 158u8, 56u8, 192u8, 79u8, 222u8, 0u8, + 104u8, 21u8, 13u8, 54u8, 184u8, + ] + { + let call = Batch { calls }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Send a call through an indexed pseudonym of the sender."] #[doc = ""] @@ -12406,19 +17802,33 @@ pub mod api { &self, index: ::core::primitive::u16, call: runtime_types::polkadot_runtime::Call, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - AsDerivative, - DispatchError, - root_mod::Event, - > { - let call = AsDerivative { - index, - call: ::std::boxed::Box::new(call), - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + AsDerivative, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 195u8, 145u8, 176u8, 37u8, 226u8, 104u8, 213u8, 93u8, 246u8, + 7u8, 117u8, 101u8, 123u8, 125u8, 244u8, 74u8, 67u8, 118u8, + 106u8, 181u8, 172u8, 83u8, 17u8, 60u8, 133u8, 136u8, 219u8, + 67u8, 43u8, 93u8, 38u8, 89u8, + ] + { + let call = AsDerivative { + index, + call: ::std::boxed::Box::new(call), + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Send a batch of dispatch calls and atomically execute them."] #[doc = "The whole transaction will rollback and fail if any of the calls failed."] @@ -12437,16 +17847,30 @@ pub mod api { pub fn batch_all( &self, calls: ::std::vec::Vec, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - BatchAll, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + BatchAll, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = BatchAll { calls }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 199u8, 220u8, 25u8, 148u8, 69u8, 105u8, 234u8, 113u8, 221u8, + 220u8, 186u8, 34u8, 184u8, 101u8, 41u8, 87u8, 134u8, 92u8, + 134u8, 241u8, 44u8, 116u8, 95u8, 81u8, 174u8, 253u8, 214u8, + 191u8, 88u8, 24u8, 211u8, 135u8, + ] + { + let call = BatchAll { calls }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Dispatches a function call with a provided origin."] #[doc = ""] @@ -12462,19 +17886,33 @@ pub mod api { &self, as_origin: runtime_types::polkadot_runtime::OriginCaller, call: runtime_types::polkadot_runtime::Call, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - DispatchAs, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + DispatchAs, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = DispatchAs { - as_origin: ::std::boxed::Box::new(as_origin), - call: ::std::boxed::Box::new(call), - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 188u8, 19u8, 178u8, 56u8, 121u8, 41u8, 46u8, 232u8, 118u8, + 56u8, 66u8, 6u8, 174u8, 184u8, 92u8, 66u8, 178u8, 213u8, + 220u8, 88u8, 109u8, 223u8, 186u8, 2u8, 68u8, 152u8, 137u8, + 131u8, 191u8, 194u8, 221u8, 254u8, + ] + { + let call = DispatchAs { + as_origin: ::std::boxed::Box::new(as_origin), + call: ::std::boxed::Box::new(call), + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -12531,10 +17969,25 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Utility")?; - let constant = pallet.constant("batched_calls_limit")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Utility", "batched_calls_limit")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Utility")?; + let constant = pallet.constant("batched_calls_limit")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -12741,16 +18194,30 @@ pub mod api { pub fn add_registrar( &self, account: ::subxt::sp_core::crypto::AccountId32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - AddRegistrar, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + AddRegistrar, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = AddRegistrar { account }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 252u8, 233u8, 148u8, 186u8, 42u8, 127u8, 183u8, 107u8, 205u8, + 34u8, 63u8, 170u8, 82u8, 218u8, 141u8, 136u8, 174u8, 45u8, + 3u8, 226u8, 175u8, 22u8, 18u8, 120u8, 70u8, 4u8, 164u8, + 147u8, 228u8, 52u8, 199u8, 196u8, + ] + { + let call = AddRegistrar { account }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set an account's identity information and reserve the appropriate deposit."] #[doc = ""] @@ -12774,18 +18241,32 @@ pub mod api { pub fn set_identity( &self, info: runtime_types::pallet_identity::types::IdentityInfo, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetIdentity, - DispatchError, - root_mod::Event, - > { - let call = SetIdentity { - info: ::std::boxed::Box::new(info), - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetIdentity, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 174u8, 5u8, 84u8, 201u8, 219u8, 147u8, 45u8, 241u8, 46u8, + 192u8, 221u8, 20u8, 233u8, 128u8, 206u8, 1u8, 71u8, 244u8, + 153u8, 167u8, 150u8, 164u8, 16u8, 58u8, 51u8, 168u8, 58u8, + 184u8, 204u8, 229u8, 135u8, 91u8, + ] + { + let call = SetIdentity { + info: ::std::boxed::Box::new(info), + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set the sub-accounts of the sender."] #[doc = ""] @@ -12814,16 +18295,30 @@ pub mod api { ::subxt::sp_core::crypto::AccountId32, runtime_types::pallet_identity::types::Data, )>, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetSubs, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetSubs, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetSubs { subs }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 157u8, 141u8, 52u8, 45u8, 109u8, 252u8, 84u8, 0u8, 38u8, + 209u8, 193u8, 212u8, 177u8, 47u8, 219u8, 132u8, 254u8, 234u8, + 43u8, 200u8, 104u8, 149u8, 250u8, 169u8, 119u8, 208u8, 111u8, + 184u8, 70u8, 161u8, 245u8, 33u8, + ] + { + let call = SetSubs { subs }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Clear an account's identity info and all sub-accounts and return all deposits."] #[doc = ""] @@ -12845,16 +18340,30 @@ pub mod api { #[doc = "# "] pub fn clear_identity( &self, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ClearIdentity, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ClearIdentity, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ClearIdentity {}; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 75u8, 44u8, 74u8, 122u8, 149u8, 202u8, 114u8, 230u8, 0u8, + 255u8, 140u8, 122u8, 14u8, 196u8, 205u8, 249u8, 220u8, 94u8, + 216u8, 34u8, 63u8, 14u8, 8u8, 205u8, 74u8, 23u8, 181u8, + 129u8, 252u8, 110u8, 231u8, 114u8, + ] + { + let call = ClearIdentity {}; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Request a judgement from a registrar."] #[doc = ""] @@ -12883,16 +18392,30 @@ pub mod api { &self, reg_index: ::core::primitive::u32, max_fee: ::core::primitive::u128, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - RequestJudgement, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + RequestJudgement, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = RequestJudgement { reg_index, max_fee }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 90u8, 137u8, 162u8, 2u8, 124u8, 245u8, 7u8, 200u8, 235u8, + 138u8, 217u8, 247u8, 77u8, 87u8, 152u8, 2u8, 13u8, 175u8, + 106u8, 202u8, 204u8, 113u8, 24u8, 127u8, 105u8, 136u8, 191u8, + 133u8, 212u8, 138u8, 22u8, 173u8, + ] + { + let call = RequestJudgement { reg_index, max_fee }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Cancel a previous request."] #[doc = ""] @@ -12914,16 +18437,30 @@ pub mod api { pub fn cancel_request( &self, reg_index: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - CancelRequest, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + CancelRequest, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = CancelRequest { reg_index }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 153u8, 44u8, 7u8, 70u8, 91u8, 44u8, 138u8, 219u8, 118u8, + 67u8, 166u8, 133u8, 90u8, 234u8, 248u8, 42u8, 108u8, 51u8, + 229u8, 196u8, 74u8, 167u8, 40u8, 229u8, 168u8, 159u8, 2u8, + 231u8, 236u8, 58u8, 109u8, 32u8, + ] + { + let call = CancelRequest { reg_index }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set the fee required for a judgement to be requested from a registrar."] #[doc = ""] @@ -12942,16 +18479,30 @@ pub mod api { &self, index: ::core::primitive::u32, fee: ::core::primitive::u128, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetFee, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetFee, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetFee { index, fee }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 222u8, 115u8, 155u8, 44u8, 68u8, 179u8, 201u8, 247u8, 141u8, + 226u8, 124u8, 20u8, 188u8, 47u8, 190u8, 21u8, 212u8, 192u8, + 213u8, 76u8, 241u8, 75u8, 87u8, 142u8, 157u8, 229u8, 136u8, + 254u8, 250u8, 28u8, 69u8, 218u8, + ] + { + let call = SetFee { index, fee }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Change the account associated with a registrar."] #[doc = ""] @@ -12970,16 +18521,30 @@ pub mod api { &self, index: ::core::primitive::u32, new: ::subxt::sp_core::crypto::AccountId32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetAccountId, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetAccountId, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetAccountId { index, new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 191u8, 243u8, 30u8, 116u8, 109u8, 235u8, 23u8, 106u8, 24u8, + 23u8, 80u8, 203u8, 68u8, 40u8, 116u8, 38u8, 68u8, 161u8, + 219u8, 64u8, 249u8, 179u8, 203u8, 113u8, 55u8, 7u8, 180u8, + 161u8, 37u8, 66u8, 6u8, 90u8, + ] + { + let call = SetAccountId { index, new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set the field information for a registrar."] #[doc = ""] @@ -13000,16 +18565,30 @@ pub mod api { fields: runtime_types::pallet_identity::types::BitFlags< runtime_types::pallet_identity::types::IdentityField, >, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetFields, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetFields, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetFields { index, fields }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 253u8, 43u8, 154u8, 17u8, 161u8, 187u8, 72u8, 96u8, 20u8, + 240u8, 97u8, 43u8, 242u8, 79u8, 115u8, 38u8, 130u8, 243u8, + 176u8, 46u8, 16u8, 126u8, 191u8, 32u8, 106u8, 200u8, 134u8, + 72u8, 244u8, 189u8, 165u8, 125u8, + ] + { + let call = SetFields { index, fields }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Provide a judgement for an account's identity."] #[doc = ""] @@ -13040,20 +18619,34 @@ pub mod api { judgement: runtime_types::pallet_identity::types::Judgement< ::core::primitive::u128, >, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ProvideJudgement, - DispatchError, - root_mod::Event, - > { - let call = ProvideJudgement { - reg_index, - target, - judgement, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ProvideJudgement, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 238u8, 210u8, 71u8, 239u8, 251u8, 52u8, 145u8, 71u8, 68u8, + 185u8, 103u8, 82u8, 21u8, 164u8, 128u8, 189u8, 123u8, 141u8, + 213u8, 77u8, 139u8, 10u8, 6u8, 229u8, 227u8, 58u8, 236u8, + 123u8, 139u8, 192u8, 200u8, 170u8, + ] + { + let call = ProvideJudgement { + reg_index, + target, + judgement, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Remove an account's identity and sub-account information and slash the deposits."] #[doc = ""] @@ -13080,16 +18673,30 @@ pub mod api { ::subxt::sp_core::crypto::AccountId32, (), >, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - KillIdentity, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + KillIdentity, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = KillIdentity { target }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 91u8, 164u8, 242u8, 44u8, 253u8, 203u8, 102u8, 89u8, 218u8, + 150u8, 227u8, 56u8, 179u8, 135u8, 93u8, 107u8, 166u8, 157u8, + 187u8, 180u8, 215u8, 129u8, 56u8, 110u8, 5u8, 243u8, 219u8, + 205u8, 11u8, 229u8, 29u8, 188u8, + ] + { + let call = KillIdentity { target }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Add the given account to the sender's subs."] #[doc = ""] @@ -13105,16 +18712,30 @@ pub mod api { (), >, data: runtime_types::pallet_identity::types::Data, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - AddSub, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + AddSub, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = AddSub { sub, data }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 105u8, 38u8, 167u8, 99u8, 224u8, 183u8, 88u8, 133u8, 180u8, + 78u8, 211u8, 239u8, 49u8, 128u8, 224u8, 61u8, 23u8, 249u8, + 91u8, 16u8, 216u8, 40u8, 240u8, 77u8, 209u8, 91u8, 174u8, + 211u8, 175u8, 238u8, 131u8, 208u8, + ] + { + let call = AddSub { sub, data }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Alter the associated name of the given sub-account."] #[doc = ""] @@ -13127,16 +18748,30 @@ pub mod api { (), >, data: runtime_types::pallet_identity::types::Data, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - RenameSub, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + RenameSub, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = RenameSub { sub, data }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 17u8, 110u8, 213u8, 124u8, 4u8, 76u8, 182u8, 53u8, 102u8, + 224u8, 240u8, 250u8, 94u8, 96u8, 181u8, 107u8, 114u8, 127u8, + 37u8, 15u8, 95u8, 7u8, 238u8, 172u8, 30u8, 125u8, 70u8, 7u8, + 97u8, 182u8, 3u8, 197u8, + ] + { + let call = RenameSub { sub, data }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Remove the given account from the sender's subs."] #[doc = ""] @@ -13151,16 +18786,30 @@ pub mod api { ::subxt::sp_core::crypto::AccountId32, (), >, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - RemoveSub, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + RemoveSub, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = RemoveSub { sub }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 161u8, 114u8, 68u8, 57u8, 166u8, 240u8, 150u8, 95u8, 176u8, + 93u8, 62u8, 67u8, 185u8, 226u8, 117u8, 97u8, 119u8, 139u8, + 86u8, 52u8, 161u8, 88u8, 30u8, 20u8, 123u8, 20u8, 130u8, + 17u8, 44u8, 17u8, 47u8, 14u8, + ] + { + let call = RemoveSub { sub }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Remove the sender as a sub-account."] #[doc = ""] @@ -13174,16 +18823,30 @@ pub mod api { #[doc = "controller of an account is maliciously registered as a sub-account."] pub fn quit_sub( &self, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - QuitSub, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + QuitSub, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = QuitSub {}; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 62u8, 57u8, 73u8, 72u8, 119u8, 216u8, 250u8, 155u8, 57u8, + 169u8, 157u8, 44u8, 87u8, 51u8, 63u8, 231u8, 77u8, 7u8, 0u8, + 119u8, 244u8, 42u8, 179u8, 51u8, 254u8, 240u8, 55u8, 25u8, + 142u8, 38u8, 87u8, 44u8, + ] + { + let call = QuitSub {}; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -13376,7 +19039,7 @@ pub mod api { pub async fn identity_of( &self, _0: &::subxt::sp_core::crypto::AccountId32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::pallet_identity::types::Registration< @@ -13385,27 +19048,49 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = IdentityOf(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 225u8, 101u8, 83u8, 137u8, 207u8, 77u8, 139u8, 227u8, 36u8, + 100u8, 14u8, 30u8, 197u8, 65u8, 248u8, 227u8, 175u8, 19u8, + 189u8, 86u8, 189u8, 244u8, 144u8, 137u8, 17u8, 249u8, 223u8, + 200u8, 115u8, 190u8, 225u8, 30u8, + ] + { + let entry = IdentityOf(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Information that is pertinent to identify the entity behind an account."] #[doc = ""] #[doc = " TWOX-NOTE: OK ― `AccountId` is a secure hash."] pub async fn identity_of_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, IdentityOf<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 225u8, 101u8, 83u8, 137u8, 207u8, 77u8, 139u8, 227u8, 36u8, + 100u8, 14u8, 30u8, 197u8, 65u8, 248u8, 227u8, 175u8, 19u8, + 189u8, 86u8, 189u8, 244u8, 144u8, 137u8, 17u8, 249u8, 223u8, + 200u8, 115u8, 190u8, 225u8, 30u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The super-identity of an alternative \"sub\" identity together with its name, within that"] #[doc = " context. If the account is not some other account's sub-identity, then just `None`."] pub async fn super_of( &self, _0: &::subxt::sp_core::crypto::AccountId32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<( ::subxt::sp_core::crypto::AccountId32, @@ -13413,19 +19098,41 @@ pub mod api { )>, ::subxt::BasicError, > { - let entry = SuperOf(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 128u8, 234u8, 82u8, 152u8, 41u8, 4u8, 220u8, 41u8, 179u8, + 131u8, 72u8, 121u8, 131u8, 17u8, 40u8, 87u8, 186u8, 159u8, + 209u8, 33u8, 97u8, 28u8, 236u8, 196u8, 217u8, 15u8, 126u8, + 197u8, 32u8, 165u8, 78u8, 28u8, + ] + { + let entry = SuperOf(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The super-identity of an alternative \"sub\" identity together with its name, within that"] #[doc = " context. If the account is not some other account's sub-identity, then just `None`."] pub async fn super_of_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, SuperOf<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 128u8, 234u8, 82u8, 152u8, 41u8, 4u8, 220u8, 41u8, 179u8, + 131u8, 72u8, 121u8, 131u8, 17u8, 40u8, 87u8, 186u8, 159u8, + 209u8, 33u8, 97u8, 28u8, 236u8, 196u8, 217u8, 15u8, 126u8, + 197u8, 32u8, 165u8, 78u8, 28u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Alternative \"sub\" identities of this account."] #[doc = ""] @@ -13435,7 +19142,7 @@ pub mod api { pub async fn subs_of( &self, _0: &::subxt::sp_core::crypto::AccountId32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ( ::core::primitive::u128, @@ -13445,8 +19152,22 @@ pub mod api { ), ::subxt::BasicError, > { - let entry = SubsOf(_0); - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 136u8, 240u8, 238u8, 121u8, 194u8, 242u8, 139u8, 155u8, 32u8, + 201u8, 123u8, 76u8, 116u8, 219u8, 193u8, 45u8, 251u8, 212u8, + 46u8, 194u8, 93u8, 30u8, 174u8, 133u8, 218u8, 147u8, 175u8, + 38u8, 200u8, 109u8, 104u8, 52u8, + ] + { + let entry = SubsOf(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Alternative \"sub\" identities of this account."] #[doc = ""] @@ -13455,12 +19176,23 @@ pub mod api { #[doc = " TWOX-NOTE: OK ― `AccountId` is a secure hash."] pub async fn subs_of_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, SubsOf<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 136u8, 240u8, 238u8, 121u8, 194u8, 242u8, 139u8, 155u8, 32u8, + 201u8, 123u8, 76u8, 116u8, 219u8, 193u8, 45u8, 251u8, 212u8, + 46u8, 194u8, 93u8, 30u8, 174u8, 133u8, 218u8, 147u8, 175u8, + 38u8, 200u8, 109u8, 104u8, 52u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The set of registrars. Not expected to get very big as can only be added through a"] #[doc = " special origin (likely a council motion)."] @@ -13468,7 +19200,7 @@ pub mod api { #[doc = " The index into this can be cast to `RegistrarIndex` to get a valid value."] pub async fn registrars( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< runtime_types::frame_support::storage::bounded_vec::BoundedVec< ::core::option::Option< @@ -13480,8 +19212,22 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = Registrars; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 92u8, 161u8, 80u8, 77u8, 121u8, 65u8, 69u8, 26u8, 171u8, + 158u8, 66u8, 36u8, 81u8, 1u8, 79u8, 144u8, 188u8, 236u8, + 88u8, 158u8, 84u8, 100u8, 71u8, 86u8, 20u8, 68u8, 178u8, + 164u8, 157u8, 105u8, 58u8, 7u8, + ] + { + let entry = Registrars; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -13499,20 +19245,50 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Identity")?; - let constant = pallet.constant("BasicDeposit")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Identity", "BasicDeposit")? + == [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, + 200u8, 214u8, 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, + 101u8, 54u8, 210u8, 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, + 15u8, 178u8, 98u8, 148u8, 156u8, + ] + { + let pallet = self.client.metadata().pallet("Identity")?; + let constant = pallet.constant("BasicDeposit")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The amount held on deposit per additional field for a registered identity."] pub fn field_deposit( &self, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Identity")?; - let constant = pallet.constant("FieldDeposit")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Identity", "FieldDeposit")? + == [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, + 200u8, 214u8, 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, + 101u8, 54u8, 210u8, 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, + 15u8, 178u8, 98u8, 148u8, 156u8, + ] + { + let pallet = self.client.metadata().pallet("Identity")?; + let constant = pallet.constant("FieldDeposit")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The amount held on deposit for a registered subaccount. This should account for the fact"] #[doc = " that one storage item's value will increase by the size of an account ID, and there will"] @@ -13521,20 +19297,50 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Identity")?; - let constant = pallet.constant("SubAccountDeposit")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Identity", "SubAccountDeposit")? + == [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, + 200u8, 214u8, 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, + 101u8, 54u8, 210u8, 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, + 15u8, 178u8, 98u8, 148u8, 156u8, + ] + { + let pallet = self.client.metadata().pallet("Identity")?; + let constant = pallet.constant("SubAccountDeposit")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The maximum number of sub-accounts allowed per identified account."] pub fn max_sub_accounts( &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Identity")?; - let constant = pallet.constant("MaxSubAccounts")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Identity", "MaxSubAccounts")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Identity")?; + let constant = pallet.constant("MaxSubAccounts")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Maximum number of additional fields that may be stored in an ID. Needed to bound the I/O"] #[doc = " required to access an identity, but can be pretty high."] @@ -13542,10 +19348,25 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Identity")?; - let constant = pallet.constant("MaxAdditionalFields")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Identity", "MaxAdditionalFields")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Identity")?; + let constant = pallet.constant("MaxAdditionalFields")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Maxmimum number of registrars allowed in the system. Needed to bound the complexity"] #[doc = " of, e.g., updating judgements."] @@ -13553,10 +19374,25 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Identity")?; - let constant = pallet.constant("MaxRegistrars")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Identity", "MaxRegistrars")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Identity")?; + let constant = pallet.constant("MaxRegistrars")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -13709,20 +19545,34 @@ pub mod api { runtime_types::polkadot_runtime::ProxyType, >, call: runtime_types::polkadot_runtime::Call, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Proxy, - DispatchError, - root_mod::Event, - > { - let call = Proxy { - real, - force_proxy_type, - call: ::std::boxed::Box::new(call), - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Proxy, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 182u8, 110u8, 37u8, 47u8, 200u8, 93u8, 71u8, 195u8, 61u8, + 58u8, 197u8, 39u8, 17u8, 203u8, 192u8, 222u8, 55u8, 103u8, + 91u8, 226u8, 255u8, 253u8, 20u8, 71u8, 59u8, 53u8, 11u8, + 193u8, 239u8, 216u8, 100u8, 47u8, + ] + { + let call = Proxy { + real, + force_proxy_type, + call: ::std::boxed::Box::new(call), + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Register a proxy account for the sender that is able to make calls on its behalf."] #[doc = ""] @@ -13742,20 +19592,34 @@ pub mod api { delegate: ::subxt::sp_core::crypto::AccountId32, proxy_type: runtime_types::polkadot_runtime::ProxyType, delay: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - AddProxy, - DispatchError, - root_mod::Event, - > { - let call = AddProxy { - delegate, - proxy_type, - delay, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + AddProxy, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 97u8, 149u8, 34u8, 218u8, 51u8, 242u8, 47u8, 167u8, 203u8, + 128u8, 248u8, 193u8, 156u8, 141u8, 184u8, 221u8, 209u8, 79u8, + 162u8, 36u8, 48u8, 110u8, 208u8, 62u8, 105u8, 117u8, 192u8, + 18u8, 37u8, 185u8, 136u8, 66u8, + ] + { + let call = AddProxy { + delegate, + proxy_type, + delay, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Unregister a proxy account for the sender."] #[doc = ""] @@ -13773,20 +19637,34 @@ pub mod api { delegate: ::subxt::sp_core::crypto::AccountId32, proxy_type: runtime_types::polkadot_runtime::ProxyType, delay: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - RemoveProxy, - DispatchError, - root_mod::Event, - > { - let call = RemoveProxy { - delegate, - proxy_type, - delay, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + RemoveProxy, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 246u8, 251u8, 192u8, 17u8, 128u8, 248u8, 24u8, 118u8, 127u8, + 101u8, 140u8, 72u8, 248u8, 161u8, 187u8, 89u8, 193u8, 44u8, + 0u8, 86u8, 16u8, 116u8, 28u8, 227u8, 108u8, 120u8, 177u8, + 213u8, 218u8, 20u8, 196u8, 7u8, + ] + { + let call = RemoveProxy { + delegate, + proxy_type, + delay, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Unregister all proxy accounts for the sender."] #[doc = ""] @@ -13800,16 +19678,30 @@ pub mod api { #[doc = "# "] pub fn remove_proxies( &self, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - RemoveProxies, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + RemoveProxies, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = RemoveProxies {}; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 15u8, 237u8, 27u8, 166u8, 254u8, 218u8, 92u8, 5u8, 213u8, + 239u8, 99u8, 59u8, 1u8, 26u8, 73u8, 252u8, 81u8, 94u8, 214u8, + 227u8, 169u8, 58u8, 40u8, 253u8, 187u8, 225u8, 192u8, 26u8, + 19u8, 23u8, 121u8, 129u8, + ] + { + let call = RemoveProxies {}; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Spawn a fresh new account that is guaranteed to be otherwise inaccessible, and"] #[doc = "initialize it with a proxy of `proxy_type` for `origin` sender."] @@ -13839,20 +19731,34 @@ pub mod api { proxy_type: runtime_types::polkadot_runtime::ProxyType, delay: ::core::primitive::u32, index: ::core::primitive::u16, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Anonymous, - DispatchError, - root_mod::Event, - > { - let call = Anonymous { - proxy_type, - delay, - index, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Anonymous, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 159u8, 186u8, 126u8, 58u8, 255u8, 163u8, 207u8, 66u8, 165u8, + 182u8, 248u8, 28u8, 134u8, 186u8, 1u8, 122u8, 40u8, 64u8, + 0u8, 124u8, 0u8, 5u8, 140u8, 131u8, 21u8, 66u8, 182u8, 216u8, + 202u8, 29u8, 75u8, 180u8, + ] + { + let call = Anonymous { + proxy_type, + delay, + index, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Removes a previously spawned anonymous proxy."] #[doc = ""] @@ -13881,22 +19787,36 @@ pub mod api { index: ::core::primitive::u16, height: ::core::primitive::u32, ext_index: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - KillAnonymous, - DispatchError, - root_mod::Event, - > { - let call = KillAnonymous { - spawner, - proxy_type, - index, - height, - ext_index, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + KillAnonymous, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 59u8, 188u8, 45u8, 180u8, 9u8, 242u8, 36u8, 245u8, 25u8, + 57u8, 66u8, 216u8, 82u8, 220u8, 144u8, 233u8, 83u8, 1u8, + 182u8, 185u8, 27u8, 106u8, 33u8, 5u8, 22u8, 171u8, 222u8, + 130u8, 125u8, 73u8, 127u8, 156u8, + ] + { + let call = KillAnonymous { + spawner, + proxy_type, + index, + height, + ext_index, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Publish the hash of a proxy-call that will be made in the future."] #[doc = ""] @@ -13923,16 +19843,30 @@ pub mod api { &self, real: ::subxt::sp_core::crypto::AccountId32, call_hash: ::subxt::sp_core::H256, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Announce, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Announce, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = Announce { real, call_hash }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 102u8, 8u8, 136u8, 179u8, 13u8, 47u8, 158u8, 24u8, 93u8, + 196u8, 52u8, 22u8, 118u8, 98u8, 17u8, 8u8, 12u8, 51u8, 181u8, + 75u8, 215u8, 133u8, 201u8, 180u8, 231u8, 122u8, 198u8, 190u8, + 188u8, 127u8, 228u8, 218u8, + ] + { + let call = Announce { real, call_hash }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Remove a given announcement."] #[doc = ""] @@ -13954,16 +19888,30 @@ pub mod api { &self, real: ::subxt::sp_core::crypto::AccountId32, call_hash: ::subxt::sp_core::H256, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - RemoveAnnouncement, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + RemoveAnnouncement, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = RemoveAnnouncement { real, call_hash }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 209u8, 156u8, 215u8, 188u8, 225u8, 230u8, 171u8, 228u8, + 241u8, 105u8, 43u8, 183u8, 234u8, 18u8, 170u8, 239u8, 232u8, + 188u8, 37u8, 84u8, 156u8, 50u8, 241u8, 170u8, 9u8, 148u8, + 185u8, 172u8, 204u8, 63u8, 187u8, 253u8, + ] + { + let call = RemoveAnnouncement { real, call_hash }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Remove the given announcement of a delegate."] #[doc = ""] @@ -13985,19 +19933,33 @@ pub mod api { &self, delegate: ::subxt::sp_core::crypto::AccountId32, call_hash: ::subxt::sp_core::H256, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - RejectAnnouncement, - DispatchError, - root_mod::Event, - > { - let call = RejectAnnouncement { - delegate, - call_hash, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + RejectAnnouncement, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 26u8, 67u8, 197u8, 169u8, 243u8, 11u8, 94u8, 153u8, 50u8, + 22u8, 176u8, 103u8, 88u8, 2u8, 13u8, 10u8, 96u8, 7u8, 121u8, + 148u8, 13u8, 96u8, 20u8, 67u8, 76u8, 51u8, 81u8, 54u8, 244u8, + 44u8, 94u8, 52u8, + ] + { + let call = RejectAnnouncement { + delegate, + call_hash, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Dispatch the given `call` from an account that the sender is authorized for through"] #[doc = "`add_proxy`."] @@ -14024,21 +19986,35 @@ pub mod api { runtime_types::polkadot_runtime::ProxyType, >, call: runtime_types::polkadot_runtime::Call, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ProxyAnnounced, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ProxyAnnounced, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ProxyAnnounced { - delegate, - real, - force_proxy_type, - call: ::std::boxed::Box::new(call), - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 4u8, 205u8, 80u8, 128u8, 70u8, 110u8, 11u8, 69u8, 145u8, + 61u8, 218u8, 229u8, 208u8, 105u8, 190u8, 234u8, 189u8, 169u8, + 188u8, 10u8, 142u8, 144u8, 23u8, 200u8, 215u8, 180u8, 128u8, + 37u8, 95u8, 163u8, 205u8, 87u8, + ] + { + let call = ProxyAnnounced { + delegate, + real, + force_proxy_type, + call: ::std::boxed::Box::new(call), + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -14160,7 +20136,7 @@ pub mod api { pub async fn proxies( &self, _0: &::subxt::sp_core::crypto::AccountId32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ( runtime_types::frame_support::storage::bounded_vec::BoundedVec< @@ -14174,25 +20150,50 @@ pub mod api { ), ::subxt::BasicError, > { - let entry = Proxies(_0); - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 252u8, 154u8, 187u8, 5u8, 19u8, 254u8, 127u8, 64u8, 214u8, + 133u8, 33u8, 95u8, 47u8, 5u8, 39u8, 107u8, 27u8, 117u8, + 238u8, 14u8, 44u8, 74u8, 154u8, 158u8, 71u8, 88u8, 167u8, + 75u8, 112u8, 229u8, 107u8, 145u8, + ] + { + let entry = Proxies(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The set of account proxies. Maps the account which has delegated to the accounts"] #[doc = " which are being delegated to, together with the amount held on deposit."] pub async fn proxies_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Proxies<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 252u8, 154u8, 187u8, 5u8, 19u8, 254u8, 127u8, 64u8, 214u8, + 133u8, 33u8, 95u8, 47u8, 5u8, 39u8, 107u8, 27u8, 117u8, + 238u8, 14u8, 44u8, 74u8, 154u8, 158u8, 71u8, 88u8, 167u8, + 75u8, 112u8, 229u8, 107u8, 145u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The announcements made by the proxy (key)."] pub async fn announcements( &self, _0: &::subxt::sp_core::crypto::AccountId32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ( runtime_types::frame_support::storage::bounded_vec::BoundedVec< @@ -14206,18 +20207,43 @@ pub mod api { ), ::subxt::BasicError, > { - let entry = Announcements(_0); - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 247u8, 243u8, 109u8, 142u8, 99u8, 156u8, 61u8, 101u8, 200u8, + 211u8, 158u8, 60u8, 159u8, 232u8, 147u8, 125u8, 139u8, 150u8, + 4u8, 129u8, 189u8, 117u8, 74u8, 32u8, 85u8, 39u8, 46u8, 47u8, + 164u8, 130u8, 254u8, 43u8, + ] + { + let entry = Announcements(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The announcements made by the proxy (key)."] pub async fn announcements_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Announcements<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 247u8, 243u8, 109u8, 142u8, 99u8, 156u8, 61u8, 101u8, 200u8, + 211u8, 158u8, 60u8, 159u8, 232u8, 147u8, 125u8, 139u8, 150u8, + 4u8, 129u8, 189u8, 117u8, 74u8, 32u8, 85u8, 39u8, 46u8, 47u8, + 164u8, 130u8, 254u8, 43u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -14238,10 +20264,25 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Proxy")?; - let constant = pallet.constant("ProxyDepositBase")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Proxy", "ProxyDepositBase")? + == [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, + 200u8, 214u8, 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, + 101u8, 54u8, 210u8, 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, + 15u8, 178u8, 98u8, 148u8, 156u8, + ] + { + let pallet = self.client.metadata().pallet("Proxy")?; + let constant = pallet.constant("ProxyDepositBase")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The amount of currency needed per proxy added."] #[doc = ""] @@ -14252,31 +20293,76 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Proxy")?; - let constant = pallet.constant("ProxyDepositFactor")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Proxy", "ProxyDepositFactor")? + == [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, + 200u8, 214u8, 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, + 101u8, 54u8, 210u8, 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, + 15u8, 178u8, 98u8, 148u8, 156u8, + ] + { + let pallet = self.client.metadata().pallet("Proxy")?; + let constant = pallet.constant("ProxyDepositFactor")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The maximum amount of proxies allowed for a single account."] pub fn max_proxies( &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Proxy")?; - let constant = pallet.constant("MaxProxies")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Proxy", "MaxProxies")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Proxy")?; + let constant = pallet.constant("MaxProxies")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The maximum amount of time-delayed announcements that are allowed to be pending."] pub fn max_pending( &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Proxy")?; - let constant = pallet.constant("MaxPending")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) - } + if self + .client + .metadata() + .constant_hash("Proxy", "MaxPending")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Proxy")?; + let constant = pallet.constant("MaxPending")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } + } #[doc = " The base amount of currency needed to reserve for creating an announcement."] #[doc = ""] #[doc = " This is held when a new storage item holding a `Balance` is created (typically 16"] @@ -14285,10 +20371,25 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Proxy")?; - let constant = pallet.constant("AnnouncementDepositBase")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Proxy", "AnnouncementDepositBase")? + == [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, + 200u8, 214u8, 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, + 101u8, 54u8, 210u8, 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, + 15u8, 178u8, 98u8, 148u8, 156u8, + ] + { + let pallet = self.client.metadata().pallet("Proxy")?; + let constant = pallet.constant("AnnouncementDepositBase")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The amount of currency needed per announcement made."] #[doc = ""] @@ -14298,10 +20399,25 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Proxy")?; - let constant = pallet.constant("AnnouncementDepositFactor")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Proxy", "AnnouncementDepositFactor")? + == [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, + 200u8, 214u8, 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, + 101u8, 54u8, 210u8, 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, + 15u8, 178u8, 98u8, 148u8, 156u8, + ] + { + let pallet = self.client.metadata().pallet("Proxy")?; + let constant = pallet.constant("AnnouncementDepositFactor")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -14325,7 +20441,7 @@ pub mod api { } impl ::subxt::Call for AsMultiThreshold1 { const PALLET: &'static str = "Multisig"; - const FUNCTION: &'static str = "as_multi_threshold1"; + const FUNCTION: &'static str = "as_multi_threshold_1"; } #[derive(:: subxt :: codec :: Encode, :: subxt :: codec :: Decode, Debug)] pub struct AsMulti { @@ -14403,25 +20519,39 @@ pub mod api { #[doc = "- DB Weight: None"] #[doc = "- Plus Call Weight"] #[doc = "# "] - pub fn as_multi_threshold1( + pub fn as_multi_threshold_1( &self, other_signatories: ::std::vec::Vec< ::subxt::sp_core::crypto::AccountId32, >, call: runtime_types::polkadot_runtime::Call, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - AsMultiThreshold1, - DispatchError, - root_mod::Event, - > { - let call = AsMultiThreshold1 { - other_signatories, - call: ::std::boxed::Box::new(call), - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + AsMultiThreshold1, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 95u8, 132u8, 202u8, 110u8, 113u8, 89u8, 78u8, 7u8, 190u8, + 143u8, 107u8, 158u8, 56u8, 3u8, 41u8, 167u8, 115u8, 34u8, + 214u8, 63u8, 135u8, 154u8, 60u8, 181u8, 71u8, 157u8, 189u8, + 37u8, 215u8, 212u8, 66u8, 186u8, + ] + { + let call = AsMultiThreshold1 { + other_signatories, + call: ::std::boxed::Box::new(call), + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Register approval for a dispatch to be made from a deterministic composite account if"] #[doc = "approved by a total of `threshold - 1` of `other_signatories`."] @@ -14482,23 +20612,37 @@ pub mod api { >, store_call: ::core::primitive::bool, max_weight: ::core::primitive::u64, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - AsMulti, - DispatchError, - root_mod::Event, - > { - let call = AsMulti { - threshold, - other_signatories, - maybe_timepoint, - call, - store_call, - max_weight, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + AsMulti, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 248u8, 250u8, 144u8, 85u8, 79u8, 224u8, 92u8, 55u8, 76u8, + 55u8, 171u8, 48u8, 122u8, 6u8, 62u8, 155u8, 69u8, 41u8, + 121u8, 233u8, 40u8, 29u8, 224u8, 61u8, 245u8, 80u8, 50u8, + 30u8, 185u8, 92u8, 250u8, 160u8, + ] + { + let call = AsMulti { + threshold, + other_signatories, + maybe_timepoint, + call, + store_call, + max_weight, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Register approval for a dispatch to be made from a deterministic composite account if"] #[doc = "approved by a total of `threshold - 1` of `other_signatories`."] @@ -14546,22 +20690,36 @@ pub mod api { >, call_hash: [::core::primitive::u8; 32usize], max_weight: ::core::primitive::u64, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ApproveAsMulti, - DispatchError, - root_mod::Event, - > { - let call = ApproveAsMulti { - threshold, - other_signatories, - maybe_timepoint, - call_hash, - max_weight, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ApproveAsMulti, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 114u8, 29u8, 118u8, 154u8, 91u8, 4u8, 127u8, 126u8, 190u8, + 180u8, 57u8, 112u8, 72u8, 8u8, 248u8, 126u8, 25u8, 190u8, + 130u8, 86u8, 160u8, 164u8, 76u8, 64u8, 25u8, 175u8, 132u8, + 225u8, 147u8, 166u8, 12u8, 38u8, + ] + { + let call = ApproveAsMulti { + threshold, + other_signatories, + maybe_timepoint, + call_hash, + max_weight, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Cancel a pre-existing, on-going multisig transaction. Any deposit reserved previously"] #[doc = "for this operation will be unreserved on success."] @@ -14599,21 +20757,35 @@ pub mod api { ::core::primitive::u32, >, call_hash: [::core::primitive::u8; 32usize], - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - CancelAsMulti, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + CancelAsMulti, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = CancelAsMulti { - threshold, - other_signatories, - timepoint, - call_hash, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 195u8, 216u8, 37u8, 179u8, 9u8, 19u8, 238u8, 94u8, 156u8, + 5u8, 120u8, 78u8, 129u8, 99u8, 239u8, 142u8, 68u8, 12u8, + 254u8, 46u8, 251u8, 8u8, 193u8, 43u8, 37u8, 68u8, 249u8, + 85u8, 163u8, 85u8, 193u8, 47u8, + ] + { + let call = CancelAsMulti { + threshold, + other_signatories, + timepoint, + call_hash, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -14728,7 +20900,7 @@ pub mod api { &self, _0: &::subxt::sp_core::crypto::AccountId32, _1: &[::core::primitive::u8; 32usize], - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::pallet_multisig::Multisig< @@ -14739,23 +20911,45 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = Multisigs(_0, _1); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 137u8, 130u8, 173u8, 65u8, 126u8, 244u8, 194u8, 167u8, 93u8, + 174u8, 104u8, 131u8, 115u8, 155u8, 93u8, 185u8, 54u8, 204u8, + 155u8, 149u8, 184u8, 24u8, 111u8, 40u8, 249u8, 215u8, 34u8, + 251u8, 224u8, 110u8, 202u8, 2u8, + ] + { + let entry = Multisigs(_0, _1); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The set of open multisig operations."] pub async fn multisigs_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Multisigs<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 137u8, 130u8, 173u8, 65u8, 126u8, 244u8, 194u8, 167u8, 93u8, + 174u8, 104u8, 131u8, 115u8, 155u8, 93u8, 185u8, 54u8, 204u8, + 155u8, 149u8, 184u8, 24u8, 111u8, 40u8, 249u8, 215u8, 34u8, + 251u8, 224u8, 110u8, 202u8, 2u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } pub async fn calls( &self, _0: &[::core::primitive::u8; 32usize], - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<( ::subxt::WrapperKeepOpaque, @@ -14764,17 +20958,39 @@ pub mod api { )>, ::subxt::BasicError, > { - let entry = Calls(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 51u8, 122u8, 79u8, 127u8, 1u8, 182u8, 39u8, 88u8, 57u8, + 227u8, 141u8, 253u8, 217u8, 23u8, 89u8, 94u8, 37u8, 244u8, + 136u8, 246u8, 87u8, 146u8, 97u8, 23u8, 135u8, 13u8, 32u8, + 14u8, 191u8, 15u8, 2u8, 51u8, + ] + { + let entry = Calls(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } pub async fn calls_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Calls<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 51u8, 122u8, 79u8, 127u8, 1u8, 182u8, 39u8, 88u8, 57u8, + 227u8, 141u8, 253u8, 217u8, 23u8, 89u8, 94u8, 37u8, 244u8, + 136u8, 246u8, 87u8, 146u8, 97u8, 23u8, 135u8, 13u8, 32u8, + 14u8, 191u8, 15u8, 2u8, 51u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -14797,10 +21013,25 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Multisig")?; - let constant = pallet.constant("DepositBase")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Multisig", "DepositBase")? + == [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, + 200u8, 214u8, 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, + 101u8, 54u8, 210u8, 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, + 15u8, 178u8, 98u8, 148u8, 156u8, + ] + { + let pallet = self.client.metadata().pallet("Multisig")?; + let constant = pallet.constant("DepositBase")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The amount of currency needed per unit threshold when creating a multisig execution."] #[doc = ""] @@ -14809,20 +21040,50 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Multisig")?; - let constant = pallet.constant("DepositFactor")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Multisig", "DepositFactor")? + == [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, + 200u8, 214u8, 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, + 101u8, 54u8, 210u8, 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, + 15u8, 178u8, 98u8, 148u8, 156u8, + ] + { + let pallet = self.client.metadata().pallet("Multisig")?; + let constant = pallet.constant("DepositFactor")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The maximum amount of signatories allowed in the multisig."] pub fn max_signatories( &self, ) -> ::core::result::Result<::core::primitive::u16, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Multisig")?; - let constant = pallet.constant("MaxSignatories")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Multisig", "MaxSignatories")? + == [ + 116u8, 33u8, 2u8, 170u8, 181u8, 147u8, 171u8, 169u8, 167u8, + 227u8, 41u8, 144u8, 11u8, 236u8, 82u8, 100u8, 74u8, 60u8, + 184u8, 72u8, 169u8, 90u8, 208u8, 135u8, 15u8, 117u8, 10u8, + 123u8, 128u8, 193u8, 29u8, 70u8, + ] + { + let pallet = self.client.metadata().pallet("Multisig")?; + let constant = pallet.constant("MaxSignatories")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -14962,16 +21223,30 @@ pub mod api { &self, value: ::core::primitive::u128, description: ::std::vec::Vec<::core::primitive::u8>, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ProposeBounty, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ProposeBounty, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ProposeBounty { value, description }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 208u8, 22u8, 157u8, 134u8, 214u8, 95u8, 249u8, 10u8, 67u8, + 223u8, 190u8, 192u8, 69u8, 32u8, 7u8, 235u8, 205u8, 145u8, + 90u8, 80u8, 60u8, 4u8, 16u8, 189u8, 59u8, 180u8, 68u8, 77u8, + 69u8, 121u8, 92u8, 33u8, + ] + { + let call = ProposeBounty { value, description }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Approve a bounty proposal. At a later time, the bounty will be funded and become active"] #[doc = "and the original deposit will be returned."] @@ -14984,16 +21259,30 @@ pub mod api { pub fn approve_bounty( &self, bounty_id: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ApproveBounty, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ApproveBounty, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ApproveBounty { bounty_id }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 127u8, 220u8, 25u8, 197u8, 19u8, 183u8, 177u8, 17u8, 164u8, + 29u8, 250u8, 136u8, 125u8, 90u8, 247u8, 177u8, 37u8, 180u8, + 77u8, 75u8, 164u8, 32u8, 195u8, 207u8, 58u8, 249u8, 141u8, + 11u8, 53u8, 184u8, 224u8, 135u8, + ] + { + let call = ApproveBounty { bounty_id }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Assign a curator to a funded bounty."] #[doc = ""] @@ -15010,20 +21299,34 @@ pub mod api { (), >, fee: ::core::primitive::u128, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ProposeCurator, - DispatchError, - root_mod::Event, - > { - let call = ProposeCurator { - bounty_id, - curator, - fee, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ProposeCurator, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 180u8, 13u8, 171u8, 39u8, 160u8, 233u8, 162u8, 39u8, 100u8, + 144u8, 156u8, 212u8, 139u8, 128u8, 105u8, 49u8, 157u8, 16u8, + 125u8, 72u8, 36u8, 45u8, 199u8, 139u8, 165u8, 100u8, 40u8, + 163u8, 117u8, 32u8, 164u8, 23u8, + ] + { + let call = ProposeCurator { + bounty_id, + curator, + fee, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Unassign curator from a bounty."] #[doc = ""] @@ -15046,16 +21349,30 @@ pub mod api { pub fn unassign_curator( &self, bounty_id: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - UnassignCurator, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + UnassignCurator, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = UnassignCurator { bounty_id }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 156u8, 163u8, 248u8, 148u8, 22u8, 231u8, 232u8, 182u8, 48u8, + 87u8, 85u8, 118u8, 169u8, 249u8, 123u8, 199u8, 248u8, 206u8, + 221u8, 196u8, 69u8, 69u8, 52u8, 116u8, 65u8, 165u8, 172u8, + 242u8, 61u8, 109u8, 143u8, 69u8, + ] + { + let call = UnassignCurator { bounty_id }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Accept the curator role for a bounty."] #[doc = "A deposit will be reserved from curator and refund upon successful payout."] @@ -15068,16 +21385,30 @@ pub mod api { pub fn accept_curator( &self, bounty_id: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - AcceptCurator, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + AcceptCurator, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = AcceptCurator { bounty_id }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 50u8, 149u8, 252u8, 40u8, 169u8, 113u8, 60u8, 153u8, 123u8, + 146u8, 40u8, 196u8, 176u8, 195u8, 95u8, 94u8, 14u8, 81u8, + 136u8, 225u8, 24u8, 59u8, 87u8, 118u8, 77u8, 60u8, 150u8, + 102u8, 206u8, 219u8, 241u8, 99u8, + ] + { + let call = AcceptCurator { bounty_id }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Award bounty to a beneficiary account. The beneficiary will be able to claim the funds"] #[doc = "after a delay."] @@ -15097,19 +21428,33 @@ pub mod api { ::subxt::sp_core::crypto::AccountId32, (), >, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - AwardBounty, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + AwardBounty, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = AwardBounty { - bounty_id, - beneficiary, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 42u8, 49u8, 134u8, 134u8, 5u8, 98u8, 72u8, 95u8, 227u8, + 156u8, 224u8, 249u8, 209u8, 42u8, 160u8, 15u8, 239u8, 195u8, + 128u8, 251u8, 217u8, 132u8, 15u8, 221u8, 191u8, 105u8, 39u8, + 228u8, 189u8, 174u8, 115u8, 53u8, + ] + { + let call = AwardBounty { + bounty_id, + beneficiary, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Claim the payout from an awarded bounty after payout delay."] #[doc = ""] @@ -15123,16 +21468,30 @@ pub mod api { pub fn claim_bounty( &self, bounty_id: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ClaimBounty, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ClaimBounty, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ClaimBounty { bounty_id }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 119u8, 9u8, 122u8, 55u8, 224u8, 139u8, 26u8, 186u8, 3u8, + 178u8, 78u8, 41u8, 91u8, 183u8, 222u8, 197u8, 189u8, 172u8, + 154u8, 47u8, 2u8, 164u8, 141u8, 163u8, 211u8, 117u8, 186u8, + 121u8, 130u8, 91u8, 13u8, 241u8, + ] + { + let call = ClaimBounty { bounty_id }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Cancel a proposed or active bounty. All the funds will be sent to treasury and"] #[doc = "the curator deposit will be unreserved if possible."] @@ -15147,16 +21506,30 @@ pub mod api { pub fn close_bounty( &self, bounty_id: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - CloseBounty, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + CloseBounty, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = CloseBounty { bounty_id }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 119u8, 47u8, 246u8, 188u8, 235u8, 22u8, 53u8, 70u8, 182u8, + 15u8, 247u8, 153u8, 208u8, 191u8, 144u8, 132u8, 30u8, 200u8, + 36u8, 186u8, 194u8, 225u8, 140u8, 160u8, 152u8, 194u8, 38u8, + 223u8, 33u8, 130u8, 120u8, 254u8, + ] + { + let call = CloseBounty { bounty_id }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Extend the expiry time of an active bounty."] #[doc = ""] @@ -15172,16 +21545,30 @@ pub mod api { &self, bounty_id: ::core::primitive::u32, remark: ::std::vec::Vec<::core::primitive::u8>, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ExtendBountyExpiry, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ExtendBountyExpiry, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ExtendBountyExpiry { bounty_id, remark }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 127u8, 142u8, 138u8, 230u8, 147u8, 187u8, 201u8, 210u8, + 216u8, 61u8, 62u8, 125u8, 168u8, 188u8, 16u8, 73u8, 157u8, + 53u8, 165u8, 236u8, 181u8, 26u8, 28u8, 67u8, 59u8, 234u8, + 189u8, 167u8, 92u8, 242u8, 138u8, 35u8, + ] + { + let call = ExtendBountyExpiry { bounty_id, remark }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -15340,17 +21727,31 @@ pub mod api { #[doc = " Number of bounty proposals that have been made."] pub async fn bounty_count( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let entry = BountyCount; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 5u8, 188u8, 134u8, 220u8, 64u8, 49u8, 188u8, 98u8, 185u8, + 186u8, 230u8, 65u8, 247u8, 199u8, 28u8, 178u8, 202u8, 193u8, + 41u8, 83u8, 115u8, 253u8, 182u8, 123u8, 92u8, 138u8, 12u8, + 31u8, 31u8, 213u8, 23u8, 118u8, + ] + { + let entry = BountyCount; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Bounties that have been made."] pub async fn bounties( &self, _0: &::core::primitive::u32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::pallet_bounties::Bounty< @@ -15361,24 +21762,46 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = Bounties(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 27u8, 154u8, 97u8, 199u8, 230u8, 195u8, 155u8, 198u8, 4u8, + 28u8, 5u8, 202u8, 175u8, 11u8, 243u8, 166u8, 67u8, 231u8, + 125u8, 203u8, 141u8, 168u8, 106u8, 218u8, 129u8, 25u8, 231u8, + 253u8, 126u8, 144u8, 46u8, 255u8, + ] + { + let entry = Bounties(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Bounties that have been made."] pub async fn bounties_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Bounties<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 27u8, 154u8, 97u8, 199u8, 230u8, 195u8, 155u8, 198u8, 4u8, + 28u8, 5u8, 202u8, 175u8, 11u8, 243u8, 166u8, 67u8, 231u8, + 125u8, 203u8, 141u8, 168u8, 106u8, 218u8, 129u8, 25u8, 231u8, + 253u8, 126u8, 144u8, 46u8, 255u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The description of each bounty."] pub async fn bounty_descriptions( &self, _0: &::core::primitive::u32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::frame_support::storage::bounded_vec::BoundedVec< @@ -15387,31 +21810,73 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = BountyDescriptions(_0); - self.client.storage().fetch(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 41u8, 78u8, 19u8, 48u8, 241u8, 95u8, 175u8, 69u8, 236u8, + 54u8, 84u8, 58u8, 69u8, 28u8, 20u8, 20u8, 214u8, 138u8, + 163u8, 252u8, 239u8, 116u8, 171u8, 136u8, 0u8, 159u8, 192u8, + 51u8, 191u8, 160u8, 131u8, 123u8, + ] + { + let entry = BountyDescriptions(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The description of each bounty."] pub async fn bounty_descriptions_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, BountyDescriptions<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 41u8, 78u8, 19u8, 48u8, 241u8, 95u8, 175u8, 69u8, 236u8, + 54u8, 84u8, 58u8, 69u8, 28u8, 20u8, 20u8, 214u8, 138u8, + 163u8, 252u8, 239u8, 116u8, 171u8, 136u8, 0u8, 159u8, 192u8, + 51u8, 191u8, 160u8, 131u8, 123u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Bounty indices that have been approved but not yet funded."] pub async fn bounty_approvals( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< runtime_types::frame_support::storage::bounded_vec::BoundedVec< ::core::primitive::u32, >, ::subxt::BasicError, > { - let entry = BountyApprovals; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 18u8, 142u8, 244u8, 64u8, 172u8, 62u8, 230u8, 114u8, 165u8, + 158u8, 123u8, 163u8, 35u8, 125u8, 218u8, 23u8, 113u8, 73u8, + 233u8, 242u8, 181u8, 205u8, 60u8, 54u8, 64u8, 115u8, 207u8, + 94u8, 22u8, 14u8, 238u8, 49u8, + ] + { + let entry = BountyApprovals; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -15429,30 +21894,75 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Bounties")?; - let constant = pallet.constant("BountyDepositBase")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Bounties", "BountyDepositBase")? + == [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, + 200u8, 214u8, 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, + 101u8, 54u8, 210u8, 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, + 15u8, 178u8, 98u8, 148u8, 156u8, + ] + { + let pallet = self.client.metadata().pallet("Bounties")?; + let constant = pallet.constant("BountyDepositBase")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The delay period for which a bounty beneficiary need to wait before claim the payout."] pub fn bounty_deposit_payout_delay( &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Bounties")?; - let constant = pallet.constant("BountyDepositPayoutDelay")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Bounties", "BountyDepositPayoutDelay")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Bounties")?; + let constant = pallet.constant("BountyDepositPayoutDelay")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Bounty duration in blocks."] pub fn bounty_update_period( &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Bounties")?; - let constant = pallet.constant("BountyUpdatePeriod")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Bounties", "BountyUpdatePeriod")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Bounties")?; + let constant = pallet.constant("BountyUpdatePeriod")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The curator deposit is calculated as a percentage of the curator fee."] #[doc = ""] @@ -15464,10 +21974,25 @@ pub mod api { runtime_types::sp_arithmetic::per_things::Permill, ::subxt::BasicError, > { - let pallet = self.client.metadata().pallet("Bounties")?; - let constant = pallet.constant("CuratorDepositMultiplier")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Bounties", "CuratorDepositMultiplier")? + == [ + 26u8, 148u8, 47u8, 190u8, 51u8, 71u8, 203u8, 119u8, 167u8, + 91u8, 70u8, 11u8, 149u8, 155u8, 138u8, 91u8, 119u8, 0u8, + 74u8, 83u8, 16u8, 47u8, 129u8, 11u8, 81u8, 169u8, 79u8, 31u8, + 161u8, 119u8, 2u8, 38u8, + ] + { + let pallet = self.client.metadata().pallet("Bounties")?; + let constant = pallet.constant("CuratorDepositMultiplier")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Maximum amount of funds that should be placed in a deposit for making a proposal."] pub fn curator_deposit_max( @@ -15476,10 +22001,25 @@ pub mod api { ::core::option::Option<::core::primitive::u128>, ::subxt::BasicError, > { - let pallet = self.client.metadata().pallet("Bounties")?; - let constant = pallet.constant("CuratorDepositMax")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Bounties", "CuratorDepositMax")? + == [ + 84u8, 154u8, 218u8, 83u8, 84u8, 189u8, 32u8, 20u8, 120u8, + 194u8, 88u8, 205u8, 109u8, 216u8, 114u8, 193u8, 120u8, 198u8, + 154u8, 237u8, 134u8, 204u8, 102u8, 247u8, 52u8, 103u8, 231u8, + 43u8, 243u8, 122u8, 60u8, 216u8, + ] + { + let pallet = self.client.metadata().pallet("Bounties")?; + let constant = pallet.constant("CuratorDepositMax")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Minimum amount of funds that should be placed in a deposit for making a proposal."] pub fn curator_deposit_min( @@ -15488,30 +22028,75 @@ pub mod api { ::core::option::Option<::core::primitive::u128>, ::subxt::BasicError, > { - let pallet = self.client.metadata().pallet("Bounties")?; - let constant = pallet.constant("CuratorDepositMin")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Bounties", "CuratorDepositMin")? + == [ + 84u8, 154u8, 218u8, 83u8, 84u8, 189u8, 32u8, 20u8, 120u8, + 194u8, 88u8, 205u8, 109u8, 216u8, 114u8, 193u8, 120u8, 198u8, + 154u8, 237u8, 134u8, 204u8, 102u8, 247u8, 52u8, 103u8, 231u8, + 43u8, 243u8, 122u8, 60u8, 216u8, + ] + { + let pallet = self.client.metadata().pallet("Bounties")?; + let constant = pallet.constant("CuratorDepositMin")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Minimum value for a bounty."] pub fn bounty_value_minimum( &self, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Bounties")?; - let constant = pallet.constant("BountyValueMinimum")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Bounties", "BountyValueMinimum")? + == [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, + 200u8, 214u8, 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, + 101u8, 54u8, 210u8, 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, + 15u8, 178u8, 98u8, 148u8, 156u8, + ] + { + let pallet = self.client.metadata().pallet("Bounties")?; + let constant = pallet.constant("BountyValueMinimum")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The amount held on deposit per byte within the tip report reason or bounty description."] pub fn data_deposit_per_byte( &self, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Bounties")?; - let constant = pallet.constant("DataDepositPerByte")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Bounties", "DataDepositPerByte")? + == [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, + 200u8, 214u8, 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, + 101u8, 54u8, 210u8, 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, + 15u8, 178u8, 98u8, 148u8, 156u8, + ] + { + let pallet = self.client.metadata().pallet("Bounties")?; + let constant = pallet.constant("DataDepositPerByte")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Maximum acceptable reason length."] #[doc = ""] @@ -15520,10 +22105,25 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Bounties")?; - let constant = pallet.constant("MaximumReasonLength")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Bounties", "MaximumReasonLength")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Bounties")?; + let constant = pallet.constant("MaximumReasonLength")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -15666,20 +22266,34 @@ pub mod api { parent_bounty_id: ::core::primitive::u32, value: ::core::primitive::u128, description: ::std::vec::Vec<::core::primitive::u8>, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - AddChildBounty, - DispatchError, - root_mod::Event, - > { - let call = AddChildBounty { - parent_bounty_id, - value, - description, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + AddChildBounty, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 235u8, 216u8, 166u8, 226u8, 107u8, 159u8, 235u8, 35u8, 207u8, + 154u8, 124u8, 226u8, 242u8, 241u8, 4u8, 20u8, 1u8, 215u8, + 110u8, 127u8, 19u8, 211u8, 36u8, 159u8, 110u8, 146u8, 58u8, + 23u8, 210u8, 51u8, 193u8, 228u8, + ] + { + let call = AddChildBounty { + parent_bounty_id, + value, + description, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Propose curator for funded child-bounty."] #[doc = ""] @@ -15705,21 +22319,35 @@ pub mod api { (), >, fee: ::core::primitive::u128, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ProposeCurator, - DispatchError, - root_mod::Event, - > { - let call = ProposeCurator { - parent_bounty_id, - child_bounty_id, - curator, - fee, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ProposeCurator, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 34u8, 219u8, 159u8, 152u8, 29u8, 12u8, 222u8, 91u8, 193u8, + 218u8, 28u8, 0u8, 102u8, 15u8, 180u8, 155u8, 135u8, 175u8, + 182u8, 51u8, 220u8, 97u8, 169u8, 97u8, 135u8, 26u8, 237u8, + 22u8, 100u8, 8u8, 203u8, 229u8, + ] + { + let call = ProposeCurator { + parent_bounty_id, + child_bounty_id, + curator, + fee, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Accept the curator role for the child-bounty."] #[doc = ""] @@ -15744,19 +22372,33 @@ pub mod api { &self, parent_bounty_id: ::core::primitive::u32, child_bounty_id: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - AcceptCurator, - DispatchError, - root_mod::Event, - > { - let call = AcceptCurator { - parent_bounty_id, - child_bounty_id, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + AcceptCurator, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 115u8, 24u8, 36u8, 188u8, 30u8, 11u8, 184u8, 102u8, 151u8, + 96u8, 41u8, 162u8, 104u8, 54u8, 76u8, 251u8, 189u8, 50u8, + 190u8, 50u8, 15u8, 171u8, 231u8, 218u8, 45u8, 129u8, 137u8, + 69u8, 130u8, 39u8, 190u8, 223u8, + ] + { + let call = AcceptCurator { + parent_bounty_id, + child_bounty_id, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Unassign curator from a child-bounty."] #[doc = ""] @@ -15796,19 +22438,33 @@ pub mod api { &self, parent_bounty_id: ::core::primitive::u32, child_bounty_id: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - UnassignCurator, - DispatchError, - root_mod::Event, - > { - let call = UnassignCurator { - parent_bounty_id, - child_bounty_id, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + UnassignCurator, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 210u8, 24u8, 20u8, 200u8, 106u8, 200u8, 33u8, 43u8, 169u8, + 133u8, 157u8, 108u8, 220u8, 36u8, 110u8, 172u8, 218u8, 1u8, + 209u8, 254u8, 69u8, 117u8, 70u8, 173u8, 66u8, 177u8, 54u8, + 128u8, 239u8, 83u8, 60u8, 118u8, + ] + { + let call = UnassignCurator { + parent_bounty_id, + child_bounty_id, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Award child-bounty to a beneficiary."] #[doc = ""] @@ -15835,20 +22491,34 @@ pub mod api { ::subxt::sp_core::crypto::AccountId32, (), >, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - AwardChildBounty, - DispatchError, - root_mod::Event, - > { - let call = AwardChildBounty { - parent_bounty_id, - child_bounty_id, - beneficiary, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + AwardChildBounty, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 135u8, 134u8, 237u8, 216u8, 152u8, 75u8, 11u8, 209u8, 152u8, + 99u8, 166u8, 78u8, 162u8, 34u8, 37u8, 158u8, 95u8, 74u8, + 137u8, 50u8, 43u8, 117u8, 166u8, 91u8, 212u8, 30u8, 243u8, + 67u8, 140u8, 66u8, 56u8, 206u8, + ] + { + let call = AwardChildBounty { + parent_bounty_id, + child_bounty_id, + beneficiary, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Claim the payout from an awarded child-bounty after payout delay."] #[doc = ""] @@ -15870,19 +22540,33 @@ pub mod api { &self, parent_bounty_id: ::core::primitive::u32, child_bounty_id: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ClaimChildBounty, - DispatchError, - root_mod::Event, - > { - let call = ClaimChildBounty { - parent_bounty_id, - child_bounty_id, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ClaimChildBounty, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 54u8, 194u8, 203u8, 13u8, 230u8, 207u8, 25u8, 249u8, 203u8, + 199u8, 123u8, 79u8, 255u8, 85u8, 40u8, 125u8, 73u8, 5u8, + 126u8, 103u8, 205u8, 222u8, 232u8, 161u8, 178u8, 206u8, 39u8, + 5u8, 16u8, 167u8, 198u8, 93u8, + ] + { + let call = ClaimChildBounty { + parent_bounty_id, + child_bounty_id, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Cancel a proposed or active child-bounty. Child-bounty account funds"] #[doc = "are transferred to parent bounty account. The child-bounty curator"] @@ -15910,19 +22594,33 @@ pub mod api { &self, parent_bounty_id: ::core::primitive::u32, child_bounty_id: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - CloseChildBounty, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + CloseChildBounty, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = CloseChildBounty { - parent_bounty_id, - child_bounty_id, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 123u8, 201u8, 206u8, 242u8, 80u8, 37u8, 113u8, 182u8, 237u8, + 187u8, 51u8, 229u8, 226u8, 250u8, 129u8, 203u8, 196u8, 22u8, + 91u8, 154u8, 118u8, 233u8, 254u8, 240u8, 113u8, 86u8, 55u8, + 5u8, 59u8, 15u8, 160u8, 204u8, + ] + { + let call = CloseChildBounty { + parent_bounty_id, + child_bounty_id, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -16058,40 +22756,85 @@ pub mod api { #[doc = " Number of total child bounties."] pub async fn child_bounty_count( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let entry = ChildBountyCount; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 46u8, 10u8, 183u8, 160u8, 98u8, 215u8, 39u8, 253u8, 81u8, + 94u8, 114u8, 147u8, 115u8, 162u8, 33u8, 117u8, 160u8, 214u8, + 167u8, 7u8, 109u8, 143u8, 158u8, 1u8, 200u8, 205u8, 17u8, + 93u8, 89u8, 26u8, 30u8, 95u8, + ] + { + let entry = ChildBountyCount; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Number of child-bounties per parent bounty."] #[doc = " Map of parent bounty index to number of child bounties."] pub async fn parent_child_bounties( &self, _0: &::core::primitive::u32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let entry = ParentChildBounties(_0); - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 127u8, 161u8, 181u8, 79u8, 235u8, 196u8, 252u8, 162u8, 39u8, + 15u8, 251u8, 49u8, 125u8, 80u8, 101u8, 24u8, 234u8, 88u8, + 212u8, 126u8, 63u8, 63u8, 19u8, 75u8, 137u8, 125u8, 38u8, + 250u8, 77u8, 49u8, 76u8, 188u8, + ] + { + let entry = ParentChildBounties(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Number of child-bounties per parent bounty."] #[doc = " Map of parent bounty index to number of child bounties."] pub async fn parent_child_bounties_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, ParentChildBounties<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 127u8, 161u8, 181u8, 79u8, 235u8, 196u8, 252u8, 162u8, 39u8, + 15u8, 251u8, 49u8, 125u8, 80u8, 101u8, 24u8, 234u8, 88u8, + 212u8, 126u8, 63u8, 63u8, 19u8, 75u8, 137u8, 125u8, 38u8, + 250u8, 77u8, 49u8, 76u8, 188u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Child-bounties that have been added."] pub async fn child_bounties( &self, _0: &::core::primitive::u32, _1: &::core::primitive::u32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::pallet_child_bounties::ChildBounty< @@ -16102,24 +22845,46 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = ChildBounties(_0, _1); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 66u8, 224u8, 32u8, 188u8, 0u8, 175u8, 253u8, 132u8, 17u8, + 243u8, 51u8, 237u8, 230u8, 40u8, 198u8, 178u8, 222u8, 159u8, + 99u8, 29u8, 237u8, 147u8, 183u8, 111u8, 103u8, 195u8, 185u8, + 27u8, 252u8, 2u8, 55u8, 108u8, + ] + { + let entry = ChildBounties(_0, _1); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Child-bounties that have been added."] pub async fn child_bounties_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, ChildBounties<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 66u8, 224u8, 32u8, 188u8, 0u8, 175u8, 253u8, 132u8, 17u8, + 243u8, 51u8, 237u8, 230u8, 40u8, 198u8, 178u8, 222u8, 159u8, + 99u8, 29u8, 237u8, 147u8, 183u8, 111u8, 103u8, 195u8, 185u8, + 27u8, 252u8, 2u8, 55u8, 108u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The description of each child-bounty."] pub async fn child_bounty_descriptions( &self, _0: &::core::primitive::u32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::frame_support::storage::bounded_vec::BoundedVec< @@ -16128,38 +22893,97 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = ChildBountyDescriptions(_0); - self.client.storage().fetch(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 20u8, 134u8, 50u8, 207u8, 242u8, 159u8, 242u8, 22u8, 76u8, + 80u8, 193u8, 247u8, 73u8, 51u8, 113u8, 241u8, 186u8, 26u8, + 227u8, 44u8, 122u8, 189u8, 171u8, 137u8, 31u8, 103u8, 184u8, + 129u8, 31u8, 98u8, 19u8, 60u8, + ] + { + let entry = ChildBountyDescriptions(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The description of each child-bounty."] pub async fn child_bounty_descriptions_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, ChildBountyDescriptions<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 20u8, 134u8, 50u8, 207u8, 242u8, 159u8, 242u8, 22u8, 76u8, + 80u8, 193u8, 247u8, 73u8, 51u8, 113u8, 241u8, 186u8, 26u8, + 227u8, 44u8, 122u8, 189u8, 171u8, 137u8, 31u8, 103u8, 184u8, + 129u8, 31u8, 98u8, 19u8, 60u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The cumulative child-bounty curator fee for each parent bounty."] pub async fn children_curator_fees( &self, _0: &::core::primitive::u32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let entry = ChildrenCuratorFees(_0); - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 174u8, 128u8, 86u8, 179u8, 133u8, 76u8, 98u8, 169u8, 234u8, + 166u8, 249u8, 214u8, 172u8, 171u8, 8u8, 161u8, 105u8, 69u8, + 148u8, 151u8, 35u8, 174u8, 118u8, 139u8, 101u8, 56u8, 85u8, + 211u8, 121u8, 168u8, 0u8, 216u8, + ] + { + let entry = ChildrenCuratorFees(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The cumulative child-bounty curator fee for each parent bounty."] pub async fn children_curator_fees_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, ChildrenCuratorFees<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 174u8, 128u8, 86u8, 179u8, 133u8, 76u8, 98u8, 169u8, 234u8, + 166u8, 249u8, 214u8, 172u8, 171u8, 8u8, 161u8, 105u8, 69u8, + 148u8, 151u8, 35u8, 174u8, 118u8, 139u8, 101u8, 56u8, 85u8, + 211u8, 121u8, 168u8, 0u8, 216u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -16177,20 +23001,50 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("ChildBounties")?; - let constant = pallet.constant("MaxActiveChildBountyCount")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("ChildBounties", "MaxActiveChildBountyCount")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("ChildBounties")?; + let constant = pallet.constant("MaxActiveChildBountyCount")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Minimum value for a child-bounty."] pub fn child_bounty_value_minimum( &self, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("ChildBounties")?; - let constant = pallet.constant("ChildBountyValueMinimum")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("ChildBounties", "ChildBountyValueMinimum")? + == [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, + 200u8, 214u8, 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, + 101u8, 54u8, 210u8, 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, + 15u8, 178u8, 98u8, 148u8, 156u8, + ] + { + let pallet = self.client.metadata().pallet("ChildBounties")?; + let constant = pallet.constant("ChildBountyValueMinimum")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -16298,16 +23152,30 @@ pub mod api { &self, reason: ::std::vec::Vec<::core::primitive::u8>, who: ::subxt::sp_core::crypto::AccountId32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ReportAwesome, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ReportAwesome, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ReportAwesome { reason, who }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 90u8, 58u8, 149u8, 226u8, 88u8, 237u8, 150u8, 165u8, 172u8, + 179u8, 195u8, 226u8, 200u8, 20u8, 152u8, 103u8, 157u8, 208u8, + 86u8, 101u8, 178u8, 54u8, 42u8, 171u8, 172u8, 201u8, 20u8, + 254u8, 165u8, 7u8, 15u8, 197u8, + ] + { + let call = ReportAwesome { reason, who }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Retract a prior tip-report from `report_awesome`, and cancel the process of tipping."] #[doc = ""] @@ -16331,16 +23199,30 @@ pub mod api { pub fn retract_tip( &self, hash: ::subxt::sp_core::H256, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - RetractTip, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + RetractTip, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = RetractTip { hash }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 213u8, 70u8, 11u8, 81u8, 39u8, 125u8, 42u8, 247u8, 80u8, + 55u8, 123u8, 247u8, 45u8, 18u8, 86u8, 205u8, 26u8, 229u8, + 21u8, 106u8, 196u8, 125u8, 63u8, 65u8, 117u8, 219u8, 138u8, + 163u8, 161u8, 115u8, 157u8, 231u8, + ] + { + let call = RetractTip { hash }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Give a tip for something new; no finder's fee will be taken."] #[doc = ""] @@ -16369,20 +23251,34 @@ pub mod api { reason: ::std::vec::Vec<::core::primitive::u8>, who: ::subxt::sp_core::crypto::AccountId32, tip_value: ::core::primitive::u128, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - TipNew, - DispatchError, - root_mod::Event, - > { - let call = TipNew { - reason, - who, - tip_value, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + TipNew, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 137u8, 119u8, 91u8, 139u8, 238u8, 180u8, 247u8, 5u8, 194u8, + 35u8, 33u8, 151u8, 50u8, 212u8, 208u8, 134u8, 98u8, 133u8, + 83u8, 212u8, 27u8, 218u8, 186u8, 188u8, 111u8, 102u8, 34u8, + 211u8, 112u8, 48u8, 98u8, 206u8, + ] + { + let call = TipNew { + reason, + who, + tip_value, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Declare a tip value for an already-open tip."] #[doc = ""] @@ -16412,16 +23308,30 @@ pub mod api { &self, hash: ::subxt::sp_core::H256, tip_value: ::core::primitive::u128, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Tip, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Tip, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = Tip { hash, tip_value }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 2u8, 38u8, 219u8, 220u8, 183u8, 243u8, 108u8, 40u8, 179u8, + 21u8, 218u8, 158u8, 126u8, 19u8, 22u8, 115u8, 95u8, 17u8, + 73u8, 219u8, 179u8, 69u8, 60u8, 115u8, 196u8, 170u8, 23u8, + 218u8, 75u8, 9u8, 227u8, 204u8, + ] + { + let call = Tip { hash, tip_value }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Close and payout a tip."] #[doc = ""] @@ -16442,16 +23352,30 @@ pub mod api { pub fn close_tip( &self, hash: ::subxt::sp_core::H256, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - CloseTip, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + CloseTip, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = CloseTip { hash }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 85u8, 180u8, 115u8, 177u8, 2u8, 252u8, 139u8, 37u8, 233u8, + 127u8, 115u8, 4u8, 169u8, 169u8, 214u8, 223u8, 181u8, 150u8, + 137u8, 226u8, 99u8, 23u8, 205u8, 31u8, 160u8, 185u8, 97u8, + 128u8, 197u8, 110u8, 142u8, 160u8, + ] + { + let call = CloseTip { hash }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Remove and slash an already-open tip."] #[doc = ""] @@ -16468,16 +23392,30 @@ pub mod api { pub fn slash_tip( &self, hash: ::subxt::sp_core::H256, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SlashTip, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SlashTip, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SlashTip { hash }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 135u8, 7u8, 55u8, 167u8, 26u8, 108u8, 43u8, 20u8, 162u8, + 185u8, 209u8, 88u8, 148u8, 181u8, 51u8, 102u8, 17u8, 105u8, + 162u8, 223u8, 126u8, 46u8, 254u8, 79u8, 64u8, 248u8, 193u8, + 10u8, 110u8, 40u8, 5u8, 199u8, + ] + { + let call = SlashTip { hash }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -16578,7 +23516,7 @@ pub mod api { pub async fn tips( &self, _0: &::subxt::sp_core::H256, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::pallet_tips::OpenTip< @@ -16590,44 +23528,88 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = Tips(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 147u8, 163u8, 201u8, 236u8, 134u8, 199u8, 172u8, 47u8, 40u8, + 168u8, 105u8, 145u8, 238u8, 204u8, 133u8, 116u8, 185u8, + 240u8, 122u8, 181u8, 102u8, 194u8, 38u8, 40u8, 230u8, 215u8, + 159u8, 71u8, 100u8, 240u8, 169u8, 64u8, + ] + { + let entry = Tips(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " TipsMap that are not yet completed. Keyed by the hash of `(reason, who)` from the value."] #[doc = " This has the insecure enumerable hash function since the key itself is already"] #[doc = " guaranteed to be a secure hash."] pub async fn tips_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Tips<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 147u8, 163u8, 201u8, 236u8, 134u8, 199u8, 172u8, 47u8, 40u8, + 168u8, 105u8, 145u8, 238u8, 204u8, 133u8, 116u8, 185u8, + 240u8, 122u8, 181u8, 102u8, 194u8, 38u8, 40u8, 230u8, 215u8, + 159u8, 71u8, 100u8, 240u8, 169u8, 64u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Simple preimage lookup from the reason's hash to the original data. Again, has an"] #[doc = " insecure enumerable hash since the key is guaranteed to be the result of a secure hash."] pub async fn reasons( &self, _0: &::subxt::sp_core::H256, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<::std::vec::Vec<::core::primitive::u8>>, ::subxt::BasicError, > { - let entry = Reasons(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 224u8, 172u8, 6u8, 195u8, 254u8, 210u8, 186u8, 62u8, 224u8, + 53u8, 196u8, 78u8, 84u8, 218u8, 0u8, 135u8, 247u8, 130u8, + 17u8, 93u8, 149u8, 220u8, 36u8, 61u8, 62u8, 60u8, 210u8, + 142u8, 24u8, 145u8, 151u8, 19u8, + ] + { + let entry = Reasons(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Simple preimage lookup from the reason's hash to the original data. Again, has an"] #[doc = " insecure enumerable hash since the key is guaranteed to be the result of a secure hash."] pub async fn reasons_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Reasons<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 224u8, 172u8, 6u8, 195u8, 254u8, 210u8, 186u8, 62u8, 224u8, + 53u8, 196u8, 78u8, 84u8, 218u8, 0u8, 135u8, 247u8, 130u8, + 17u8, 93u8, 149u8, 220u8, 36u8, 61u8, 62u8, 60u8, 210u8, + 142u8, 24u8, 145u8, 151u8, 19u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -16647,30 +23629,75 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Tips")?; - let constant = pallet.constant("MaximumReasonLength")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Tips", "MaximumReasonLength")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Tips")?; + let constant = pallet.constant("MaximumReasonLength")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The amount held on deposit per byte within the tip report reason or bounty description."] pub fn data_deposit_per_byte( &self, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Tips")?; - let constant = pallet.constant("DataDepositPerByte")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Tips", "DataDepositPerByte")? + == [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, + 200u8, 214u8, 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, + 101u8, 54u8, 210u8, 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, + 15u8, 178u8, 98u8, 148u8, 156u8, + ] + { + let pallet = self.client.metadata().pallet("Tips")?; + let constant = pallet.constant("DataDepositPerByte")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The period for which a tip remains open after is has achieved threshold tippers."] pub fn tip_countdown( &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Tips")?; - let constant = pallet.constant("TipCountdown")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Tips", "TipCountdown")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Tips")?; + let constant = pallet.constant("TipCountdown")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The percent of the final tip which goes to the original reporter of the tip."] pub fn tip_finders_fee( @@ -16679,20 +23706,50 @@ pub mod api { runtime_types::sp_arithmetic::per_things::Percent, ::subxt::BasicError, > { - let pallet = self.client.metadata().pallet("Tips")?; - let constant = pallet.constant("TipFindersFee")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Tips", "TipFindersFee")? + == [ + 51u8, 95u8, 57u8, 159u8, 25u8, 64u8, 29u8, 36u8, 82u8, 174u8, + 29u8, 154u8, 123u8, 113u8, 231u8, 89u8, 161u8, 252u8, 237u8, + 17u8, 50u8, 5u8, 239u8, 138u8, 157u8, 114u8, 246u8, 90u8, + 225u8, 146u8, 157u8, 192u8, + ] + { + let pallet = self.client.metadata().pallet("Tips")?; + let constant = pallet.constant("TipFindersFee")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The amount held on deposit for placing a tip report."] pub fn tip_report_deposit_base( &self, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Tips")?; - let constant = pallet.constant("TipReportDepositBase")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Tips", "TipReportDepositBase")? + == [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, + 200u8, 214u8, 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, + 101u8, 54u8, 210u8, 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, + 15u8, 178u8, 98u8, 148u8, 156u8, + ] + { + let pallet = self.client.metadata().pallet("Tips")?; + let constant = pallet.constant("TipReportDepositBase")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -16791,19 +23848,33 @@ pub mod api { &self, raw_solution : runtime_types :: pallet_election_provider_multi_phase :: RawSolution < runtime_types :: polkadot_runtime :: NposCompactSolution16 >, witness : runtime_types :: pallet_election_provider_multi_phase :: SolutionOrSnapshotSize, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SubmitUnsigned, - DispatchError, - root_mod::Event, - > { - let call = SubmitUnsigned { - raw_solution: ::std::boxed::Box::new(raw_solution), - witness, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SubmitUnsigned, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 202u8, 104u8, 247u8, 250u8, 171u8, 119u8, 119u8, 96u8, 213u8, + 119u8, 41u8, 116u8, 29u8, 99u8, 71u8, 203u8, 168u8, 212u8, + 15u8, 10u8, 64u8, 126u8, 177u8, 56u8, 177u8, 42u8, 236u8, + 124u8, 36u8, 94u8, 47u8, 27u8, + ] + { + let call = SubmitUnsigned { + raw_solution: ::std::boxed::Box::new(raw_solution), + witness, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set a new value for `MinimumUntrustedScore`."] #[doc = ""] @@ -16815,16 +23886,33 @@ pub mod api { maybe_next_score: ::core::option::Option< runtime_types::sp_npos_elections::ElectionScore, >, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetMinimumUntrustedScore, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetMinimumUntrustedScore, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetMinimumUntrustedScore { maybe_next_score }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 207u8, 31u8, 247u8, 72u8, 55u8, 18u8, 99u8, 157u8, 155u8, + 89u8, 59u8, 156u8, 254u8, 3u8, 181u8, 85u8, 48u8, 42u8, 73u8, + 243u8, 35u8, 90u8, 142u8, 14u8, 62u8, 48u8, 15u8, 125u8, + 194u8, 103u8, 2u8, 175u8, + ] + { + let call = SetMinimumUntrustedScore { maybe_next_score }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set a solution in the queue, to be handed out to the client of this pallet in the next"] #[doc = "call to `ElectionProvider::elect`."] @@ -16842,16 +23930,33 @@ pub mod api { ::subxt::sp_core::crypto::AccountId32, >, )>, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetEmergencyElectionResult, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetEmergencyElectionResult, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetEmergencyElectionResult { supports }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 195u8, 164u8, 133u8, 193u8, 58u8, 154u8, 182u8, 83u8, 231u8, + 217u8, 199u8, 27u8, 239u8, 143u8, 60u8, 103u8, 139u8, 253u8, + 49u8, 242u8, 8u8, 41u8, 160u8, 192u8, 123u8, 98u8, 137u8, + 13u8, 170u8, 167u8, 246u8, 175u8, + ] + { + let call = SetEmergencyElectionResult { supports }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Submit a solution for the signed phase."] #[doc = ""] @@ -16865,18 +23970,32 @@ pub mod api { pub fn submit( &self, raw_solution : runtime_types :: pallet_election_provider_multi_phase :: RawSolution < runtime_types :: polkadot_runtime :: NposCompactSolution16 >, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Submit, - DispatchError, - root_mod::Event, - > { - let call = Submit { - raw_solution: ::std::boxed::Box::new(raw_solution), - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Submit, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 192u8, 193u8, 242u8, 99u8, 80u8, 253u8, 100u8, 234u8, 199u8, + 15u8, 119u8, 251u8, 94u8, 248u8, 110u8, 171u8, 216u8, 218u8, + 60u8, 223u8, 227u8, 79u8, 174u8, 232u8, 251u8, 75u8, 17u8, + 241u8, 15u8, 23u8, 11u8, 99u8, + ] + { + let call = Submit { + raw_solution: ::std::boxed::Box::new(raw_solution), + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Trigger the governance fallback."] #[doc = ""] @@ -16886,19 +24005,33 @@ pub mod api { &self, maybe_max_voters: ::core::option::Option<::core::primitive::u32>, maybe_max_targets: ::core::option::Option<::core::primitive::u32>, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - GovernanceFallback, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + GovernanceFallback, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = GovernanceFallback { - maybe_max_voters, - maybe_max_targets, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 195u8, 190u8, 140u8, 94u8, 209u8, 100u8, 92u8, 194u8, 78u8, + 226u8, 16u8, 168u8, 52u8, 117u8, 88u8, 178u8, 84u8, 248u8, + 117u8, 38u8, 152u8, 71u8, 37u8, 158u8, 77u8, 204u8, 59u8, + 184u8, 22u8, 239u8, 92u8, 209u8, + ] + { + let call = GovernanceFallback { + maybe_max_voters, + maybe_max_targets, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -17099,53 +24232,125 @@ pub mod api { #[doc = " This is merely incremented once per every time that an upstream `elect` is called."] pub async fn round( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let entry = Round; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 16u8, 49u8, 176u8, 52u8, 202u8, 111u8, 120u8, 8u8, 217u8, + 96u8, 35u8, 14u8, 233u8, 130u8, 47u8, 98u8, 34u8, 44u8, + 166u8, 188u8, 199u8, 210u8, 21u8, 19u8, 70u8, 96u8, 139u8, + 8u8, 53u8, 82u8, 165u8, 239u8, + ] + { + let entry = Round; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Current phase."] pub async fn current_phase( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< runtime_types::pallet_election_provider_multi_phase::Phase< ::core::primitive::u32, >, ::subxt::BasicError, > { - let entry = CurrentPhase; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 162u8, 177u8, 133u8, 63u8, 175u8, 78u8, 85u8, 0u8, 233u8, + 84u8, 10u8, 250u8, 190u8, 39u8, 101u8, 11u8, 52u8, 31u8, + 129u8, 151u8, 63u8, 179u8, 120u8, 28u8, 70u8, 61u8, 91u8, + 153u8, 95u8, 32u8, 33u8, 157u8, + ] + { + let entry = CurrentPhase; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } - #[doc = " Current best solution, signed or unsigned, queued to be returned upon `elect`."] pub async fn queued_solution (& self , hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < :: core :: option :: Option < runtime_types :: pallet_election_provider_multi_phase :: ReadySolution < :: subxt :: sp_core :: crypto :: AccountId32 > > , :: subxt :: BasicError >{ - let entry = QueuedSolution; - self.client.storage().fetch(&entry, hash).await + #[doc = " Current best solution, signed or unsigned, queued to be returned upon `elect`."] pub async fn queued_solution (& self , block_hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < :: core :: option :: Option < runtime_types :: pallet_election_provider_multi_phase :: ReadySolution < :: subxt :: sp_core :: crypto :: AccountId32 > > , :: subxt :: BasicError >{ + if self.client.metadata().storage_hash::()? + == [ + 145u8, 177u8, 147u8, 52u8, 30u8, 135u8, 33u8, 145u8, 204u8, + 82u8, 1u8, 165u8, 208u8, 39u8, 181u8, 2u8, 96u8, 236u8, 19u8, + 144u8, 87u8, 197u8, 25u8, 164u8, 116u8, 0u8, 120u8, 245u8, + 154u8, 30u8, 191u8, 155u8, + ] + { + let entry = QueuedSolution; + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Snapshot data of the round."] #[doc = ""] - #[doc = " This is created at the beginning of the signed phase and cleared upon calling `elect`."] pub async fn snapshot (& self , hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < :: core :: option :: Option < runtime_types :: pallet_election_provider_multi_phase :: RoundSnapshot > , :: subxt :: BasicError >{ - let entry = Snapshot; - self.client.storage().fetch(&entry, hash).await + #[doc = " This is created at the beginning of the signed phase and cleared upon calling `elect`."] pub async fn snapshot (& self , block_hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < :: core :: option :: Option < runtime_types :: pallet_election_provider_multi_phase :: RoundSnapshot > , :: subxt :: BasicError >{ + if self.client.metadata().storage_hash::()? + == [ + 28u8, 163u8, 105u8, 94u8, 66u8, 226u8, 134u8, 29u8, 210u8, + 211u8, 182u8, 236u8, 180u8, 109u8, 203u8, 44u8, 1u8, 50u8, + 112u8, 201u8, 200u8, 12u8, 88u8, 248u8, 253u8, 182u8, 56u8, + 156u8, 169u8, 179u8, 19u8, 161u8, + ] + { + let entry = Snapshot; + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Desired number of targets to elect for this round."] #[doc = ""] #[doc = " Only exists when [`Snapshot`] is present."] pub async fn desired_targets( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<::core::primitive::u32>, ::subxt::BasicError, > { - let entry = DesiredTargets; - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 16u8, 247u8, 4u8, 181u8, 93u8, 79u8, 12u8, 212u8, 146u8, + 167u8, 80u8, 58u8, 118u8, 52u8, 68u8, 87u8, 90u8, 140u8, + 31u8, 210u8, 2u8, 116u8, 220u8, 231u8, 115u8, 112u8, 118u8, + 118u8, 68u8, 34u8, 151u8, 165u8, + ] + { + let entry = DesiredTargets; + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The metadata of the [`RoundSnapshot`]"] #[doc = ""] - #[doc = " Only exists when [`Snapshot`] is present."] pub async fn snapshot_metadata (& self , hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < :: core :: option :: Option < runtime_types :: pallet_election_provider_multi_phase :: SolutionOrSnapshotSize > , :: subxt :: BasicError >{ - let entry = SnapshotMetadata; - self.client.storage().fetch(&entry, hash).await + #[doc = " Only exists when [`Snapshot`] is present."] pub async fn snapshot_metadata (& self , block_hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < :: core :: option :: Option < runtime_types :: pallet_election_provider_multi_phase :: SolutionOrSnapshotSize > , :: subxt :: BasicError >{ + if self.client.metadata().storage_hash::()? + == [ + 240u8, 57u8, 126u8, 76u8, 84u8, 244u8, 120u8, 136u8, 164u8, + 49u8, 185u8, 89u8, 126u8, 18u8, 117u8, 235u8, 33u8, 226u8, + 173u8, 254u8, 79u8, 194u8, 154u8, 123u8, 29u8, 237u8, 116u8, + 185u8, 36u8, 248u8, 46u8, 103u8, + ] + { + let entry = SnapshotMetadata; + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The next index to be assigned to an incoming signed submission."] #[doc = ""] @@ -17158,20 +24363,54 @@ pub mod api { #[doc = " because iteration is slow. Instead, we store the value here."] pub async fn signed_submission_next_index( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let entry = SignedSubmissionNextIndex; - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 242u8, 11u8, 157u8, 105u8, 96u8, 7u8, 31u8, 20u8, 51u8, + 141u8, 182u8, 180u8, 13u8, 172u8, 155u8, 59u8, 42u8, 238u8, + 115u8, 8u8, 6u8, 137u8, 45u8, 2u8, 123u8, 187u8, 53u8, 215u8, + 19u8, 129u8, 54u8, 22u8, + ] + { + let entry = SignedSubmissionNextIndex; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " A sorted, bounded set of `(score, index)`, where each `index` points to a value in"] #[doc = " `SignedSubmissions`."] #[doc = ""] #[doc = " We never need to process more than a single signed submission at a time. Signed submissions"] #[doc = " can be quite large, so we're willing to pay the cost of multiple database accesses to access"] - #[doc = " them one at a time instead of reading and decoding all of them at once."] pub async fn signed_submission_indices (& self , hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < runtime_types :: frame_support :: storage :: bounded_btree_map :: BoundedBTreeMap < runtime_types :: sp_npos_elections :: ElectionScore , :: core :: primitive :: u32 > , :: subxt :: BasicError >{ - let entry = SignedSubmissionIndices; - self.client.storage().fetch_or_default(&entry, hash).await + #[doc = " them one at a time instead of reading and decoding all of them at once."] pub async fn signed_submission_indices (& self , block_hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < runtime_types :: frame_support :: storage :: bounded_btree_map :: BoundedBTreeMap < runtime_types :: sp_npos_elections :: ElectionScore , :: core :: primitive :: u32 > , :: subxt :: BasicError >{ + if self + .client + .metadata() + .storage_hash::()? + == [ + 191u8, 143u8, 241u8, 251u8, 74u8, 9u8, 145u8, 136u8, 135u8, + 76u8, 182u8, 85u8, 140u8, 252u8, 58u8, 183u8, 217u8, 121u8, + 213u8, 200u8, 167u8, 89u8, 15u8, 212u8, 62u8, 90u8, 192u8, + 214u8, 130u8, 196u8, 14u8, 175u8, + ] + { + let entry = SignedSubmissionIndices; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Unchecked, signed solutions."] #[doc = ""] @@ -17179,9 +24418,23 @@ pub mod api { #[doc = " allowing us to keep only a single one in memory at a time."] #[doc = ""] #[doc = " Twox note: the key of the map is an auto-incrementing index which users cannot inspect or"] - #[doc = " affect; we shouldn't need a cryptographically secure hasher."] pub async fn signed_submissions_map (& self , _0 : & :: core :: primitive :: u32 , hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < :: core :: option :: Option < runtime_types :: pallet_election_provider_multi_phase :: signed :: SignedSubmission < :: subxt :: sp_core :: crypto :: AccountId32 , :: core :: primitive :: u128 , runtime_types :: polkadot_runtime :: NposCompactSolution16 > > , :: subxt :: BasicError >{ - let entry = SignedSubmissionsMap(_0); - self.client.storage().fetch(&entry, hash).await + #[doc = " affect; we shouldn't need a cryptographically secure hasher."] pub async fn signed_submissions_map (& self , _0 : & :: core :: primitive :: u32 , block_hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < :: core :: option :: Option < runtime_types :: pallet_election_provider_multi_phase :: signed :: SignedSubmission < :: subxt :: sp_core :: crypto :: AccountId32 , :: core :: primitive :: u128 , runtime_types :: polkadot_runtime :: NposCompactSolution16 > > , :: subxt :: BasicError >{ + if self + .client + .metadata() + .storage_hash::()? + == [ + 94u8, 51u8, 117u8, 215u8, 100u8, 250u8, 9u8, 70u8, 131u8, + 21u8, 2u8, 142u8, 177u8, 117u8, 21u8, 190u8, 10u8, 15u8, + 183u8, 214u8, 6u8, 169u8, 141u8, 169u8, 23u8, 136u8, 231u8, + 130u8, 48u8, 126u8, 198u8, 173u8, + ] + { + let entry = SignedSubmissionsMap(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Unchecked, signed solutions."] #[doc = ""] @@ -17192,12 +24445,26 @@ pub mod api { #[doc = " affect; we shouldn't need a cryptographically secure hasher."] pub async fn signed_submissions_map_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, SignedSubmissionsMap<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 94u8, 51u8, 117u8, 215u8, 100u8, 250u8, 9u8, 70u8, 131u8, + 21u8, 2u8, 142u8, 177u8, 117u8, 21u8, 190u8, 10u8, 15u8, + 183u8, 214u8, 6u8, 169u8, 141u8, 169u8, 23u8, 136u8, 231u8, + 130u8, 48u8, 126u8, 198u8, 173u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The minimum score that each 'untrusted' solution must attain in order to be considered"] #[doc = " feasible."] @@ -17205,15 +24472,29 @@ pub mod api { #[doc = " Can be set via `set_minimum_untrusted_score`."] pub async fn minimum_untrusted_score( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::sp_npos_elections::ElectionScore, >, ::subxt::BasicError, > { - let entry = MinimumUntrustedScore; - self.client.storage().fetch(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 18u8, 171u8, 56u8, 63u8, 7u8, 1u8, 53u8, 42u8, 72u8, 35u8, + 26u8, 124u8, 223u8, 95u8, 170u8, 176u8, 134u8, 140u8, 66u8, + 115u8, 51u8, 163u8, 202u8, 82u8, 189u8, 180u8, 139u8, 98u8, + 18u8, 14u8, 176u8, 66u8, + ] + { + let entry = MinimumUntrustedScore; + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -17231,26 +24512,56 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self + if self .client .metadata() - .pallet("ElectionProviderMultiPhase")?; - let constant = pallet.constant("UnsignedPhase")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + .constant_hash("ElectionProviderMultiPhase", "UnsignedPhase")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self + .client + .metadata() + .pallet("ElectionProviderMultiPhase")?; + let constant = pallet.constant("UnsignedPhase")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Duration of the signed phase."] pub fn signed_phase( &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self + if self .client .metadata() - .pallet("ElectionProviderMultiPhase")?; - let constant = pallet.constant("SignedPhase")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + .constant_hash("ElectionProviderMultiPhase", "SignedPhase")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self + .client + .metadata() + .pallet("ElectionProviderMultiPhase")?; + let constant = pallet.constant("SignedPhase")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The minimum amount of improvement to the solution score that defines a solution as"] #[doc = " \"better\" (in any phase)."] @@ -17260,13 +24571,26 @@ pub mod api { runtime_types::sp_arithmetic::per_things::Perbill, ::subxt::BasicError, > { - let pallet = self - .client - .metadata() - .pallet("ElectionProviderMultiPhase")?; - let constant = pallet.constant("SolutionImprovementThreshold")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self.client.metadata().constant_hash( + "ElectionProviderMultiPhase", + "SolutionImprovementThreshold", + )? == [ + 26u8, 148u8, 47u8, 190u8, 51u8, 71u8, 203u8, 119u8, 167u8, 91u8, + 70u8, 11u8, 149u8, 155u8, 138u8, 91u8, 119u8, 0u8, 74u8, 83u8, + 16u8, 47u8, 129u8, 11u8, 81u8, 169u8, 79u8, 31u8, 161u8, 119u8, + 2u8, 38u8, + ] { + let pallet = self + .client + .metadata() + .pallet("ElectionProviderMultiPhase")?; + let constant = pallet.constant("SolutionImprovementThreshold")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The repeat threshold of the offchain worker."] #[doc = ""] @@ -17276,26 +24600,56 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self + if self .client .metadata() - .pallet("ElectionProviderMultiPhase")?; - let constant = pallet.constant("OffchainRepeat")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + .constant_hash("ElectionProviderMultiPhase", "OffchainRepeat")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self + .client + .metadata() + .pallet("ElectionProviderMultiPhase")?; + let constant = pallet.constant("OffchainRepeat")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The priority of the unsigned transaction submitted in the unsigned-phase"] pub fn miner_tx_priority( &self, ) -> ::core::result::Result<::core::primitive::u64, ::subxt::BasicError> { - let pallet = self + if self .client .metadata() - .pallet("ElectionProviderMultiPhase")?; - let constant = pallet.constant("MinerTxPriority")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + .constant_hash("ElectionProviderMultiPhase", "MinerTxPriority")? + == [ + 128u8, 214u8, 205u8, 242u8, 181u8, 142u8, 124u8, 231u8, + 190u8, 146u8, 59u8, 226u8, 157u8, 101u8, 103u8, 117u8, 249u8, + 65u8, 18u8, 191u8, 103u8, 119u8, 53u8, 85u8, 81u8, 96u8, + 220u8, 42u8, 184u8, 239u8, 42u8, 246u8, + ] + { + let pallet = self + .client + .metadata() + .pallet("ElectionProviderMultiPhase")?; + let constant = pallet.constant("MinerTxPriority")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Maximum weight that the miner should consume."] #[doc = ""] @@ -17305,13 +24659,28 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u64, ::subxt::BasicError> { - let pallet = self + if self .client .metadata() - .pallet("ElectionProviderMultiPhase")?; - let constant = pallet.constant("MinerMaxWeight")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + .constant_hash("ElectionProviderMultiPhase", "MinerMaxWeight")? + == [ + 128u8, 214u8, 205u8, 242u8, 181u8, 142u8, 124u8, 231u8, + 190u8, 146u8, 59u8, 226u8, 157u8, 101u8, 103u8, 117u8, 249u8, + 65u8, 18u8, 191u8, 103u8, 119u8, 53u8, 85u8, 81u8, 96u8, + 220u8, 42u8, 184u8, 239u8, 42u8, 246u8, + ] + { + let pallet = self + .client + .metadata() + .pallet("ElectionProviderMultiPhase")?; + let constant = pallet.constant("MinerMaxWeight")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Maximum number of signed submissions that can be queued."] #[doc = ""] @@ -17324,13 +24693,26 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self - .client - .metadata() - .pallet("ElectionProviderMultiPhase")?; - let constant = pallet.constant("SignedMaxSubmissions")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self.client.metadata().constant_hash( + "ElectionProviderMultiPhase", + "SignedMaxSubmissions", + )? == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, + 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, + 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, 203u8, 100u8, + 41u8, 145u8, + ] { + let pallet = self + .client + .metadata() + .pallet("ElectionProviderMultiPhase")?; + let constant = pallet.constant("SignedMaxSubmissions")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Maximum weight of a signed solution."] #[doc = ""] @@ -17339,65 +24721,134 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u64, ::subxt::BasicError> { - let pallet = self + if self .client .metadata() - .pallet("ElectionProviderMultiPhase")?; - let constant = pallet.constant("SignedMaxWeight")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + .constant_hash("ElectionProviderMultiPhase", "SignedMaxWeight")? + == [ + 128u8, 214u8, 205u8, 242u8, 181u8, 142u8, 124u8, 231u8, + 190u8, 146u8, 59u8, 226u8, 157u8, 101u8, 103u8, 117u8, 249u8, + 65u8, 18u8, 191u8, 103u8, 119u8, 53u8, 85u8, 81u8, 96u8, + 220u8, 42u8, 184u8, 239u8, 42u8, 246u8, + ] + { + let pallet = self + .client + .metadata() + .pallet("ElectionProviderMultiPhase")?; + let constant = pallet.constant("SignedMaxWeight")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Base reward for a signed solution"] pub fn signed_reward_base( &self, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let pallet = self + if self .client .metadata() - .pallet("ElectionProviderMultiPhase")?; - let constant = pallet.constant("SignedRewardBase")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + .constant_hash("ElectionProviderMultiPhase", "SignedRewardBase")? + == [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, + 200u8, 214u8, 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, + 101u8, 54u8, 210u8, 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, + 15u8, 178u8, 98u8, 148u8, 156u8, + ] + { + let pallet = self + .client + .metadata() + .pallet("ElectionProviderMultiPhase")?; + let constant = pallet.constant("SignedRewardBase")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Base deposit for a signed solution."] pub fn signed_deposit_base( &self, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let pallet = self - .client - .metadata() - .pallet("ElectionProviderMultiPhase")?; - let constant = pallet.constant("SignedDepositBase")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self.client.metadata().constant_hash( + "ElectionProviderMultiPhase", + "SignedDepositBase", + )? == [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, 200u8, + 214u8, 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, 101u8, + 54u8, 210u8, 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, 15u8, 178u8, + 98u8, 148u8, 156u8, + ] { + let pallet = self + .client + .metadata() + .pallet("ElectionProviderMultiPhase")?; + let constant = pallet.constant("SignedDepositBase")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Per-byte deposit for a signed solution."] pub fn signed_deposit_byte( &self, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let pallet = self - .client - .metadata() - .pallet("ElectionProviderMultiPhase")?; - let constant = pallet.constant("SignedDepositByte")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self.client.metadata().constant_hash( + "ElectionProviderMultiPhase", + "SignedDepositByte", + )? == [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, 200u8, + 214u8, 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, 101u8, + 54u8, 210u8, 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, 15u8, 178u8, + 98u8, 148u8, 156u8, + ] { + let pallet = self + .client + .metadata() + .pallet("ElectionProviderMultiPhase")?; + let constant = pallet.constant("SignedDepositByte")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Per-weight deposit for a signed solution."] pub fn signed_deposit_weight( &self, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let pallet = self - .client - .metadata() - .pallet("ElectionProviderMultiPhase")?; - let constant = pallet.constant("SignedDepositWeight")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self.client.metadata().constant_hash( + "ElectionProviderMultiPhase", + "SignedDepositWeight", + )? == [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, 200u8, + 214u8, 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, 101u8, + 54u8, 210u8, 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, 15u8, 178u8, + 98u8, 148u8, 156u8, + ] { + let pallet = self + .client + .metadata() + .pallet("ElectionProviderMultiPhase")?; + let constant = pallet.constant("SignedDepositWeight")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The maximum number of electing voters to put in the snapshot. At the moment, snapshots"] #[doc = " are only over a single block, but once multi-block elections are introduced they will"] @@ -17406,26 +24857,52 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self - .client - .metadata() - .pallet("ElectionProviderMultiPhase")?; - let constant = pallet.constant("MaxElectingVoters")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self.client.metadata().constant_hash( + "ElectionProviderMultiPhase", + "MaxElectingVoters", + )? == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, + 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, + 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, 203u8, 100u8, + 41u8, 145u8, + ] { + let pallet = self + .client + .metadata() + .pallet("ElectionProviderMultiPhase")?; + let constant = pallet.constant("MaxElectingVoters")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The maximum number of electable targets to put in the snapshot."] pub fn max_electable_targets( &self, ) -> ::core::result::Result<::core::primitive::u16, ::subxt::BasicError> { - let pallet = self - .client - .metadata() - .pallet("ElectionProviderMultiPhase")?; - let constant = pallet.constant("MaxElectableTargets")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self.client.metadata().constant_hash( + "ElectionProviderMultiPhase", + "MaxElectableTargets", + )? == [ + 116u8, 33u8, 2u8, 170u8, 181u8, 147u8, 171u8, 169u8, 167u8, + 227u8, 41u8, 144u8, 11u8, 236u8, 82u8, 100u8, 74u8, 60u8, 184u8, + 72u8, 169u8, 90u8, 208u8, 135u8, 15u8, 117u8, 10u8, 123u8, 128u8, + 193u8, 29u8, 70u8, + ] { + let pallet = self + .client + .metadata() + .pallet("ElectionProviderMultiPhase")?; + let constant = pallet.constant("MaxElectableTargets")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Maximum length (bytes) that the mined solution should consume."] #[doc = ""] @@ -17435,13 +24912,28 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self + if self .client .metadata() - .pallet("ElectionProviderMultiPhase")?; - let constant = pallet.constant("MinerMaxLength")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + .constant_hash("ElectionProviderMultiPhase", "MinerMaxLength")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self + .client + .metadata() + .pallet("ElectionProviderMultiPhase")?; + let constant = pallet.constant("MinerMaxLength")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -17499,16 +24991,30 @@ pub mod api { pub fn rebag( &self, dislocated: ::subxt::sp_core::crypto::AccountId32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Rebag, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Rebag, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = Rebag { dislocated }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 46u8, 138u8, 28u8, 6u8, 58u8, 153u8, 5u8, 41u8, 44u8, 7u8, + 228u8, 72u8, 135u8, 184u8, 185u8, 132u8, 146u8, 181u8, 47u8, + 166u8, 149u8, 21u8, 155u8, 29u8, 159u8, 79u8, 83u8, 137u8, + 156u8, 17u8, 60u8, 23u8, + ] + { + let call = Rebag { dislocated }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Move the caller's Id directly in front of `lighter`."] #[doc = ""] @@ -17521,16 +25027,30 @@ pub mod api { pub fn put_in_front_of( &self, lighter: ::subxt::sp_core::crypto::AccountId32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - PutInFrontOf, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + PutInFrontOf, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = PutInFrontOf { lighter }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 79u8, 254u8, 222u8, 19u8, 17u8, 80u8, 7u8, 68u8, 54u8, 9u8, + 23u8, 133u8, 108u8, 29u8, 166u8, 177u8, 230u8, 247u8, 226u8, + 189u8, 3u8, 241u8, 100u8, 178u8, 234u8, 204u8, 118u8, 215u8, + 84u8, 28u8, 21u8, 136u8, + ] + { + let call = PutInFrontOf { lighter }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -17597,34 +25117,73 @@ pub mod api { pub async fn list_nodes( &self, _0: &::subxt::sp_core::crypto::AccountId32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option, ::subxt::BasicError, > { - let entry = ListNodes(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 114u8, 219u8, 206u8, 128u8, 160u8, 134u8, 95u8, 214u8, 195u8, + 15u8, 140u8, 174u8, 89u8, 85u8, 191u8, 85u8, 96u8, 58u8, + 214u8, 128u8, 6u8, 238u8, 148u8, 141u8, 206u8, 107u8, 68u8, + 41u8, 35u8, 246u8, 169u8, 209u8, + ] + { + let entry = ListNodes(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " A single node, within some bag."] #[doc = ""] #[doc = " Nodes store links forward and back within their respective bags."] pub async fn list_nodes_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, ListNodes<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 114u8, 219u8, 206u8, 128u8, 160u8, 134u8, 95u8, 214u8, 195u8, + 15u8, 140u8, 174u8, 89u8, 85u8, 191u8, 85u8, 96u8, 58u8, + 214u8, 128u8, 6u8, 238u8, 148u8, 141u8, 206u8, 107u8, 68u8, + 41u8, 35u8, 246u8, 169u8, 209u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Counter for the related counted storage map"] pub async fn counter_for_list_nodes( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let entry = CounterForListNodes; - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 156u8, 168u8, 97u8, 33u8, 84u8, 117u8, 220u8, 89u8, 62u8, + 182u8, 24u8, 88u8, 231u8, 244u8, 41u8, 19u8, 210u8, 131u8, + 87u8, 0u8, 241u8, 230u8, 160u8, 142u8, 128u8, 153u8, 83u8, + 36u8, 88u8, 247u8, 70u8, 130u8, + ] + { + let entry = CounterForListNodes; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " A bag stored in storage."] #[doc = ""] @@ -17632,25 +25191,47 @@ pub mod api { pub async fn list_bags( &self, _0: &::core::primitive::u64, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option, ::subxt::BasicError, > { - let entry = ListBags(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 117u8, 35u8, 42u8, 116u8, 5u8, 68u8, 168u8, 75u8, 112u8, + 29u8, 54u8, 49u8, 169u8, 103u8, 22u8, 163u8, 53u8, 122u8, + 181u8, 32u8, 97u8, 41u8, 56u8, 89u8, 77u8, 200u8, 0u8, 123u8, + 226u8, 178u8, 81u8, 138u8, + ] + { + let entry = ListBags(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " A bag stored in storage."] #[doc = ""] #[doc = " Stores a `Bag` struct, which stores head and tail pointers to itself."] pub async fn list_bags_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, ListBags<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 117u8, 35u8, 42u8, 116u8, 5u8, 68u8, 168u8, 75u8, 112u8, + 29u8, 54u8, 49u8, 169u8, 103u8, 22u8, 163u8, 53u8, 122u8, + 181u8, 32u8, 97u8, 41u8, 56u8, 89u8, 77u8, 200u8, 0u8, 123u8, + 226u8, 178u8, 81u8, 138u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -17712,10 +25293,25 @@ pub mod api { ::std::vec::Vec<::core::primitive::u64>, ::subxt::BasicError, > { - let pallet = self.client.metadata().pallet("BagsList")?; - let constant = pallet.constant("BagThresholds")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("BagsList", "BagThresholds")? + == [ + 103u8, 102u8, 255u8, 165u8, 124u8, 54u8, 5u8, 172u8, 112u8, + 234u8, 25u8, 175u8, 178u8, 19u8, 251u8, 73u8, 91u8, 192u8, + 227u8, 81u8, 249u8, 45u8, 126u8, 116u8, 7u8, 37u8, 9u8, + 200u8, 167u8, 182u8, 12u8, 131u8, + ] + { + let pallet = self.client.metadata().pallet("BagsList")?; + let constant = pallet.constant("BagThresholds")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -18324,648 +25920,1343 @@ pub mod api { pub fn set_validation_upgrade_cooldown( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetValidationUpgradeCooldown, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetValidationUpgradeCooldown, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetValidationUpgradeCooldown { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 153u8, 60u8, 171u8, 164u8, 241u8, 214u8, 235u8, 141u8, 4u8, + 32u8, 129u8, 253u8, 128u8, 148u8, 185u8, 51u8, 65u8, 34u8, + 68u8, 72u8, 202u8, 159u8, 74u8, 243u8, 35u8, 138u8, 208u8, + 26u8, 182u8, 189u8, 41u8, 11u8, + ] + { + let call = SetValidationUpgradeCooldown { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set the validation upgrade delay."] pub fn set_validation_upgrade_delay( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetValidationUpgradeDelay, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetValidationUpgradeDelay, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetValidationUpgradeDelay { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 136u8, 220u8, 63u8, 166u8, 202u8, 19u8, 241u8, 32u8, 100u8, + 14u8, 101u8, 244u8, 241u8, 141u8, 144u8, 213u8, 185u8, 88u8, + 193u8, 2u8, 55u8, 154u8, 24u8, 77u8, 66u8, 167u8, 69u8, + 245u8, 224u8, 63u8, 196u8, 200u8, + ] + { + let call = SetValidationUpgradeDelay { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set the acceptance period for an included candidate."] pub fn set_code_retention_period( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetCodeRetentionPeriod, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetCodeRetentionPeriod, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetCodeRetentionPeriod { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 94u8, 104u8, 13u8, 127u8, 95u8, 137u8, 66u8, 224u8, 22u8, + 53u8, 14u8, 161u8, 67u8, 85u8, 78u8, 161u8, 92u8, 81u8, + 190u8, 213u8, 113u8, 235u8, 64u8, 19u8, 112u8, 164u8, 71u8, + 88u8, 183u8, 234u8, 237u8, 9u8, + ] + { + let call = SetCodeRetentionPeriod { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set the max validation code size for incoming upgrades."] pub fn set_max_code_size( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetMaxCodeSize, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetMaxCodeSize, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetMaxCodeSize { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 74u8, 39u8, 190u8, 155u8, 121u8, 60u8, 233u8, 95u8, 177u8, + 57u8, 116u8, 107u8, 200u8, 44u8, 2u8, 215u8, 209u8, 50u8, + 37u8, 112u8, 136u8, 107u8, 202u8, 142u8, 114u8, 25u8, 43u8, + 134u8, 250u8, 15u8, 81u8, 13u8, + ] + { + let call = SetMaxCodeSize { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set the max POV block size for incoming upgrades."] pub fn set_max_pov_size( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetMaxPovSize, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetMaxPovSize, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetMaxPovSize { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 77u8, 199u8, 18u8, 53u8, 223u8, 107u8, 57u8, 141u8, 8u8, + 138u8, 180u8, 175u8, 73u8, 88u8, 205u8, 185u8, 56u8, 106u8, + 43u8, 87u8, 109u8, 9u8, 103u8, 103u8, 50u8, 158u8, 11u8, + 77u8, 162u8, 38u8, 57u8, 27u8, + ] + { + let call = SetMaxPovSize { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set the max head data size for paras."] pub fn set_max_head_data_size( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetMaxHeadDataSize, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetMaxHeadDataSize, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetMaxHeadDataSize { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 30u8, 132u8, 5u8, 207u8, 126u8, 145u8, 187u8, 129u8, 36u8, + 235u8, 179u8, 61u8, 243u8, 87u8, 178u8, 107u8, 8u8, 21u8, + 43u8, 39u8, 119u8, 138u8, 146u8, 146u8, 109u8, 189u8, 56u8, + 160u8, 14u8, 78u8, 230u8, 149u8, + ] + { + let call = SetMaxHeadDataSize { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set the number of parathread execution cores."] pub fn set_parathread_cores( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetParathreadCores, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetParathreadCores, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetParathreadCores { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 5u8, 198u8, 156u8, 226u8, 125u8, 16u8, 2u8, 64u8, 28u8, + 189u8, 213u8, 85u8, 6u8, 112u8, 173u8, 183u8, 174u8, 207u8, + 129u8, 110u8, 201u8, 161u8, 163u8, 191u8, 20u8, 14u8, 65u8, + 106u8, 234u8, 203u8, 39u8, 75u8, + ] + { + let call = SetParathreadCores { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set the number of retries for a particular parathread."] pub fn set_parathread_retries( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetParathreadRetries, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetParathreadRetries, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetParathreadRetries { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 146u8, 134u8, 204u8, 109u8, 167u8, 35u8, 255u8, 245u8, 98u8, + 24u8, 213u8, 33u8, 144u8, 194u8, 196u8, 196u8, 66u8, 220u8, + 168u8, 156u8, 171u8, 179u8, 154u8, 30u8, 221u8, 45u8, 65u8, + 192u8, 194u8, 130u8, 87u8, 100u8, + ] + { + let call = SetParathreadRetries { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set the parachain validator-group rotation frequency"] pub fn set_group_rotation_frequency( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetGroupRotationFrequency, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetGroupRotationFrequency, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetGroupRotationFrequency { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 102u8, 192u8, 226u8, 120u8, 69u8, 117u8, 239u8, 156u8, 111u8, + 239u8, 197u8, 191u8, 221u8, 18u8, 140u8, 214u8, 154u8, 212u8, + 151u8, 35u8, 176u8, 2u8, 162u8, 131u8, 115u8, 102u8, 177u8, + 106u8, 35u8, 214u8, 151u8, 227u8, + ] + { + let call = SetGroupRotationFrequency { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set the availability period for parachains."] pub fn set_chain_availability_period( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetChainAvailabilityPeriod, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetChainAvailabilityPeriod, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetChainAvailabilityPeriod { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 3u8, 83u8, 31u8, 241u8, 73u8, 137u8, 18u8, 95u8, 119u8, + 143u8, 28u8, 110u8, 151u8, 229u8, 172u8, 208u8, 50u8, 25u8, + 89u8, 222u8, 128u8, 125u8, 112u8, 25u8, 204u8, 141u8, 175u8, + 69u8, 57u8, 161u8, 189u8, 167u8, + ] + { + let call = SetChainAvailabilityPeriod { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set the availability period for parathreads."] pub fn set_thread_availability_period( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetThreadAvailabilityPeriod, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetThreadAvailabilityPeriod, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetThreadAvailabilityPeriod { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 242u8, 204u8, 158u8, 5u8, 123u8, 163u8, 6u8, 209u8, 44u8, + 73u8, 112u8, 249u8, 96u8, 160u8, 188u8, 151u8, 107u8, 21u8, + 9u8, 100u8, 104u8, 184u8, 97u8, 77u8, 122u8, 254u8, 88u8, + 94u8, 22u8, 15u8, 57u8, 44u8, + ] + { + let call = SetThreadAvailabilityPeriod { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set the scheduling lookahead, in expected number of blocks at peak throughput."] pub fn set_scheduling_lookahead( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetSchedulingLookahead, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetSchedulingLookahead, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetSchedulingLookahead { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 146u8, 149u8, 10u8, 57u8, 122u8, 116u8, 61u8, 181u8, 97u8, + 240u8, 87u8, 37u8, 227u8, 233u8, 123u8, 26u8, 243u8, 58u8, + 54u8, 93u8, 111u8, 204u8, 108u8, 18u8, 167u8, 20u8, 255u8, + 173u8, 46u8, 212u8, 246u8, 201u8, + ] + { + let call = SetSchedulingLookahead { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set the maximum number of validators to assign to any core."] pub fn set_max_validators_per_core( &self, new: ::core::option::Option<::core::primitive::u32>, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetMaxValidatorsPerCore, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetMaxValidatorsPerCore, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetMaxValidatorsPerCore { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 27u8, 160u8, 153u8, 252u8, 121u8, 42u8, 94u8, 131u8, 199u8, + 216u8, 15u8, 65u8, 94u8, 69u8, 127u8, 130u8, 179u8, 236u8, + 49u8, 32u8, 239u8, 37u8, 58u8, 0u8, 50u8, 5u8, 255u8, 30u8, + 203u8, 230u8, 135u8, 202u8, + ] + { + let call = SetMaxValidatorsPerCore { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set the maximum number of validators to use in parachain consensus."] pub fn set_max_validators( &self, new: ::core::option::Option<::core::primitive::u32>, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetMaxValidators, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetMaxValidators, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetMaxValidators { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 192u8, 156u8, 115u8, 10u8, 225u8, 94u8, 190u8, 180u8, 242u8, + 131u8, 202u8, 13u8, 82u8, 27u8, 8u8, 144u8, 70u8, 92u8, + 136u8, 206u8, 205u8, 3u8, 242u8, 130u8, 77u8, 114u8, 242u8, + 111u8, 99u8, 24u8, 238u8, 55u8, + ] + { + let call = SetMaxValidators { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set the dispute period, in number of sessions to keep for disputes."] pub fn set_dispute_period( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetDisputePeriod, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetDisputePeriod, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetDisputePeriod { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 232u8, 96u8, 104u8, 249u8, 183u8, 148u8, 126u8, 80u8, 64u8, + 39u8, 2u8, 208u8, 183u8, 189u8, 139u8, 201u8, 61u8, 63u8, + 42u8, 155u8, 215u8, 32u8, 212u8, 158u8, 90u8, 80u8, 159u8, + 23u8, 249u8, 204u8, 218u8, 217u8, + ] + { + let call = SetDisputePeriod { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set the dispute post conclusion acceptance period."] pub fn set_dispute_post_conclusion_acceptance_period( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetDisputePostConclusionAcceptancePeriod, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetDisputePostConclusionAcceptancePeriod, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetDisputePostConclusionAcceptancePeriod { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 45u8, 140u8, 213u8, 62u8, 212u8, 31u8, 126u8, 94u8, 102u8, + 176u8, 203u8, 240u8, 28u8, 25u8, 116u8, 77u8, 187u8, 147u8, + 32u8, 20u8, 25u8, 124u8, 164u8, 162u8, 246u8, 223u8, 146u8, + 28u8, 35u8, 4u8, 174u8, 47u8, + ] + { + let call = SetDisputePostConclusionAcceptancePeriod { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set the maximum number of dispute spam slots."] pub fn set_dispute_max_spam_slots( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetDisputeMaxSpamSlots, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetDisputeMaxSpamSlots, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetDisputeMaxSpamSlots { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 180u8, 195u8, 6u8, 141u8, 89u8, 252u8, 245u8, 202u8, 36u8, + 123u8, 105u8, 35u8, 161u8, 60u8, 233u8, 213u8, 191u8, 65u8, + 68u8, 4u8, 19u8, 201u8, 226u8, 103u8, 124u8, 181u8, 201u8, + 91u8, 84u8, 170u8, 48u8, 154u8, + ] + { + let call = SetDisputeMaxSpamSlots { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set the dispute conclusion by time out period."] pub fn set_dispute_conclusion_by_time_out_period( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetDisputeConclusionByTimeOutPeriod, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetDisputeConclusionByTimeOutPeriod, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetDisputeConclusionByTimeOutPeriod { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 50u8, 221u8, 129u8, 199u8, 147u8, 98u8, 11u8, 104u8, 133u8, + 161u8, 53u8, 163u8, 100u8, 155u8, 228u8, 167u8, 146u8, 87u8, + 186u8, 228u8, 147u8, 44u8, 142u8, 160u8, 119u8, 146u8, 10u8, + 155u8, 5u8, 35u8, 8u8, 165u8, + ] + { + let call = SetDisputeConclusionByTimeOutPeriod { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set the no show slots, in number of number of consensus slots."] #[doc = "Must be at least 1."] pub fn set_no_show_slots( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetNoShowSlots, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetNoShowSlots, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetNoShowSlots { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 235u8, 5u8, 35u8, 159u8, 200u8, 58u8, 171u8, 179u8, 78u8, + 70u8, 161u8, 47u8, 237u8, 245u8, 77u8, 81u8, 1u8, 138u8, + 145u8, 137u8, 45u8, 126u8, 255u8, 227u8, 130u8, 217u8, 36u8, + 251u8, 72u8, 235u8, 16u8, 231u8, + ] + { + let call = SetNoShowSlots { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set the total number of delay tranches."] pub fn set_n_delay_tranches( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetNDelayTranches, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetNDelayTranches, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetNDelayTranches { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 109u8, 208u8, 13u8, 18u8, 178u8, 117u8, 101u8, 169u8, 162u8, + 255u8, 28u8, 88u8, 199u8, 89u8, 83u8, 59u8, 46u8, 105u8, + 186u8, 4u8, 7u8, 171u8, 78u8, 122u8, 197u8, 110u8, 63u8, + 164u8, 140u8, 59u8, 179u8, 236u8, + ] + { + let call = SetNDelayTranches { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set the zeroth delay tranche width."] pub fn set_zeroth_delay_tranche_width( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetZerothDelayTrancheWidth, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetZerothDelayTrancheWidth, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetZerothDelayTrancheWidth { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 162u8, 20u8, 162u8, 90u8, 59u8, 194u8, 147u8, 255u8, 198u8, + 203u8, 50u8, 13u8, 134u8, 142u8, 6u8, 156u8, 205u8, 128u8, + 222u8, 225u8, 150u8, 68u8, 198u8, 212u8, 198u8, 238u8, 3u8, + 209u8, 224u8, 19u8, 118u8, 147u8, + ] + { + let call = SetZerothDelayTrancheWidth { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set the number of validators needed to approve a block."] pub fn set_needed_approvals( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetNeededApprovals, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetNeededApprovals, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetNeededApprovals { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 83u8, 164u8, 204u8, 168u8, 93u8, 165u8, 118u8, 111u8, 149u8, + 129u8, 126u8, 250u8, 95u8, 148u8, 193u8, 173u8, 239u8, 1u8, + 14u8, 102u8, 77u8, 150u8, 149u8, 55u8, 82u8, 179u8, 2u8, + 117u8, 19u8, 34u8, 223u8, 173u8, + ] + { + let call = SetNeededApprovals { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set the number of samples to do of the `RelayVRFModulo` approval assignment criterion."] pub fn set_relay_vrf_modulo_samples( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetRelayVrfModuloSamples, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetRelayVrfModuloSamples, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetRelayVrfModuloSamples { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 22u8, 11u8, 132u8, 96u8, 58u8, 253u8, 183u8, 31u8, 137u8, + 231u8, 187u8, 145u8, 119u8, 164u8, 55u8, 142u8, 37u8, 151u8, + 227u8, 112u8, 113u8, 18u8, 200u8, 247u8, 238u8, 10u8, 223u8, + 74u8, 4u8, 132u8, 115u8, 119u8, + ] + { + let call = SetRelayVrfModuloSamples { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Sets the maximum items that can present in a upward dispatch queue at once."] pub fn set_max_upward_queue_count( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetMaxUpwardQueueCount, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetMaxUpwardQueueCount, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetMaxUpwardQueueCount { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 16u8, 31u8, 245u8, 94u8, 243u8, 122u8, 55u8, 155u8, 161u8, + 239u8, 5u8, 59u8, 186u8, 207u8, 136u8, 253u8, 255u8, 176u8, + 135u8, 242u8, 199u8, 96u8, 226u8, 150u8, 15u8, 160u8, 60u8, + 101u8, 66u8, 143u8, 93u8, 104u8, + ] + { + let call = SetMaxUpwardQueueCount { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Sets the maximum total size of items that can present in a upward dispatch queue at once."] pub fn set_max_upward_queue_size( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetMaxUpwardQueueSize, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetMaxUpwardQueueSize, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetMaxUpwardQueueSize { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 203u8, 170u8, 21u8, 149u8, 170u8, 246u8, 91u8, 54u8, 197u8, + 91u8, 41u8, 114u8, 210u8, 239u8, 73u8, 236u8, 68u8, 194u8, + 157u8, 116u8, 229u8, 1u8, 34u8, 135u8, 144u8, 191u8, 56u8, + 77u8, 13u8, 92u8, 221u8, 4u8, + ] + { + let call = SetMaxUpwardQueueSize { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set the critical downward message size."] pub fn set_max_downward_message_size( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetMaxDownwardMessageSize, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetMaxDownwardMessageSize, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetMaxDownwardMessageSize { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 55u8, 181u8, 6u8, 126u8, 31u8, 154u8, 42u8, 194u8, 64u8, + 23u8, 34u8, 255u8, 151u8, 186u8, 52u8, 32u8, 168u8, 233u8, + 44u8, 35u8, 152u8, 78u8, 230u8, 242u8, 169u8, 85u8, 103u8, + 133u8, 177u8, 239u8, 175u8, 119u8, + ] + { + let call = SetMaxDownwardMessageSize { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Sets the soft limit for the phase of dispatching dispatchable upward messages."] pub fn set_ump_service_total_weight( &self, new: ::core::primitive::u64, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetUmpServiceTotalWeight, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetUmpServiceTotalWeight, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetUmpServiceTotalWeight { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 14u8, 179u8, 217u8, 169u8, 84u8, 45u8, 193u8, 3u8, 7u8, + 196u8, 56u8, 209u8, 50u8, 148u8, 32u8, 205u8, 99u8, 202u8, + 72u8, 246u8, 151u8, 230u8, 145u8, 98u8, 188u8, 1u8, 136u8, + 241u8, 217u8, 37u8, 6u8, 101u8, + ] + { + let call = SetUmpServiceTotalWeight { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Sets the maximum size of an upward message that can be sent by a candidate."] pub fn set_max_upward_message_size( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetMaxUpwardMessageSize, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetMaxUpwardMessageSize, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetMaxUpwardMessageSize { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 134u8, 232u8, 5u8, 70u8, 81u8, 177u8, 81u8, 235u8, 93u8, + 145u8, 193u8, 42u8, 150u8, 61u8, 236u8, 20u8, 38u8, 176u8, + 124u8, 170u8, 248u8, 149u8, 57u8, 88u8, 17u8, 46u8, 202u8, + 74u8, 35u8, 82u8, 190u8, 223u8, + ] + { + let call = SetMaxUpwardMessageSize { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Sets the maximum number of messages that a candidate can contain."] pub fn set_max_upward_message_num_per_candidate( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetMaxUpwardMessageNumPerCandidate, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetMaxUpwardMessageNumPerCandidate, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetMaxUpwardMessageNumPerCandidate { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 14u8, 79u8, 128u8, 66u8, 119u8, 24u8, 26u8, 116u8, 249u8, + 254u8, 86u8, 228u8, 248u8, 75u8, 111u8, 90u8, 101u8, 96u8, + 124u8, 25u8, 245u8, 115u8, 119u8, 14u8, 213u8, 180u8, 224u8, + 224u8, 188u8, 172u8, 152u8, 16u8, + ] + { + let call = SetMaxUpwardMessageNumPerCandidate { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Sets the number of sessions after which an HRMP open channel request expires."] pub fn set_hrmp_open_request_ttl( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetHrmpOpenRequestTtl, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetHrmpOpenRequestTtl, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetHrmpOpenRequestTtl { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 168u8, 254u8, 189u8, 22u8, 61u8, 90u8, 131u8, 1u8, 103u8, + 208u8, 179u8, 85u8, 80u8, 215u8, 9u8, 3u8, 34u8, 73u8, 130u8, + 19u8, 166u8, 77u8, 131u8, 148u8, 183u8, 86u8, 186u8, 148u8, + 109u8, 173u8, 74u8, 94u8, + ] + { + let call = SetHrmpOpenRequestTtl { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Sets the amount of funds that the sender should provide for opening an HRMP channel."] pub fn set_hrmp_sender_deposit( &self, new: ::core::primitive::u128, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetHrmpSenderDeposit, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetHrmpSenderDeposit, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetHrmpSenderDeposit { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 250u8, 23u8, 196u8, 206u8, 34u8, 86u8, 28u8, 14u8, 110u8, + 189u8, 38u8, 39u8, 2u8, 16u8, 212u8, 32u8, 65u8, 249u8, + 120u8, 163u8, 89u8, 232u8, 3u8, 49u8, 155u8, 174u8, 96u8, + 21u8, 240u8, 185u8, 140u8, 243u8, + ] + { + let call = SetHrmpSenderDeposit { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Sets the amount of funds that the recipient should provide for accepting opening an HRMP"] #[doc = "channel."] pub fn set_hrmp_recipient_deposit( &self, new: ::core::primitive::u128, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetHrmpRecipientDeposit, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetHrmpRecipientDeposit, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetHrmpRecipientDeposit { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 104u8, 35u8, 129u8, 31u8, 111u8, 57u8, 190u8, 42u8, 159u8, + 220u8, 86u8, 136u8, 200u8, 4u8, 62u8, 241u8, 141u8, 90u8, + 200u8, 132u8, 141u8, 154u8, 117u8, 206u8, 79u8, 160u8, 124u8, + 186u8, 231u8, 250u8, 86u8, 87u8, + ] + { + let call = SetHrmpRecipientDeposit { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Sets the maximum number of messages allowed in an HRMP channel at once."] pub fn set_hrmp_channel_max_capacity( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetHrmpChannelMaxCapacity, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetHrmpChannelMaxCapacity, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetHrmpChannelMaxCapacity { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 211u8, 49u8, 82u8, 59u8, 16u8, 97u8, 253u8, 64u8, 185u8, + 216u8, 235u8, 10u8, 84u8, 194u8, 231u8, 115u8, 153u8, 20u8, + 31u8, 86u8, 47u8, 226u8, 245u8, 214u8, 134u8, 194u8, 13u8, + 254u8, 230u8, 66u8, 54u8, 240u8, + ] + { + let call = SetHrmpChannelMaxCapacity { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Sets the maximum total size of messages in bytes allowed in an HRMP channel at once."] pub fn set_hrmp_channel_max_total_size( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetHrmpChannelMaxTotalSize, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetHrmpChannelMaxTotalSize, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetHrmpChannelMaxTotalSize { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 254u8, 196u8, 171u8, 29u8, 208u8, 179u8, 204u8, 58u8, 64u8, + 41u8, 52u8, 73u8, 153u8, 245u8, 29u8, 132u8, 129u8, 29u8, + 94u8, 241u8, 136u8, 20u8, 12u8, 20u8, 255u8, 244u8, 252u8, + 98u8, 136u8, 222u8, 7u8, 19u8, + ] + { + let call = SetHrmpChannelMaxTotalSize { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Sets the maximum number of inbound HRMP channels a parachain is allowed to accept."] pub fn set_hrmp_max_parachain_inbound_channels( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetHrmpMaxParachainInboundChannels, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetHrmpMaxParachainInboundChannels, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetHrmpMaxParachainInboundChannels { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 219u8, 88u8, 3u8, 249u8, 16u8, 182u8, 182u8, 233u8, 152u8, + 24u8, 29u8, 96u8, 227u8, 50u8, 156u8, 98u8, 71u8, 196u8, + 158u8, 103u8, 114u8, 55u8, 65u8, 199u8, 211u8, 225u8, 235u8, + 172u8, 218u8, 123u8, 158u8, 57u8, + ] + { + let call = SetHrmpMaxParachainInboundChannels { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Sets the maximum number of inbound HRMP channels a parathread is allowed to accept."] pub fn set_hrmp_max_parathread_inbound_channels( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetHrmpMaxParathreadInboundChannels, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetHrmpMaxParathreadInboundChannels, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetHrmpMaxParathreadInboundChannels { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 153u8, 169u8, 153u8, 141u8, 45u8, 21u8, 26u8, 33u8, 207u8, + 234u8, 186u8, 154u8, 12u8, 148u8, 2u8, 226u8, 55u8, 125u8, + 58u8, 127u8, 154u8, 176u8, 3u8, 47u8, 164u8, 63u8, 25u8, + 42u8, 66u8, 131u8, 143u8, 254u8, + ] + { + let call = SetHrmpMaxParathreadInboundChannels { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Sets the maximum size of a message that could ever be put into an HRMP channel."] pub fn set_hrmp_channel_max_message_size( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetHrmpChannelMaxMessageSize, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetHrmpChannelMaxMessageSize, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetHrmpChannelMaxMessageSize { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 237u8, 103u8, 126u8, 197u8, 164u8, 247u8, 67u8, 144u8, 30u8, + 192u8, 161u8, 243u8, 254u8, 26u8, 254u8, 33u8, 59u8, 216u8, + 159u8, 105u8, 166u8, 138u8, 38u8, 124u8, 248u8, 81u8, 11u8, + 223u8, 120u8, 75u8, 176u8, 177u8, + ] + { + let call = SetHrmpChannelMaxMessageSize { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Sets the maximum number of outbound HRMP channels a parachain is allowed to open."] pub fn set_hrmp_max_parachain_outbound_channels( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetHrmpMaxParachainOutboundChannels, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetHrmpMaxParachainOutboundChannels, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetHrmpMaxParachainOutboundChannels { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 173u8, 184u8, 49u8, 66u8, 158u8, 142u8, 95u8, 225u8, 90u8, + 171u8, 4u8, 20u8, 210u8, 180u8, 54u8, 236u8, 60u8, 5u8, 76u8, + 173u8, 226u8, 203u8, 7u8, 156u8, 54u8, 9u8, 198u8, 171u8, + 250u8, 1u8, 120u8, 240u8, + ] + { + let call = SetHrmpMaxParachainOutboundChannels { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Sets the maximum number of outbound HRMP channels a parathread is allowed to open."] pub fn set_hrmp_max_parathread_outbound_channels( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetHrmpMaxParathreadOutboundChannels, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetHrmpMaxParathreadOutboundChannels, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetHrmpMaxParathreadOutboundChannels { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 166u8, 73u8, 121u8, 53u8, 27u8, 77u8, 150u8, 115u8, 29u8, + 202u8, 34u8, 4u8, 35u8, 161u8, 113u8, 15u8, 66u8, 60u8, + 214u8, 129u8, 157u8, 143u8, 227u8, 134u8, 213u8, 9u8, 231u8, + 224u8, 187u8, 36u8, 16u8, 68u8, + ] + { + let call = SetHrmpMaxParathreadOutboundChannels { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Sets the maximum number of outbound HRMP messages can be sent by a candidate."] pub fn set_hrmp_max_message_num_per_candidate( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetHrmpMaxMessageNumPerCandidate, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetHrmpMaxMessageNumPerCandidate, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetHrmpMaxMessageNumPerCandidate { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 235u8, 47u8, 114u8, 29u8, 87u8, 198u8, 62u8, 200u8, 235u8, + 184u8, 204u8, 35u8, 251u8, 210u8, 88u8, 150u8, 22u8, 61u8, + 242u8, 196u8, 240u8, 76u8, 45u8, 54u8, 155u8, 111u8, 244u8, + 31u8, 158u8, 48u8, 68u8, 233u8, + ] + { + let call = SetHrmpMaxMessageNumPerCandidate { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Sets the maximum amount of weight any individual upward message may consume."] pub fn set_ump_max_individual_weight( &self, new: ::core::primitive::u64, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetUmpMaxIndividualWeight, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetUmpMaxIndividualWeight, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetUmpMaxIndividualWeight { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 61u8, 174u8, 42u8, 53u8, 120u8, 56u8, 252u8, 117u8, 173u8, + 223u8, 100u8, 141u8, 209u8, 29u8, 173u8, 240u8, 180u8, 113u8, + 27u8, 24u8, 4u8, 157u8, 107u8, 247u8, 235u8, 121u8, 152u8, + 6u8, 176u8, 254u8, 18u8, 70u8, + ] + { + let call = SetUmpMaxIndividualWeight { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Enable or disable PVF pre-checking. Consult the field documentation prior executing."] pub fn set_pvf_checking_enabled( &self, new: ::core::primitive::bool, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetPvfCheckingEnabled, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetPvfCheckingEnabled, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetPvfCheckingEnabled { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 224u8, 199u8, 197u8, 208u8, 178u8, 211u8, 14u8, 102u8, 174u8, + 205u8, 207u8, 181u8, 75u8, 125u8, 209u8, 69u8, 85u8, 1u8, + 98u8, 251u8, 17u8, 42u8, 73u8, 9u8, 252u8, 184u8, 81u8, + 202u8, 132u8, 236u8, 97u8, 121u8, + ] + { + let call = SetPvfCheckingEnabled { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set the number of session changes after which a PVF pre-checking voting is rejected."] pub fn set_pvf_voting_ttl( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetPvfVotingTtl, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetPvfVotingTtl, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetPvfVotingTtl { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 179u8, 71u8, 42u8, 140u8, 187u8, 43u8, 138u8, 16u8, 104u8, + 41u8, 30u8, 220u8, 131u8, 179u8, 200u8, 184u8, 105u8, 58u8, + 131u8, 225u8, 169u8, 253u8, 46u8, 186u8, 102u8, 52u8, 147u8, + 244u8, 22u8, 255u8, 41u8, 6u8, + ] + { + let call = SetPvfVotingTtl { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Sets the minimum delay between announcing the upgrade block for a parachain until the"] #[doc = "upgrade taking place."] @@ -18974,32 +27265,66 @@ pub mod api { pub fn set_minimum_validation_upgrade_delay( &self, new: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetMinimumValidationUpgradeDelay, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetMinimumValidationUpgradeDelay, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetMinimumValidationUpgradeDelay { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 225u8, 178u8, 41u8, 194u8, 154u8, 222u8, 247u8, 129u8, 35u8, + 102u8, 248u8, 144u8, 21u8, 74u8, 42u8, 239u8, 135u8, 205u8, + 173u8, 190u8, 112u8, 30u8, 240u8, 106u8, 10u8, 217u8, 208u8, + 11u8, 79u8, 47u8, 198u8, 37u8, + ] + { + let call = SetMinimumValidationUpgradeDelay { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Setting this to true will disable consistency checks for the configuration setters."] #[doc = "Use with caution."] pub fn set_bypass_consistency_check( &self, new: ::core::primitive::bool, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - SetBypassConsistencyCheck, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + SetBypassConsistencyCheck, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = SetBypassConsistencyCheck { new }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 5u8, 54u8, 178u8, 218u8, 46u8, 61u8, 99u8, 23u8, 227u8, + 202u8, 201u8, 164u8, 121u8, 226u8, 65u8, 253u8, 29u8, 164u8, + 170u8, 130u8, 32u8, 85u8, 222u8, 10u8, 232u8, 252u8, 73u8, + 23u8, 69u8, 30u8, 1u8, 87u8, + ] + { + let call = SetBypassConsistencyCheck { new }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -19051,27 +27376,63 @@ pub mod api { pub fn new(client: &'a ::subxt::Client) -> Self { Self { client } } - #[doc = " The active configuration for the current session."] pub async fn active_config (& self , hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < runtime_types :: polkadot_runtime_parachains :: configuration :: HostConfiguration < :: core :: primitive :: u32 > , :: subxt :: BasicError >{ - let entry = ActiveConfig; - self.client.storage().fetch_or_default(&entry, hash).await + #[doc = " The active configuration for the current session."] pub async fn active_config (& self , block_hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < runtime_types :: polkadot_runtime_parachains :: configuration :: HostConfiguration < :: core :: primitive :: u32 > , :: subxt :: BasicError >{ + if self.client.metadata().storage_hash::()? + == [ + 6u8, 31u8, 218u8, 51u8, 202u8, 166u8, 183u8, 192u8, 151u8, + 184u8, 103u8, 73u8, 239u8, 78u8, 183u8, 38u8, 192u8, 201u8, + 27u8, 128u8, 59u8, 48u8, 197u8, 23u8, 43u8, 39u8, 158u8, + 35u8, 194u8, 23u8, 151u8, 145u8, + ] + { + let entry = ActiveConfig; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Pending configuration (if any) for the next session."] #[doc = ""] - #[doc = " DEPRECATED: This is no longer used, and will be removed in the future."] pub async fn pending_config (& self , _0 : & :: core :: primitive :: u32 , hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < :: core :: option :: Option < runtime_types :: polkadot_runtime_parachains :: configuration :: migration :: v1 :: HostConfiguration < :: core :: primitive :: u32 > > , :: subxt :: BasicError >{ - let entry = PendingConfig(_0); - self.client.storage().fetch(&entry, hash).await + #[doc = " DEPRECATED: This is no longer used, and will be removed in the future."] pub async fn pending_config (& self , _0 : & :: core :: primitive :: u32 , block_hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < :: core :: option :: Option < runtime_types :: polkadot_runtime_parachains :: configuration :: migration :: v1 :: HostConfiguration < :: core :: primitive :: u32 > > , :: subxt :: BasicError >{ + if self.client.metadata().storage_hash::()? + == [ + 152u8, 192u8, 135u8, 74u8, 174u8, 47u8, 192u8, 95u8, 147u8, + 137u8, 41u8, 219u8, 149u8, 198u8, 186u8, 16u8, 158u8, 160u8, + 51u8, 31u8, 187u8, 244u8, 112u8, 238u8, 194u8, 85u8, 198u8, + 73u8, 148u8, 62u8, 74u8, 6u8, + ] + { + let entry = PendingConfig(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Pending configuration (if any) for the next session."] #[doc = ""] #[doc = " DEPRECATED: This is no longer used, and will be removed in the future."] pub async fn pending_config_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, PendingConfig<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 152u8, 192u8, 135u8, 74u8, 174u8, 47u8, 192u8, 95u8, 147u8, + 137u8, 41u8, 219u8, 149u8, 198u8, 186u8, 16u8, 158u8, 160u8, + 51u8, 31u8, 187u8, 244u8, 112u8, 238u8, 194u8, 85u8, 198u8, + 73u8, 148u8, 62u8, 74u8, 6u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Pending configuration changes."] #[doc = ""] @@ -19079,19 +27440,50 @@ pub mod api { #[doc = " be applied."] #[doc = ""] #[doc = " The list is sorted ascending by session index. Also, this list can only contain at most"] - #[doc = " 2 items: for the next session and for the `scheduled_session`."] pub async fn pending_configs (& self , hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < :: std :: vec :: Vec < (:: core :: primitive :: u32 , runtime_types :: polkadot_runtime_parachains :: configuration :: HostConfiguration < :: core :: primitive :: u32 > ,) > , :: subxt :: BasicError >{ - let entry = PendingConfigs; - self.client.storage().fetch_or_default(&entry, hash).await + #[doc = " 2 items: for the next session and for the `scheduled_session`."] pub async fn pending_configs (& self , block_hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < :: std :: vec :: Vec < (:: core :: primitive :: u32 , runtime_types :: polkadot_runtime_parachains :: configuration :: HostConfiguration < :: core :: primitive :: u32 > ,) > , :: subxt :: BasicError >{ + if self.client.metadata().storage_hash::()? + == [ + 198u8, 168u8, 227u8, 228u8, 110u8, 98u8, 34u8, 21u8, 159u8, + 114u8, 202u8, 135u8, 39u8, 190u8, 40u8, 214u8, 170u8, 126u8, + 203u8, 10u8, 44u8, 114u8, 254u8, 208u8, 133u8, 129u8, 8u8, + 112u8, 168u8, 135u8, 196u8, 43u8, + ] + { + let entry = PendingConfigs; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " If this is set, then the configuration setters will bypass the consistency checks. This"] #[doc = " is meant to be used only as the last resort."] pub async fn bypass_consistency_check( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::bool, ::subxt::BasicError> { - let entry = BypassConsistencyCheck; - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 42u8, 191u8, 122u8, 163u8, 112u8, 2u8, 148u8, 59u8, 79u8, + 219u8, 184u8, 172u8, 246u8, 136u8, 185u8, 251u8, 189u8, + 226u8, 83u8, 129u8, 162u8, 109u8, 148u8, 75u8, 120u8, 216u8, + 44u8, 28u8, 221u8, 78u8, 177u8, 94u8, + ] + { + let entry = BypassConsistencyCheck; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -19167,39 +27559,90 @@ pub mod api { #[doc = " The current session index."] pub async fn current_session_index( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let entry = CurrentSessionIndex; - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 83u8, 15u8, 20u8, 55u8, 103u8, 65u8, 76u8, 202u8, 69u8, 14u8, + 221u8, 93u8, 38u8, 163u8, 167u8, 83u8, 18u8, 245u8, 33u8, + 175u8, 7u8, 97u8, 67u8, 186u8, 96u8, 57u8, 147u8, 120u8, + 107u8, 91u8, 147u8, 64u8, + ] + { + let entry = CurrentSessionIndex; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " All the validators actively participating in parachain consensus."] #[doc = " Indices are into the broader validator set."] pub async fn active_validator_indices( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec< runtime_types::polkadot_primitives::v2::ValidatorIndex, >, ::subxt::BasicError, > { - let entry = ActiveValidatorIndices; - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 128u8, 98u8, 186u8, 22u8, 178u8, 51u8, 151u8, 235u8, 201u8, + 2u8, 245u8, 177u8, 4u8, 125u8, 1u8, 245u8, 56u8, 102u8, + 166u8, 129u8, 211u8, 189u8, 137u8, 149u8, 234u8, 252u8, 97u8, + 139u8, 151u8, 16u8, 129u8, 24u8, + ] + { + let entry = ActiveValidatorIndices; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The parachain attestation keys of the validators actively participating in parachain consensus."] #[doc = " This should be the same length as `ActiveValidatorIndices`."] pub async fn active_validator_keys( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec< runtime_types::polkadot_primitives::v2::validator_app::Public, >, ::subxt::BasicError, > { - let entry = ActiveValidatorKeys; - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 130u8, 19u8, 46u8, 117u8, 211u8, 113u8, 90u8, 42u8, 173u8, + 87u8, 209u8, 185u8, 102u8, 142u8, 161u8, 60u8, 118u8, 246u8, + 161u8, 183u8, 103u8, 255u8, 75u8, 180u8, 250u8, 35u8, 235u8, + 102u8, 216u8, 196u8, 190u8, 129u8, + ] + { + let entry = ActiveValidatorKeys; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -19331,39 +27774,95 @@ pub mod api { pub fn new(client: &'a ::subxt::Client) -> Self { Self { client } } - #[doc = " The latest bitfield for each validator, referred to by their index in the validator set."] pub async fn availability_bitfields (& self , _0 : & runtime_types :: polkadot_primitives :: v2 :: ValidatorIndex , hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < :: core :: option :: Option < runtime_types :: polkadot_runtime_parachains :: inclusion :: AvailabilityBitfieldRecord < :: core :: primitive :: u32 > > , :: subxt :: BasicError >{ - let entry = AvailabilityBitfields(_0); - self.client.storage().fetch(&entry, hash).await + #[doc = " The latest bitfield for each validator, referred to by their index in the validator set."] pub async fn availability_bitfields (& self , _0 : & runtime_types :: polkadot_primitives :: v2 :: ValidatorIndex , block_hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < :: core :: option :: Option < runtime_types :: polkadot_runtime_parachains :: inclusion :: AvailabilityBitfieldRecord < :: core :: primitive :: u32 > > , :: subxt :: BasicError >{ + if self + .client + .metadata() + .storage_hash::()? + == [ + 223u8, 74u8, 17u8, 152u8, 136u8, 20u8, 241u8, 47u8, 169u8, + 34u8, 128u8, 78u8, 121u8, 47u8, 165u8, 35u8, 222u8, 15u8, + 236u8, 90u8, 215u8, 160u8, 10u8, 18u8, 152u8, 69u8, 38u8, + 97u8, 122u8, 247u8, 241u8, 255u8, + ] + { + let entry = AvailabilityBitfields(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The latest bitfield for each validator, referred to by their index in the validator set."] pub async fn availability_bitfields_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, AvailabilityBitfields<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 223u8, 74u8, 17u8, 152u8, 136u8, 20u8, 241u8, 47u8, 169u8, + 34u8, 128u8, 78u8, 121u8, 47u8, 165u8, 35u8, 222u8, 15u8, + 236u8, 90u8, 215u8, 160u8, 10u8, 18u8, 152u8, 69u8, 38u8, + 97u8, 122u8, 247u8, 241u8, 255u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } - #[doc = " Candidates pending availability by `ParaId`."] pub async fn pending_availability (& self , _0 : & runtime_types :: polkadot_parachain :: primitives :: Id , hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < :: core :: option :: Option < runtime_types :: polkadot_runtime_parachains :: inclusion :: CandidatePendingAvailability < :: subxt :: sp_core :: H256 , :: core :: primitive :: u32 > > , :: subxt :: BasicError >{ - let entry = PendingAvailability(_0); - self.client.storage().fetch(&entry, hash).await + #[doc = " Candidates pending availability by `ParaId`."] pub async fn pending_availability (& self , _0 : & runtime_types :: polkadot_parachain :: primitives :: Id , block_hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < :: core :: option :: Option < runtime_types :: polkadot_runtime_parachains :: inclusion :: CandidatePendingAvailability < :: subxt :: sp_core :: H256 , :: core :: primitive :: u32 > > , :: subxt :: BasicError >{ + if self + .client + .metadata() + .storage_hash::()? + == [ + 201u8, 235u8, 244u8, 21u8, 107u8, 106u8, 50u8, 211u8, 165u8, + 102u8, 113u8, 3u8, 54u8, 155u8, 159u8, 255u8, 117u8, 107u8, + 68u8, 174u8, 86u8, 90u8, 172u8, 181u8, 164u8, 171u8, 215u8, + 238u8, 118u8, 111u8, 25u8, 111u8, + ] + { + let entry = PendingAvailability(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Candidates pending availability by `ParaId`."] pub async fn pending_availability_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, PendingAvailability<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 201u8, 235u8, 244u8, 21u8, 107u8, 106u8, 50u8, 211u8, 165u8, + 102u8, 113u8, 3u8, 54u8, 155u8, 159u8, 255u8, 117u8, 107u8, + 68u8, 174u8, 86u8, 90u8, 172u8, 181u8, 164u8, 171u8, 215u8, + 238u8, 118u8, 111u8, 25u8, 111u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The commitments of candidates pending availability, by `ParaId`."] pub async fn pending_availability_commitments( &self, _0: &runtime_types::polkadot_parachain::primitives::Id, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::polkadot_primitives::v2::CandidateCommitments< @@ -19372,18 +27871,46 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = PendingAvailabilityCommitments(_0); - self.client.storage().fetch(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 164u8, 245u8, 130u8, 208u8, 141u8, 88u8, 99u8, 247u8, 90u8, + 215u8, 40u8, 99u8, 239u8, 7u8, 231u8, 13u8, 233u8, 204u8, + 223u8, 137u8, 158u8, 250u8, 24u8, 107u8, 152u8, 240u8, 195u8, + 28u8, 170u8, 219u8, 174u8, 213u8, + ] + { + let entry = PendingAvailabilityCommitments(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The commitments of candidates pending availability, by `ParaId`."] pub async fn pending_availability_commitments_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, PendingAvailabilityCommitments<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 164u8, 245u8, 130u8, 208u8, 141u8, 88u8, 99u8, 247u8, 90u8, + 215u8, 40u8, 99u8, 239u8, 7u8, 231u8, 13u8, 233u8, 204u8, + 223u8, 137u8, 158u8, 250u8, 24u8, 107u8, 152u8, 240u8, 195u8, + 28u8, 170u8, 219u8, 174u8, 213u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -19436,16 +27963,30 @@ pub mod api { runtime_types::sp_runtime::traits::BlakeTwo256, >, >, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Enter, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Enter, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = Enter { data }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 208u8, 134u8, 126u8, 30u8, 50u8, 219u8, 225u8, 133u8, 3u8, + 2u8, 121u8, 154u8, 133u8, 141u8, 159u8, 193u8, 66u8, 252u8, + 236u8, 234u8, 38u8, 169u8, 202u8, 154u8, 28u8, 171u8, 248u8, + 77u8, 31u8, 114u8, 21u8, 215u8, + ] + { + let call = Enter { data }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -19486,16 +28027,27 @@ pub mod api { #[doc = " If this is `None` at the end of the block, we panic and render the block invalid."] pub async fn included( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::option::Option<()>, ::subxt::BasicError> { - let entry = Included; - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 208u8, 213u8, 76u8, 64u8, 90u8, 141u8, 144u8, 52u8, 220u8, + 35u8, 143u8, 171u8, 45u8, 59u8, 9u8, 218u8, 29u8, 186u8, + 139u8, 203u8, 205u8, 12u8, 10u8, 2u8, 27u8, 167u8, 182u8, + 244u8, 167u8, 220u8, 44u8, 16u8, + ] + { + let entry = Included; + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Scraped on chain data for extracting resolved disputes as well as backing votes."] pub async fn on_chain_votes( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::polkadot_primitives::v2::ScrapedOnChainVotes< @@ -19504,8 +28056,19 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = OnChainVotes; - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 163u8, 22u8, 172u8, 81u8, 10u8, 19u8, 149u8, 111u8, 22u8, + 92u8, 203u8, 33u8, 225u8, 124u8, 69u8, 70u8, 66u8, 188u8, + 33u8, 24u8, 132u8, 234u8, 106u8, 51u8, 248u8, 57u8, 169u8, + 115u8, 164u8, 253u8, 112u8, 235u8, + ] + { + let entry = OnChainVotes; + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -19597,7 +28160,7 @@ pub mod api { #[doc = " Reasonably, 100-1000. The dominant factor is the number of validators: safe upper bound at 10k."] pub async fn validator_groups( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec< ::std::vec::Vec< @@ -19606,15 +28169,43 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = ValidatorGroups; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 84u8, 195u8, 53u8, 111u8, 186u8, 61u8, 3u8, 36u8, 10u8, 9u8, + 66u8, 119u8, 116u8, 213u8, 86u8, 153u8, 18u8, 149u8, 83u8, + 92u8, 232u8, 212u8, 175u8, 52u8, 74u8, 135u8, 137u8, 34u8, + 123u8, 232u8, 131u8, 22u8, + ] + { + let entry = ValidatorGroups; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " A queue of upcoming claims and which core they should be mapped onto."] #[doc = ""] #[doc = " The number of queued claims is bounded at the `scheduling_lookahead`"] - #[doc = " multiplied by the number of parathread multiplexer cores. Reasonably, 10 * 50 = 500."] pub async fn parathread_queue (& self , hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < runtime_types :: polkadot_runtime_parachains :: scheduler :: ParathreadClaimQueue , :: subxt :: BasicError >{ - let entry = ParathreadQueue; - self.client.storage().fetch_or_default(&entry, hash).await + #[doc = " multiplied by the number of parathread multiplexer cores. Reasonably, 10 * 50 = 500."] pub async fn parathread_queue (& self , block_hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < runtime_types :: polkadot_runtime_parachains :: scheduler :: ParathreadClaimQueue , :: subxt :: BasicError >{ + if self.client.metadata().storage_hash::()? + == [ + 55u8, 142u8, 211u8, 227u8, 167u8, 35u8, 168u8, 23u8, 227u8, + 185u8, 5u8, 154u8, 147u8, 237u8, 137u8, 133u8, 81u8, 121u8, + 70u8, 159u8, 206u8, 56u8, 20u8, 17u8, 79u8, 19u8, 238u8, + 114u8, 60u8, 96u8, 1u8, 20u8, + ] + { + let entry = ParathreadQueue; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " One entry for each availability core. Entries are `None` if the core is not currently occupied. Can be"] #[doc = " temporarily `Some` if scheduled but not occupied."] @@ -19626,7 +28217,7 @@ pub mod api { #[doc = " * The number of validators divided by `configuration.max_validators_per_core`."] pub async fn availability_cores( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec< ::core::option::Option< @@ -19635,8 +28226,22 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = AvailabilityCores; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 170u8, 116u8, 249u8, 112u8, 156u8, 147u8, 94u8, 44u8, 114u8, + 10u8, 32u8, 91u8, 229u8, 56u8, 60u8, 222u8, 212u8, 176u8, + 107u8, 159u8, 143u8, 217u8, 200u8, 158u8, 86u8, 88u8, 220u8, + 204u8, 162u8, 148u8, 207u8, 150u8, + ] + { + let entry = AvailabilityCores; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " An index used to ensure that only one claim on a parathread exists in the queue or is"] #[doc = " currently being handled by an occupied core."] @@ -19644,13 +28249,30 @@ pub mod api { #[doc = " Bounded by the number of parathread cores and scheduling lookahead. Reasonably, 10 * 50 = 500."] pub async fn parathread_claim_index( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec, ::subxt::BasicError, > { - let entry = ParathreadClaimIndex; - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 187u8, 105u8, 221u8, 0u8, 103u8, 9u8, 52u8, 127u8, 47u8, + 155u8, 147u8, 84u8, 249u8, 213u8, 140u8, 75u8, 99u8, 238u8, + 220u8, 242u8, 220u8, 99u8, 204u8, 178u8, 153u8, 170u8, 72u8, + 34u8, 83u8, 238u8, 211u8, 150u8, + ] + { + let entry = ParathreadClaimIndex; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The block number where the session start occurred. Used to track how many group rotations have occurred."] #[doc = ""] @@ -19660,20 +28282,48 @@ pub mod api { #[doc = " block following the session change, block number of which we save in this storage value."] pub async fn session_start_block( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let entry = SessionStartBlock; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 122u8, 37u8, 150u8, 1u8, 185u8, 201u8, 168u8, 67u8, 55u8, + 17u8, 101u8, 18u8, 133u8, 212u8, 6u8, 73u8, 191u8, 204u8, + 229u8, 22u8, 185u8, 120u8, 24u8, 245u8, 121u8, 215u8, 124u8, + 210u8, 49u8, 28u8, 26u8, 80u8, + ] + { + let entry = SessionStartBlock; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Currently scheduled cores - free but up to be occupied."] #[doc = ""] #[doc = " Bounded by the number of cores: one for each parachain and parathread multiplexer."] #[doc = ""] #[doc = " The value contained here will not be valid after the end of a block. Runtime APIs should be used to determine scheduled cores/"] - #[doc = " for the upcoming block."] pub async fn scheduled (& self , hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < :: std :: vec :: Vec < runtime_types :: polkadot_runtime_parachains :: scheduler :: CoreAssignment > , :: subxt :: BasicError >{ - let entry = Scheduled; - self.client.storage().fetch_or_default(&entry, hash).await + #[doc = " for the upcoming block."] pub async fn scheduled (& self , block_hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < :: std :: vec :: Vec < runtime_types :: polkadot_runtime_parachains :: scheduler :: CoreAssignment > , :: subxt :: BasicError >{ + if self.client.metadata().storage_hash::()? + == [ + 29u8, 43u8, 158u8, 142u8, 50u8, 67u8, 4u8, 30u8, 158u8, 99u8, + 47u8, 13u8, 151u8, 141u8, 163u8, 63u8, 140u8, 179u8, 247u8, + 106u8, 53u8, 66u8, 90u8, 107u8, 95u8, 174u8, 63u8, 123u8, + 176u8, 68u8, 90u8, 232u8, + ] + { + let entry = Scheduled; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -19784,32 +28434,60 @@ pub mod api { &self, para: runtime_types::polkadot_parachain::primitives::Id, new_code : runtime_types :: polkadot_parachain :: primitives :: ValidationCode, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ForceSetCurrentCode, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ForceSetCurrentCode, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ForceSetCurrentCode { para, new_code }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 100u8, 36u8, 105u8, 246u8, 77u8, 252u8, 162u8, 139u8, 60u8, + 37u8, 12u8, 148u8, 206u8, 160u8, 134u8, 105u8, 50u8, 52u8, + 156u8, 252u8, 217u8, 174u8, 211u8, 208u8, 88u8, 81u8, 236u8, + 66u8, 27u8, 59u8, 126u8, 5u8, + ] + { + let call = ForceSetCurrentCode { para, new_code }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set the storage for the current parachain head data immediately."] pub fn force_set_current_head( &self, para: runtime_types::polkadot_parachain::primitives::Id, new_head: runtime_types::polkadot_parachain::primitives::HeadData, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ForceSetCurrentHead, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ForceSetCurrentHead, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ForceSetCurrentHead { para, new_head }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 119u8, 46u8, 120u8, 202u8, 138u8, 190u8, 179u8, 78u8, 155u8, + 167u8, 220u8, 233u8, 170u8, 248u8, 202u8, 92u8, 73u8, 246u8, + 224u8, 56u8, 208u8, 124u8, 215u8, 19u8, 235u8, 246u8, 89u8, + 189u8, 19u8, 205u8, 22u8, 70u8, + ] + { + let call = ForceSetCurrentHead { para, new_head }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Schedule an upgrade as if it was scheduled in the given relay parent block."] pub fn force_schedule_code_upgrade( @@ -19817,36 +28495,67 @@ pub mod api { para: runtime_types::polkadot_parachain::primitives::Id, new_code : runtime_types :: polkadot_parachain :: primitives :: ValidationCode, relay_parent_number: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ForceScheduleCodeUpgrade, - DispatchError, - root_mod::Event, - > { - let call = ForceScheduleCodeUpgrade { - para, - new_code, - relay_parent_number, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ForceScheduleCodeUpgrade, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self + .client + .metadata() + .call_hash::()? + == [ + 254u8, 60u8, 105u8, 37u8, 116u8, 190u8, 30u8, 255u8, 210u8, + 24u8, 120u8, 99u8, 174u8, 215u8, 233u8, 83u8, 57u8, 200u8, + 24u8, 49u8, 220u8, 12u8, 103u8, 30u8, 165u8, 10u8, 125u8, + 255u8, 88u8, 134u8, 199u8, 3u8, + ] + { + let call = ForceScheduleCodeUpgrade { + para, + new_code, + relay_parent_number, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Note a new block head for para within the context of the current block."] pub fn force_note_new_head( &self, para: runtime_types::polkadot_parachain::primitives::Id, new_head: runtime_types::polkadot_parachain::primitives::HeadData, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ForceNoteNewHead, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ForceNoteNewHead, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ForceNoteNewHead { para, new_head }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 203u8, 31u8, 68u8, 125u8, 105u8, 218u8, 177u8, 205u8, 248u8, + 131u8, 25u8, 170u8, 140u8, 56u8, 183u8, 106u8, 2u8, 118u8, + 79u8, 22u8, 228u8, 91u8, 33u8, 66u8, 245u8, 144u8, 147u8, + 142u8, 14u8, 171u8, 125u8, 233u8, + ] + { + let call = ForceNoteNewHead { para, new_head }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Put a parachain directly into the next session's action queue."] #[doc = "We can't queue it any sooner than this without going into the"] @@ -19854,16 +28563,30 @@ pub mod api { pub fn force_queue_action( &self, para: runtime_types::polkadot_parachain::primitives::Id, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ForceQueueAction, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ForceQueueAction, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ForceQueueAction { para }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 141u8, 235u8, 245u8, 93u8, 24u8, 155u8, 106u8, 136u8, 190u8, + 236u8, 216u8, 131u8, 245u8, 5u8, 186u8, 131u8, 159u8, 240u8, + 95u8, 139u8, 231u8, 12u8, 255u8, 74u8, 194u8, 13u8, 112u8, + 78u8, 110u8, 95u8, 26u8, 133u8, + ] + { + let call = ForceQueueAction { para }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Adds the validation code to the storage."] #[doc = ""] @@ -19881,16 +28604,33 @@ pub mod api { pub fn add_trusted_validation_code( &self, validation_code : runtime_types :: polkadot_parachain :: primitives :: ValidationCode, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - AddTrustedValidationCode, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + AddTrustedValidationCode, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = AddTrustedValidationCode { validation_code }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 110u8, 255u8, 249u8, 176u8, 109u8, 54u8, 87u8, 19u8, 7u8, + 62u8, 220u8, 143u8, 196u8, 99u8, 66u8, 49u8, 18u8, 225u8, + 14u8, 42u8, 243u8, 228u8, 232u8, 207u8, 246u8, 34u8, 179u8, + 127u8, 246u8, 239u8, 30u8, 214u8, + ] + { + let call = AddTrustedValidationCode { validation_code }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Remove the validation code from the storage iff the reference count is 0."] #[doc = ""] @@ -19900,18 +28640,35 @@ pub mod api { pub fn poke_unused_validation_code( &self, validation_code_hash : runtime_types :: polkadot_parachain :: primitives :: ValidationCodeHash, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - PokeUnusedValidationCode, - DispatchError, - root_mod::Event, - > { - let call = PokeUnusedValidationCode { - validation_code_hash, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + PokeUnusedValidationCode, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self + .client + .metadata() + .call_hash::()? + == [ + 159u8, 142u8, 14u8, 7u8, 29u8, 74u8, 213u8, 165u8, 206u8, + 45u8, 135u8, 121u8, 0u8, 146u8, 217u8, 59u8, 189u8, 120u8, + 169u8, 227u8, 225u8, 135u8, 15u8, 45u8, 197u8, 201u8, 29u8, + 128u8, 49u8, 165u8, 106u8, 80u8, + ] + { + let call = PokeUnusedValidationCode { + validation_code_hash, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Includes a statement for a PVF pre-checking vote. Potentially, finalizes the vote and"] #[doc = "enacts the results if that was the last vote before achieving the supermajority."] @@ -19919,16 +28676,33 @@ pub mod api { &self, stmt: runtime_types::polkadot_primitives::v2::PvfCheckStatement, signature : runtime_types :: polkadot_primitives :: v2 :: validator_app :: Signature, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - IncludePvfCheckStatement, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + IncludePvfCheckStatement, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = IncludePvfCheckStatement { stmt, signature }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 187u8, 231u8, 113u8, 29u8, 177u8, 92u8, 2u8, 116u8, 88u8, + 114u8, 19u8, 170u8, 167u8, 254u8, 149u8, 142u8, 24u8, 57u8, + 187u8, 210u8, 72u8, 239u8, 32u8, 75u8, 39u8, 47u8, 158u8, + 205u8, 82u8, 50u8, 175u8, 31u8, + ] + { + let call = IncludePvfCheckStatement { stmt, signature }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -20289,9 +29063,20 @@ pub mod api { #[doc = " All currently active PVF pre-checking votes."] #[doc = ""] #[doc = " Invariant:"] - #[doc = " - There are no PVF pre-checking votes that exists in list but not in the set and vice versa."] pub async fn pvf_active_vote_map (& self , _0 : & runtime_types :: polkadot_parachain :: primitives :: ValidationCodeHash , hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < :: core :: option :: Option < runtime_types :: polkadot_runtime_parachains :: paras :: PvfCheckActiveVoteState < :: core :: primitive :: u32 > > , :: subxt :: BasicError >{ - let entry = PvfActiveVoteMap(_0); - self.client.storage().fetch(&entry, hash).await + #[doc = " - There are no PVF pre-checking votes that exists in list but not in the set and vice versa."] pub async fn pvf_active_vote_map (& self , _0 : & runtime_types :: polkadot_parachain :: primitives :: ValidationCodeHash , block_hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < :: core :: option :: Option < runtime_types :: polkadot_runtime_parachains :: paras :: PvfCheckActiveVoteState < :: core :: primitive :: u32 > > , :: subxt :: BasicError >{ + if self.client.metadata().storage_hash::()? + == [ + 113u8, 142u8, 66u8, 141u8, 249u8, 227u8, 84u8, 128u8, 137u8, + 111u8, 215u8, 93u8, 246u8, 49u8, 126u8, 213u8, 77u8, 139u8, + 7u8, 19u8, 254u8, 84u8, 72u8, 96u8, 89u8, 114u8, 199u8, + 150u8, 122u8, 160u8, 222u8, 181u8, + ] + { + let entry = PvfActiveVoteMap(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " All currently active PVF pre-checking votes."] #[doc = ""] @@ -20299,86 +29084,169 @@ pub mod api { #[doc = " - There are no PVF pre-checking votes that exists in list but not in the set and vice versa."] pub async fn pvf_active_vote_map_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, PvfActiveVoteMap<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 113u8, 142u8, 66u8, 141u8, 249u8, 227u8, 84u8, 128u8, 137u8, + 111u8, 215u8, 93u8, 246u8, 49u8, 126u8, 213u8, 77u8, 139u8, + 7u8, 19u8, 254u8, 84u8, 72u8, 96u8, 89u8, 114u8, 199u8, + 150u8, 122u8, 160u8, 222u8, 181u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The list of all currently active PVF votes. Auxiliary to `PvfActiveVoteMap`."] pub async fn pvf_active_vote_list( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec< runtime_types::polkadot_parachain::primitives::ValidationCodeHash, >, ::subxt::BasicError, > { - let entry = PvfActiveVoteList; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 30u8, 117u8, 174u8, 227u8, 251u8, 95u8, 176u8, 153u8, 151u8, + 188u8, 89u8, 252u8, 168u8, 203u8, 174u8, 241u8, 209u8, 45u8, + 96u8, 77u8, 117u8, 159u8, 33u8, 1u8, 55u8, 111u8, 50u8, + 189u8, 246u8, 209u8, 42u8, 155u8, + ] + { + let entry = PvfActiveVoteList; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " All parachains. Ordered ascending by `ParaId`. Parathreads are not included."] #[doc = ""] #[doc = " Consider using the [`ParachainsCache`] type of modifying."] pub async fn parachains( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec, ::subxt::BasicError, > { - let entry = Parachains; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 174u8, 146u8, 170u8, 102u8, 125u8, 176u8, 74u8, 177u8, 28u8, + 54u8, 13u8, 73u8, 188u8, 248u8, 78u8, 144u8, 88u8, 183u8, + 224u8, 69u8, 224u8, 31u8, 30u8, 115u8, 191u8, 166u8, 252u8, + 218u8, 114u8, 241u8, 110u8, 39u8, + ] + { + let entry = Parachains; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The current lifecycle of a all known Para IDs."] pub async fn para_lifecycles( &self, _0: &runtime_types::polkadot_parachain::primitives::Id, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::polkadot_runtime_parachains::paras::ParaLifecycle, >, ::subxt::BasicError, > { - let entry = ParaLifecycles(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 38u8, 31u8, 0u8, 253u8, 63u8, 27u8, 13u8, 12u8, 247u8, 34u8, + 21u8, 166u8, 166u8, 236u8, 178u8, 217u8, 230u8, 117u8, 215u8, + 8u8, 149u8, 37u8, 231u8, 160u8, 226u8, 89u8, 12u8, 162u8, + 197u8, 237u8, 235u8, 127u8, + ] + { + let entry = ParaLifecycles(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The current lifecycle of a all known Para IDs."] pub async fn para_lifecycles_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, ParaLifecycles<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 38u8, 31u8, 0u8, 253u8, 63u8, 27u8, 13u8, 12u8, 247u8, 34u8, + 21u8, 166u8, 166u8, 236u8, 178u8, 217u8, 230u8, 117u8, 215u8, + 8u8, 149u8, 37u8, 231u8, 160u8, 226u8, 89u8, 12u8, 162u8, + 197u8, 237u8, 235u8, 127u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The head-data of every registered para."] pub async fn heads( &self, _0: &runtime_types::polkadot_parachain::primitives::Id, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::polkadot_parachain::primitives::HeadData, >, ::subxt::BasicError, > { - let entry = Heads(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 242u8, 145u8, 237u8, 33u8, 204u8, 183u8, 18u8, 135u8, 182u8, + 47u8, 220u8, 187u8, 118u8, 79u8, 163u8, 122u8, 227u8, 215u8, + 43u8, 70u8, 24u8, 33u8, 74u8, 113u8, 67u8, 25u8, 47u8, 210u8, + 136u8, 236u8, 83u8, 148u8, + ] + { + let entry = Heads(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The head-data of every registered para."] pub async fn heads_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Heads<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 242u8, 145u8, 237u8, 33u8, 204u8, 183u8, 18u8, 135u8, 182u8, + 47u8, 220u8, 187u8, 118u8, 79u8, 163u8, 122u8, 227u8, 215u8, + 43u8, 70u8, 24u8, 33u8, 74u8, 113u8, 67u8, 25u8, 47u8, 210u8, + 136u8, 236u8, 83u8, 148u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The validation code hash of every live para."] #[doc = ""] @@ -20386,27 +29254,49 @@ pub mod api { pub async fn current_code_hash( &self, _0: &runtime_types::polkadot_parachain::primitives::Id, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::polkadot_parachain::primitives::ValidationCodeHash, >, ::subxt::BasicError, > { - let entry = CurrentCodeHash(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 146u8, 139u8, 159u8, 78u8, 13u8, 151u8, 18u8, 117u8, 15u8, + 107u8, 251u8, 200u8, 100u8, 200u8, 170u8, 50u8, 250u8, 189u8, + 162u8, 128u8, 253u8, 51u8, 192u8, 174u8, 190u8, 48u8, 96u8, + 214u8, 33u8, 117u8, 82u8, 247u8, + ] + { + let entry = CurrentCodeHash(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The validation code hash of every live para."] #[doc = ""] #[doc = " Corresponding code can be retrieved with [`CodeByHash`]."] pub async fn current_code_hash_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, CurrentCodeHash<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 146u8, 139u8, 159u8, 78u8, 13u8, 151u8, 18u8, 117u8, 15u8, + 107u8, 251u8, 200u8, 100u8, 200u8, 170u8, 50u8, 250u8, 189u8, + 162u8, 128u8, 253u8, 51u8, 192u8, 174u8, 190u8, 48u8, 96u8, + 214u8, 33u8, 117u8, 82u8, 247u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Actual past code hash, indicated by the para id as well as the block number at which it"] #[doc = " became outdated."] @@ -20416,15 +29306,26 @@ pub mod api { &self, _0: &runtime_types::polkadot_parachain::primitives::Id, _1: &::core::primitive::u32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::polkadot_parachain::primitives::ValidationCodeHash, >, ::subxt::BasicError, > { - let entry = PastCodeHash(_0, _1); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 158u8, 40u8, 107u8, 17u8, 201u8, 114u8, 104u8, 4u8, 50u8, + 4u8, 245u8, 186u8, 104u8, 25u8, 142u8, 118u8, 196u8, 165u8, + 252u8, 88u8, 251u8, 92u8, 41u8, 51u8, 222u8, 217u8, 213u8, + 18u8, 114u8, 245u8, 247u8, 188u8, + ] + { + let entry = PastCodeHash(_0, _1); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Actual past code hash, indicated by the para id as well as the block number at which it"] #[doc = " became outdated."] @@ -20432,12 +29333,23 @@ pub mod api { #[doc = " Corresponding code can be retrieved with [`CodeByHash`]."] pub async fn past_code_hash_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, PastCodeHash<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 158u8, 40u8, 107u8, 17u8, 201u8, 114u8, 104u8, 4u8, 50u8, + 4u8, 245u8, 186u8, 104u8, 25u8, 142u8, 118u8, 196u8, 165u8, + 252u8, 88u8, 251u8, 92u8, 41u8, 51u8, 222u8, 217u8, 213u8, + 18u8, 114u8, 245u8, 247u8, 188u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Past code of parachains. The parachains themselves may not be registered anymore,"] #[doc = " but we also keep their code on-chain for the same amount of time as outdated code"] @@ -20445,27 +29357,52 @@ pub mod api { pub async fn past_code_meta( &self, _0: &runtime_types::polkadot_parachain::primitives::Id, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< runtime_types::polkadot_runtime_parachains::paras::ParaPastCodeMeta< ::core::primitive::u32, >, ::subxt::BasicError, > { - let entry = PastCodeMeta(_0); - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 121u8, 14u8, 91u8, 135u8, 231u8, 67u8, 189u8, 66u8, 108u8, + 27u8, 241u8, 117u8, 101u8, 34u8, 24u8, 16u8, 52u8, 198u8, + 205u8, 155u8, 138u8, 9u8, 140u8, 207u8, 27u8, 172u8, 212u8, + 217u8, 47u8, 134u8, 122u8, 162u8, + ] + { + let entry = PastCodeMeta(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Past code of parachains. The parachains themselves may not be registered anymore,"] #[doc = " but we also keep their code on-chain for the same amount of time as outdated code"] #[doc = " to keep it available for secondary checkers."] pub async fn past_code_meta_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, PastCodeMeta<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 121u8, 14u8, 91u8, 135u8, 231u8, 67u8, 189u8, 66u8, 108u8, + 27u8, 241u8, 117u8, 101u8, 34u8, 24u8, 16u8, 52u8, 198u8, + 205u8, 155u8, 138u8, 9u8, 140u8, 207u8, 27u8, 172u8, 212u8, + 217u8, 47u8, 134u8, 122u8, 162u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Which paras have past code that needs pruning and the relay-chain block at which the code was replaced."] #[doc = " Note that this is the actual height of the included block, not the expected height at which the"] @@ -20475,7 +29412,7 @@ pub mod api { #[doc = " Multiple entries for a single para are permitted. Ordered ascending by block number."] pub async fn past_code_pruning( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec<( runtime_types::polkadot_parachain::primitives::Id, @@ -20483,8 +29420,22 @@ pub mod api { )>, ::subxt::BasicError, > { - let entry = PastCodePruning; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 142u8, 32u8, 134u8, 51u8, 34u8, 214u8, 75u8, 69u8, 77u8, + 178u8, 103u8, 117u8, 180u8, 105u8, 249u8, 178u8, 143u8, 25u8, + 212u8, 207u8, 28u8, 28u8, 175u8, 193u8, 43u8, 58u8, 51u8, + 149u8, 155u8, 204u8, 37u8, 153u8, + ] + { + let entry = PastCodePruning; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The block number at which the planned code change is expected for a para."] #[doc = " The change will be applied after the first parablock for this ID included which executes"] @@ -20492,25 +29443,53 @@ pub mod api { pub async fn future_code_upgrades( &self, _0: &runtime_types::polkadot_parachain::primitives::Id, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<::core::primitive::u32>, ::subxt::BasicError, > { - let entry = FutureCodeUpgrades(_0); - self.client.storage().fetch(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 211u8, 254u8, 201u8, 63u8, 89u8, 112u8, 57u8, 82u8, 255u8, + 163u8, 49u8, 246u8, 197u8, 154u8, 55u8, 10u8, 65u8, 188u8, + 172u8, 110u8, 194u8, 155u8, 37u8, 44u8, 250u8, 154u8, 4u8, + 184u8, 225u8, 79u8, 248u8, 80u8, + ] + { + let entry = FutureCodeUpgrades(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The block number at which the planned code change is expected for a para."] #[doc = " The change will be applied after the first parablock for this ID included which executes"] #[doc = " in the context of a relay chain block with a number >= `expected_at`."] pub async fn future_code_upgrades_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, FutureCodeUpgrades<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 211u8, 254u8, 201u8, 63u8, 89u8, 112u8, 57u8, 82u8, 255u8, + 163u8, 49u8, 246u8, 197u8, 154u8, 55u8, 10u8, 65u8, 188u8, + 172u8, 110u8, 194u8, 155u8, 37u8, 44u8, 250u8, 154u8, 4u8, + 184u8, 225u8, 79u8, 248u8, 80u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The actual future code hash of a para."] #[doc = ""] @@ -20518,27 +29497,49 @@ pub mod api { pub async fn future_code_hash( &self, _0: &runtime_types::polkadot_parachain::primitives::Id, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::polkadot_parachain::primitives::ValidationCodeHash, >, ::subxt::BasicError, > { - let entry = FutureCodeHash(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 221u8, 2u8, 237u8, 170u8, 64u8, 60u8, 98u8, 146u8, 135u8, + 69u8, 6u8, 38u8, 2u8, 239u8, 22u8, 94u8, 180u8, 163u8, 76u8, + 137u8, 143u8, 124u8, 5u8, 210u8, 129u8, 207u8, 78u8, 192u8, + 144u8, 39u8, 206u8, 195u8, + ] + { + let entry = FutureCodeHash(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The actual future code hash of a para."] #[doc = ""] #[doc = " Corresponding code can be retrieved with [`CodeByHash`]."] pub async fn future_code_hash_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, FutureCodeHash<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 221u8, 2u8, 237u8, 170u8, 64u8, 60u8, 98u8, 146u8, 135u8, + 69u8, 6u8, 38u8, 2u8, 239u8, 22u8, 94u8, 180u8, 163u8, 76u8, + 137u8, 143u8, 124u8, 5u8, 210u8, 129u8, 207u8, 78u8, 192u8, + 144u8, 39u8, 206u8, 195u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " This is used by the relay-chain to communicate to a parachain a go-ahead with in the upgrade procedure."] #[doc = ""] @@ -20552,15 +29553,29 @@ pub mod api { pub async fn upgrade_go_ahead_signal( &self, _0: &runtime_types::polkadot_parachain::primitives::Id, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::polkadot_primitives::v2::UpgradeGoAhead, >, ::subxt::BasicError, > { - let entry = UpgradeGoAheadSignal(_0); - self.client.storage().fetch(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 100u8, 87u8, 135u8, 185u8, 95u8, 13u8, 74u8, 134u8, 19u8, + 97u8, 80u8, 104u8, 177u8, 30u8, 82u8, 145u8, 171u8, 250u8, + 99u8, 214u8, 26u8, 243u8, 118u8, 118u8, 19u8, 188u8, 187u8, + 142u8, 138u8, 68u8, 54u8, 114u8, + ] + { + let entry = UpgradeGoAheadSignal(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " This is used by the relay-chain to communicate to a parachain a go-ahead with in the upgrade procedure."] #[doc = ""] @@ -20573,12 +29588,26 @@ pub mod api { #[doc = " the format will require migration of parachains."] pub async fn upgrade_go_ahead_signal_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, UpgradeGoAheadSignal<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 100u8, 87u8, 135u8, 185u8, 95u8, 13u8, 74u8, 134u8, 19u8, + 97u8, 80u8, 104u8, 177u8, 30u8, 82u8, 145u8, 171u8, 250u8, + 99u8, 214u8, 26u8, 243u8, 118u8, 118u8, 19u8, 188u8, 187u8, + 142u8, 138u8, 68u8, 54u8, 114u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " This is used by the relay-chain to communicate that there are restrictions for performing"] #[doc = " an upgrade for this parachain."] @@ -20592,15 +29621,29 @@ pub mod api { pub async fn upgrade_restriction_signal( &self, _0: &runtime_types::polkadot_parachain::primitives::Id, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::polkadot_primitives::v2::UpgradeRestriction, >, ::subxt::BasicError, > { - let entry = UpgradeRestrictionSignal(_0); - self.client.storage().fetch(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 173u8, 198u8, 89u8, 108u8, 43u8, 93u8, 143u8, 224u8, 141u8, + 248u8, 238u8, 221u8, 237u8, 220u8, 140u8, 24u8, 7u8, 14u8, + 136u8, 251u8, 159u8, 190u8, 70u8, 98u8, 100u8, 118u8, 24u8, + 212u8, 82u8, 96u8, 120u8, 206u8, + ] + { + let entry = UpgradeRestrictionSignal(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " This is used by the relay-chain to communicate that there are restrictions for performing"] #[doc = " an upgrade for this parachain."] @@ -20613,19 +29656,33 @@ pub mod api { #[doc = " the format will require migration of parachains."] pub async fn upgrade_restriction_signal_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, UpgradeRestrictionSignal<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 173u8, 198u8, 89u8, 108u8, 43u8, 93u8, 143u8, 224u8, 141u8, + 248u8, 238u8, 221u8, 237u8, 220u8, 140u8, 24u8, 7u8, 14u8, + 136u8, 251u8, 159u8, 190u8, 70u8, 98u8, 100u8, 118u8, 24u8, + 212u8, 82u8, 96u8, 120u8, 206u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The list of parachains that are awaiting for their upgrade restriction to cooldown."] #[doc = ""] #[doc = " Ordered ascending by block number."] pub async fn upgrade_cooldowns( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec<( runtime_types::polkadot_parachain::primitives::Id, @@ -20633,8 +29690,22 @@ pub mod api { )>, ::subxt::BasicError, > { - let entry = UpgradeCooldowns; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 120u8, 214u8, 165u8, 35u8, 125u8, 56u8, 152u8, 76u8, 124u8, + 159u8, 160u8, 93u8, 16u8, 30u8, 208u8, 199u8, 162u8, 74u8, + 124u8, 141u8, 137u8, 237u8, 229u8, 61u8, 62u8, 71u8, 54u8, + 92u8, 243u8, 208u8, 114u8, 19u8, + ] + { + let entry = UpgradeCooldowns; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The list of upcoming code upgrades. Each item is a pair of which para performs a code"] #[doc = " upgrade and at which relay-chain block it is expected at."] @@ -20642,7 +29713,7 @@ pub mod api { #[doc = " Ordered ascending by block number."] pub async fn upcoming_upgrades( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec<( runtime_types::polkadot_parachain::primitives::Id, @@ -20650,37 +29721,90 @@ pub mod api { )>, ::subxt::BasicError, > { - let entry = UpcomingUpgrades; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 16u8, 74u8, 254u8, 39u8, 241u8, 98u8, 106u8, 203u8, 189u8, + 157u8, 66u8, 99u8, 164u8, 176u8, 20u8, 206u8, 15u8, 212u8, + 229u8, 9u8, 117u8, 214u8, 250u8, 8u8, 51u8, 80u8, 35u8, + 236u8, 120u8, 4u8, 246u8, 62u8, + ] + { + let entry = UpcomingUpgrades; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The actions to perform during the start of a specific session index."] pub async fn actions_queue( &self, _0: &::core::primitive::u32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec, ::subxt::BasicError, > { - let entry = ActionsQueue(_0); - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 103u8, 197u8, 76u8, 84u8, 133u8, 3u8, 67u8, 57u8, 107u8, + 31u8, 87u8, 33u8, 196u8, 130u8, 119u8, 93u8, 171u8, 173u8, + 76u8, 242u8, 22u8, 15u8, 133u8, 193u8, 122u8, 0u8, 112u8, + 121u8, 233u8, 29u8, 17u8, 185u8, + ] + { + let entry = ActionsQueue(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The actions to perform during the start of a specific session index."] pub async fn actions_queue_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, ActionsQueue<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 103u8, 197u8, 76u8, 84u8, 133u8, 3u8, 67u8, 57u8, 107u8, + 31u8, 87u8, 33u8, 196u8, 130u8, 119u8, 93u8, 171u8, 173u8, + 76u8, 242u8, 22u8, 15u8, 133u8, 193u8, 122u8, 0u8, 112u8, + 121u8, 233u8, 29u8, 17u8, 185u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Upcoming paras instantiation arguments."] #[doc = ""] #[doc = " NOTE that after PVF pre-checking is enabled the para genesis arg will have it's code set"] - #[doc = " to empty. Instead, the code will be saved into the storage right away via `CodeByHash`."] pub async fn upcoming_paras_genesis (& self , _0 : & runtime_types :: polkadot_parachain :: primitives :: Id , hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < :: core :: option :: Option < runtime_types :: polkadot_runtime_parachains :: paras :: ParaGenesisArgs > , :: subxt :: BasicError >{ - let entry = UpcomingParasGenesis(_0); - self.client.storage().fetch(&entry, hash).await + #[doc = " to empty. Instead, the code will be saved into the storage right away via `CodeByHash`."] pub async fn upcoming_paras_genesis (& self , _0 : & runtime_types :: polkadot_parachain :: primitives :: Id , block_hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < :: core :: option :: Option < runtime_types :: polkadot_runtime_parachains :: paras :: ParaGenesisArgs > , :: subxt :: BasicError >{ + if self + .client + .metadata() + .storage_hash::()? + == [ + 98u8, 249u8, 92u8, 177u8, 21u8, 84u8, 199u8, 194u8, 150u8, + 213u8, 143u8, 107u8, 99u8, 194u8, 141u8, 225u8, 55u8, 94u8, + 44u8, 147u8, 209u8, 144u8, 118u8, 66u8, 139u8, 170u8, 68u8, + 62u8, 45u8, 137u8, 91u8, 8u8, + ] + { + let entry = UpcomingParasGenesis(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Upcoming paras instantiation arguments."] #[doc = ""] @@ -20688,32 +29812,71 @@ pub mod api { #[doc = " to empty. Instead, the code will be saved into the storage right away via `CodeByHash`."] pub async fn upcoming_paras_genesis_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, UpcomingParasGenesis<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 98u8, 249u8, 92u8, 177u8, 21u8, 84u8, 199u8, 194u8, 150u8, + 213u8, 143u8, 107u8, 99u8, 194u8, 141u8, 225u8, 55u8, 94u8, + 44u8, 147u8, 209u8, 144u8, 118u8, 66u8, 139u8, 170u8, 68u8, + 62u8, 45u8, 137u8, 91u8, 8u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The number of reference on the validation code in [`CodeByHash`] storage."] pub async fn code_by_hash_refs( &self, _0 : & runtime_types :: polkadot_parachain :: primitives :: ValidationCodeHash, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let entry = CodeByHashRefs(_0); - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 194u8, 100u8, 213u8, 115u8, 143u8, 181u8, 255u8, 227u8, + 232u8, 163u8, 209u8, 99u8, 2u8, 138u8, 118u8, 169u8, 210u8, + 202u8, 190u8, 194u8, 221u8, 145u8, 171u8, 78u8, 212u8, 17u8, + 245u8, 107u8, 99u8, 5u8, 54u8, 118u8, + ] + { + let entry = CodeByHashRefs(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The number of reference on the validation code in [`CodeByHash`] storage."] pub async fn code_by_hash_refs_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, CodeByHashRefs<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 194u8, 100u8, 213u8, 115u8, 143u8, 181u8, 255u8, 227u8, + 232u8, 163u8, 209u8, 99u8, 2u8, 138u8, 118u8, 169u8, 210u8, + 202u8, 190u8, 194u8, 221u8, 145u8, 171u8, 78u8, 212u8, 17u8, + 245u8, 107u8, 99u8, 5u8, 54u8, 118u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Validation code stored by its hash."] #[doc = ""] @@ -20722,15 +29885,26 @@ pub mod api { pub async fn code_by_hash( &self, _0 : & runtime_types :: polkadot_parachain :: primitives :: ValidationCodeHash, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::polkadot_parachain::primitives::ValidationCode, >, ::subxt::BasicError, > { - let entry = CodeByHash(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 41u8, 242u8, 100u8, 156u8, 32u8, 20u8, 72u8, 228u8, 143u8, + 3u8, 169u8, 169u8, 27u8, 111u8, 119u8, 135u8, 155u8, 17u8, + 222u8, 146u8, 43u8, 243u8, 2u8, 32u8, 102u8, 143u8, 143u8, + 55u8, 191u8, 129u8, 128u8, 35u8, + ] + { + let entry = CodeByHash(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Validation code stored by its hash."] #[doc = ""] @@ -20738,12 +29912,23 @@ pub mod api { #[doc = " [`PastCodeHash`]."] pub async fn code_by_hash_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, CodeByHash<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 41u8, 242u8, 100u8, 156u8, 32u8, 20u8, 72u8, 228u8, 143u8, + 3u8, 169u8, 169u8, 27u8, 111u8, 119u8, 135u8, 155u8, 17u8, + 222u8, 146u8, 43u8, 243u8, 2u8, 32u8, 102u8, 143u8, 143u8, + 55u8, 191u8, 129u8, 128u8, 35u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -20760,10 +29945,25 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u64, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Paras")?; - let constant = pallet.constant("UnsignedPriority")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Paras", "UnsignedPriority")? + == [ + 128u8, 214u8, 205u8, 242u8, 181u8, 142u8, 124u8, 231u8, + 190u8, 146u8, 59u8, 226u8, 157u8, 101u8, 103u8, 117u8, 249u8, + 65u8, 18u8, 191u8, 103u8, 119u8, 53u8, 85u8, 81u8, 96u8, + 220u8, 42u8, 184u8, 239u8, 42u8, 246u8, + ] + { + let pallet = self.client.metadata().pallet("Paras")?; + let constant = pallet.constant("UnsignedPriority")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -20813,16 +30013,30 @@ pub mod api { pub fn force_approve( &self, up_to: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ForceApprove, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ForceApprove, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ForceApprove { up_to }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 61u8, 29u8, 75u8, 222u8, 82u8, 250u8, 124u8, 164u8, 70u8, + 114u8, 150u8, 28u8, 103u8, 53u8, 185u8, 147u8, 168u8, 239u8, + 207u8, 197u8, 23u8, 158u8, 16u8, 255u8, 139u8, 18u8, 214u8, + 174u8, 53u8, 191u8, 49u8, 73u8, + ] + { + let call = ForceApprove { up_to }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -20863,11 +30077,22 @@ pub mod api { #[doc = " the semantics of this variable."] pub async fn has_initialized( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::option::Option<()>, ::subxt::BasicError> { - let entry = HasInitialized; - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 251u8, 135u8, 247u8, 61u8, 139u8, 102u8, 12u8, 122u8, 227u8, + 123u8, 11u8, 232u8, 120u8, 80u8, 81u8, 48u8, 216u8, 115u8, + 159u8, 131u8, 133u8, 105u8, 200u8, 122u8, 114u8, 6u8, 109u8, + 4u8, 164u8, 204u8, 214u8, 111u8, + ] + { + let entry = HasInitialized; + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Buffered session changes along with the block number at which they should be applied."] #[doc = ""] @@ -20875,9 +30100,26 @@ pub mod api { #[doc = " the storage."] #[doc = ""] #[doc = " However this is a `Vec` regardless to handle various edge cases that may occur at runtime"] - #[doc = " upgrade boundaries or if governance intervenes."] pub async fn buffered_session_changes (& self , hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < :: std :: vec :: Vec < runtime_types :: polkadot_runtime_parachains :: initializer :: BufferedSessionChange > , :: subxt :: BasicError >{ - let entry = BufferedSessionChanges; - self.client.storage().fetch_or_default(&entry, hash).await + #[doc = " upgrade boundaries or if governance intervenes."] pub async fn buffered_session_changes (& self , block_hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < :: std :: vec :: Vec < runtime_types :: polkadot_runtime_parachains :: initializer :: BufferedSessionChange > , :: subxt :: BasicError >{ + if self + .client + .metadata() + .storage_hash::()? + == [ + 79u8, 184u8, 104u8, 7u8, 11u8, 216u8, 205u8, 95u8, 155u8, + 51u8, 17u8, 160u8, 239u8, 14u8, 38u8, 99u8, 206u8, 87u8, + 87u8, 67u8, 207u8, 142u8, 1u8, 159u8, 54u8, 36u8, 194u8, + 77u8, 86u8, 124u8, 164u8, 251u8, + ] + { + let entry = BufferedSessionChanges; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -20955,7 +30197,7 @@ pub mod api { pub async fn downward_message_queues( &self, _0: &runtime_types::polkadot_parachain::primitives::Id, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec< runtime_types::polkadot_core_primitives::InboundDownwardMessage< @@ -20964,18 +30206,49 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = DownwardMessageQueues(_0); - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 104u8, 117u8, 177u8, 125u8, 208u8, 212u8, 216u8, 171u8, + 212u8, 235u8, 43u8, 255u8, 146u8, 230u8, 243u8, 27u8, 133u8, + 109u8, 129u8, 162u8, 247u8, 23u8, 195u8, 9u8, 219u8, 235u8, + 119u8, 220u8, 179u8, 198u8, 130u8, 4u8, + ] + { + let entry = DownwardMessageQueues(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The downward messages addressed for a certain para."] pub async fn downward_message_queues_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, DownwardMessageQueues<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 104u8, 117u8, 177u8, 125u8, 208u8, 212u8, 216u8, 171u8, + 212u8, 235u8, 43u8, 255u8, 146u8, 230u8, 243u8, 27u8, 133u8, + 109u8, 129u8, 162u8, 247u8, 23u8, 195u8, 9u8, 219u8, 235u8, + 119u8, 220u8, 179u8, 198u8, 130u8, 4u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " A mapping that stores the downward message queue MQC head for each para."] #[doc = ""] @@ -20987,11 +30260,28 @@ pub mod api { pub async fn downward_message_queue_heads( &self, _0: &runtime_types::polkadot_parachain::primitives::Id, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::subxt::sp_core::H256, ::subxt::BasicError> { - let entry = DownwardMessageQueueHeads(_0); - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 88u8, 45u8, 62u8, 250u8, 186u8, 97u8, 121u8, 56u8, 136u8, + 216u8, 73u8, 65u8, 253u8, 81u8, 94u8, 162u8, 132u8, 217u8, + 78u8, 126u8, 179u8, 188u8, 167u8, 220u8, 184u8, 217u8, 138u8, + 244u8, 98u8, 158u8, 25u8, 118u8, + ] + { + let entry = DownwardMessageQueueHeads(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " A mapping that stores the downward message queue MQC head for each para."] #[doc = ""] @@ -21002,12 +30292,26 @@ pub mod api { #[doc = " - `H(M)`: is the hash of the message being appended."] pub async fn downward_message_queue_heads_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, DownwardMessageQueueHeads<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 88u8, 45u8, 62u8, 250u8, 186u8, 97u8, 121u8, 56u8, 136u8, + 216u8, 73u8, 65u8, 253u8, 81u8, 94u8, 162u8, 132u8, 217u8, + 78u8, 126u8, 179u8, 188u8, 167u8, 220u8, 184u8, 217u8, 138u8, + 244u8, 98u8, 158u8, 25u8, 118u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -21063,19 +30367,33 @@ pub mod api { &self, index: ::core::primitive::u64, weight_limit: ::core::primitive::u64, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ServiceOverweight, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ServiceOverweight, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ServiceOverweight { - index, - weight_limit, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 229u8, 167u8, 106u8, 63u8, 141u8, 80u8, 8u8, 201u8, 156u8, + 34u8, 47u8, 104u8, 116u8, 57u8, 35u8, 216u8, 132u8, 3u8, + 201u8, 169u8, 38u8, 107u8, 149u8, 120u8, 42u8, 130u8, 100u8, + 133u8, 214u8, 48u8, 99u8, 146u8, + ] + { + let call = ServiceOverweight { + index, + weight_limit, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -21253,13 +30571,30 @@ pub mod api { pub async fn relay_dispatch_queues( &self, _0: &runtime_types::polkadot_parachain::primitives::Id, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec<::std::vec::Vec<::core::primitive::u8>>, ::subxt::BasicError, > { - let entry = RelayDispatchQueues(_0); - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 22u8, 48u8, 215u8, 37u8, 42u8, 115u8, 27u8, 8u8, 249u8, 65u8, + 47u8, 61u8, 96u8, 1u8, 196u8, 143u8, 53u8, 7u8, 241u8, 126u8, + 4u8, 242u8, 42u8, 171u8, 66u8, 162u8, 203u8, 200u8, 239u8, + 50u8, 87u8, 72u8, + ] + { + let entry = RelayDispatchQueues(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The messages waiting to be handled by the relay-chain originating from a certain parachain."] #[doc = ""] @@ -21269,12 +30604,26 @@ pub mod api { #[doc = " The messages are processed in FIFO order."] pub async fn relay_dispatch_queues_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, RelayDispatchQueues<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 22u8, 48u8, 215u8, 37u8, 42u8, 115u8, 27u8, 8u8, 249u8, 65u8, + 47u8, 61u8, 96u8, 1u8, 196u8, 143u8, 53u8, 7u8, 241u8, 126u8, + 4u8, 242u8, 42u8, 171u8, 66u8, 162u8, 203u8, 200u8, 239u8, + 50u8, 87u8, 72u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Size of the dispatch queues. Caches sizes of the queues in `RelayDispatchQueue`."] #[doc = ""] @@ -21290,13 +30639,30 @@ pub mod api { pub async fn relay_dispatch_queue_size( &self, _0: &runtime_types::polkadot_parachain::primitives::Id, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< (::core::primitive::u32, ::core::primitive::u32), ::subxt::BasicError, > { - let entry = RelayDispatchQueueSize(_0); - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 8u8, 0u8, 54u8, 33u8, 185u8, 112u8, 21u8, 174u8, 15u8, 147u8, + 134u8, 184u8, 108u8, 144u8, 55u8, 138u8, 24u8, 66u8, 255u8, + 197u8, 131u8, 229u8, 35u8, 107u8, 251u8, 226u8, 78u8, 218u8, + 41u8, 251u8, 155u8, 79u8, + ] + { + let entry = RelayDispatchQueueSize(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Size of the dispatch queues. Caches sizes of the queues in `RelayDispatchQueue`."] #[doc = ""] @@ -21311,12 +30677,26 @@ pub mod api { #[doc = " - The set of keys should exactly match the set of keys of `RelayDispatchQueues`."] pub async fn relay_dispatch_queue_size_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, RelayDispatchQueueSize<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 8u8, 0u8, 54u8, 33u8, 185u8, 112u8, 21u8, 174u8, 15u8, 147u8, + 134u8, 184u8, 108u8, 144u8, 55u8, 138u8, 24u8, 66u8, 255u8, + 197u8, 131u8, 229u8, 35u8, 107u8, 251u8, 226u8, 78u8, 218u8, + 41u8, 251u8, 155u8, 79u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The ordered list of `ParaId`s that have a `RelayDispatchQueue` entry."] #[doc = ""] @@ -21325,13 +30705,27 @@ pub mod api { #[doc = " `RelayDispatchQueues` and `RelayDispatchQueueSize`."] pub async fn needs_dispatch( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec, ::subxt::BasicError, > { - let entry = NeedsDispatch; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 75u8, 38u8, 232u8, 83u8, 71u8, 101u8, 248u8, 170u8, 5u8, + 32u8, 209u8, 97u8, 190u8, 31u8, 241u8, 1u8, 98u8, 87u8, 64u8, + 208u8, 26u8, 100u8, 93u8, 79u8, 61u8, 114u8, 11u8, 172u8, + 112u8, 164u8, 171u8, 237u8, + ] + { + let entry = NeedsDispatch; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " This is the para that gets will get dispatched first during the next upward dispatchable queue"] #[doc = " execution round."] @@ -21340,15 +30734,29 @@ pub mod api { #[doc = " - If `Some(para)`, then `para` must be present in `NeedsDispatch`."] pub async fn next_dispatch_round_start_with( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::polkadot_parachain::primitives::Id, >, ::subxt::BasicError, > { - let entry = NextDispatchRoundStartWith; - self.client.storage().fetch(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 102u8, 165u8, 118u8, 140u8, 84u8, 122u8, 91u8, 169u8, 232u8, + 125u8, 52u8, 228u8, 15u8, 228u8, 91u8, 79u8, 218u8, 62u8, + 93u8, 42u8, 204u8, 6u8, 34u8, 185u8, 218u8, 150u8, 7u8, + 250u8, 79u8, 142u8, 211u8, 0u8, + ] + { + let entry = NextDispatchRoundStartWith; + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The messages that exceeded max individual message weight budget."] #[doc = ""] @@ -21356,7 +30764,7 @@ pub mod api { pub async fn overweight( &self, _0: &::core::primitive::u64, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<( runtime_types::polkadot_parachain::primitives::Id, @@ -21364,30 +30772,66 @@ pub mod api { )>, ::subxt::BasicError, > { - let entry = Overweight(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 223u8, 155u8, 1u8, 100u8, 77u8, 13u8, 92u8, 235u8, 64u8, + 30u8, 199u8, 178u8, 149u8, 66u8, 155u8, 201u8, 84u8, 26u8, + 81u8, 183u8, 0u8, 113u8, 182u8, 37u8, 69u8, 66u8, 240u8, + 151u8, 254u8, 249u8, 134u8, 51u8, + ] + { + let entry = Overweight(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The messages that exceeded max individual message weight budget."] #[doc = ""] #[doc = " These messages stay there until manually dispatched."] pub async fn overweight_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Overweight<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 223u8, 155u8, 1u8, 100u8, 77u8, 13u8, 92u8, 235u8, 64u8, + 30u8, 199u8, 178u8, 149u8, 66u8, 155u8, 201u8, 84u8, 26u8, + 81u8, 183u8, 0u8, 113u8, 182u8, 37u8, 69u8, 66u8, 240u8, + 151u8, 254u8, 249u8, 134u8, 51u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The number of overweight messages ever recorded in `Overweight` (and thus the lowest free"] #[doc = " index)."] pub async fn overweight_count( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u64, ::subxt::BasicError> { - let entry = OverweightCount; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 102u8, 180u8, 196u8, 148u8, 115u8, 62u8, 46u8, 238u8, 97u8, + 116u8, 117u8, 42u8, 14u8, 5u8, 72u8, 237u8, 230u8, 46u8, + 150u8, 126u8, 89u8, 64u8, 233u8, 166u8, 180u8, 137u8, 52u8, + 233u8, 252u8, 255u8, 36u8, 20u8, + ] + { + let entry = OverweightCount; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -21506,20 +30950,34 @@ pub mod api { recipient: runtime_types::polkadot_parachain::primitives::Id, proposed_max_capacity: ::core::primitive::u32, proposed_max_message_size: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - HrmpInitOpenChannel, - DispatchError, - root_mod::Event, - > { - let call = HrmpInitOpenChannel { - recipient, - proposed_max_capacity, - proposed_max_message_size, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + HrmpInitOpenChannel, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 244u8, 142u8, 161u8, 144u8, 109u8, 104u8, 164u8, 198u8, + 201u8, 79u8, 178u8, 136u8, 107u8, 104u8, 83u8, 11u8, 167u8, + 164u8, 223u8, 147u8, 135u8, 35u8, 133u8, 176u8, 236u8, 112u8, + 107u8, 131u8, 184u8, 105u8, 174u8, 12u8, + ] + { + let call = HrmpInitOpenChannel { + recipient, + proposed_max_capacity, + proposed_max_message_size, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Accept a pending open channel request from the given sender."] #[doc = ""] @@ -21527,16 +30985,33 @@ pub mod api { pub fn hrmp_accept_open_channel( &self, sender: runtime_types::polkadot_parachain::primitives::Id, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - HrmpAcceptOpenChannel, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + HrmpAcceptOpenChannel, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = HrmpAcceptOpenChannel { sender }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 95u8, 196u8, 155u8, 220u8, 235u8, 120u8, 67u8, 247u8, 245u8, + 20u8, 162u8, 41u8, 4u8, 204u8, 125u8, 16u8, 224u8, 72u8, + 198u8, 237u8, 84u8, 46u8, 201u8, 17u8, 172u8, 55u8, 115u8, + 51u8, 16u8, 140u8, 4u8, 253u8, + ] + { + let call = HrmpAcceptOpenChannel { sender }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Initiate unilateral closing of a channel. The origin must be either the sender or the"] #[doc = "recipient in the channel being closed."] @@ -21545,16 +31020,30 @@ pub mod api { pub fn hrmp_close_channel( &self, channel_id : runtime_types :: polkadot_parachain :: primitives :: HrmpChannelId, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - HrmpCloseChannel, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + HrmpCloseChannel, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = HrmpCloseChannel { channel_id }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 199u8, 9u8, 55u8, 184u8, 196u8, 45u8, 46u8, 251u8, 48u8, + 23u8, 132u8, 74u8, 188u8, 121u8, 41u8, 18u8, 71u8, 65u8, + 129u8, 14u8, 38u8, 48u8, 253u8, 119u8, 171u8, 202u8, 9u8, + 65u8, 250u8, 98u8, 185u8, 220u8, + ] + { + let call = HrmpCloseChannel { channel_id }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "This extrinsic triggers the cleanup of all the HRMP storage items that"] #[doc = "a para may have. Normally this happens once per session, but this allows"] @@ -21568,20 +31057,34 @@ pub mod api { para: runtime_types::polkadot_parachain::primitives::Id, inbound: ::core::primitive::u32, outbound: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ForceCleanHrmp, - DispatchError, - root_mod::Event, - > { - let call = ForceCleanHrmp { - para, - inbound, - outbound, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ForceCleanHrmp, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 182u8, 231u8, 99u8, 129u8, 130u8, 109u8, 97u8, 108u8, 37u8, + 107u8, 203u8, 70u8, 133u8, 106u8, 226u8, 77u8, 110u8, 189u8, + 227u8, 26u8, 129u8, 189u8, 234u8, 215u8, 112u8, 22u8, 127u8, + 185u8, 152u8, 157u8, 14u8, 66u8, + ] + { + let call = ForceCleanHrmp { + para, + inbound, + outbound, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Force process HRMP open channel requests."] #[doc = ""] @@ -21592,16 +31095,30 @@ pub mod api { pub fn force_process_hrmp_open( &self, channels: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ForceProcessHrmpOpen, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ForceProcessHrmpOpen, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ForceProcessHrmpOpen { channels }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 162u8, 53u8, 194u8, 175u8, 117u8, 32u8, 217u8, 177u8, 9u8, + 255u8, 88u8, 40u8, 8u8, 174u8, 8u8, 11u8, 26u8, 82u8, 213u8, + 40u8, 20u8, 89u8, 227u8, 209u8, 95u8, 162u8, 221u8, 97u8, + 230u8, 98u8, 110u8, 85u8, + ] + { + let call = ForceProcessHrmpOpen { channels }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Force process HRMP close channel requests."] #[doc = ""] @@ -21612,16 +31129,33 @@ pub mod api { pub fn force_process_hrmp_close( &self, channels: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ForceProcessHrmpClose, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ForceProcessHrmpClose, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ForceProcessHrmpClose { channels }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 128u8, 141u8, 191u8, 255u8, 204u8, 137u8, 27u8, 170u8, 180u8, + 166u8, 93u8, 144u8, 70u8, 56u8, 132u8, 100u8, 5u8, 114u8, + 252u8, 163u8, 164u8, 246u8, 234u8, 152u8, 193u8, 79u8, 89u8, + 137u8, 46u8, 171u8, 32u8, 119u8, + ] + { + let call = ForceProcessHrmpClose { channels }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "This cancels a pending open channel request. It can be canceled by either of the sender"] #[doc = "or the recipient for that request. The origin must be either of those."] @@ -21635,19 +31169,36 @@ pub mod api { &self, channel_id : runtime_types :: polkadot_parachain :: primitives :: HrmpChannelId, open_requests: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - HrmpCancelOpenRequest, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + HrmpCancelOpenRequest, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = HrmpCancelOpenRequest { - channel_id, - open_requests, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 8u8, 83u8, 32u8, 187u8, 220u8, 1u8, 212u8, 226u8, 72u8, 61u8, + 110u8, 211u8, 238u8, 119u8, 95u8, 48u8, 150u8, 51u8, 177u8, + 182u8, 209u8, 174u8, 245u8, 25u8, 194u8, 199u8, 212u8, 131u8, + 77u8, 72u8, 9u8, 120u8, + ] + { + let call = HrmpCancelOpenRequest { + channel_id, + open_requests, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -21885,9 +31436,23 @@ pub mod api { #[doc = " The set is accompanied by a list for iteration."] #[doc = ""] #[doc = " Invariant:"] - #[doc = " - There are no channels that exists in list but not in the set and vice versa."] pub async fn hrmp_open_channel_requests (& self , _0 : & runtime_types :: polkadot_parachain :: primitives :: HrmpChannelId , hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < :: core :: option :: Option < runtime_types :: polkadot_runtime_parachains :: hrmp :: HrmpOpenChannelRequest > , :: subxt :: BasicError >{ - let entry = HrmpOpenChannelRequests(_0); - self.client.storage().fetch(&entry, hash).await + #[doc = " - There are no channels that exists in list but not in the set and vice versa."] pub async fn hrmp_open_channel_requests (& self , _0 : & runtime_types :: polkadot_parachain :: primitives :: HrmpChannelId , block_hash : :: core :: option :: Option < T :: Hash > ,) -> :: core :: result :: Result < :: core :: option :: Option < runtime_types :: polkadot_runtime_parachains :: hrmp :: HrmpOpenChannelRequest > , :: subxt :: BasicError >{ + if self + .client + .metadata() + .storage_hash::()? + == [ + 58u8, 216u8, 106u8, 4u8, 117u8, 77u8, 168u8, 230u8, 50u8, + 6u8, 175u8, 26u8, 110u8, 45u8, 143u8, 207u8, 174u8, 77u8, + 5u8, 245u8, 172u8, 114u8, 20u8, 229u8, 153u8, 137u8, 220u8, + 189u8, 155u8, 5u8, 116u8, 236u8, + ] + { + let entry = HrmpOpenChannelRequests(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The set of pending HRMP open channel requests."] #[doc = ""] @@ -21897,24 +31462,55 @@ pub mod api { #[doc = " - There are no channels that exists in list but not in the set and vice versa."] pub async fn hrmp_open_channel_requests_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, HrmpOpenChannelRequests<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 58u8, 216u8, 106u8, 4u8, 117u8, 77u8, 168u8, 230u8, 50u8, + 6u8, 175u8, 26u8, 110u8, 45u8, 143u8, 207u8, 174u8, 77u8, + 5u8, 245u8, 172u8, 114u8, 20u8, 229u8, 153u8, 137u8, 220u8, + 189u8, 155u8, 5u8, 116u8, 236u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } pub async fn hrmp_open_channel_requests_list( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec< runtime_types::polkadot_parachain::primitives::HrmpChannelId, >, ::subxt::BasicError, > { - let entry = HrmpOpenChannelRequestsList; - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 176u8, 22u8, 136u8, 206u8, 243u8, 208u8, 67u8, 150u8, 187u8, + 163u8, 141u8, 37u8, 235u8, 84u8, 176u8, 63u8, 55u8, 38u8, + 215u8, 185u8, 206u8, 127u8, 37u8, 108u8, 245u8, 237u8, 154u8, + 151u8, 111u8, 33u8, 39u8, 102u8, + ] + { + let entry = HrmpOpenChannelRequestsList; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " This mapping tracks how many open channel requests are initiated by a given sender para."] #[doc = " Invariant: `HrmpOpenChannelRequests` should contain the same number of items that has"] @@ -21922,23 +31518,54 @@ pub mod api { pub async fn hrmp_open_channel_request_count( &self, _0: &runtime_types::polkadot_parachain::primitives::Id, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let entry = HrmpOpenChannelRequestCount(_0); - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 103u8, 47u8, 152u8, 1u8, 119u8, 244u8, 62u8, 249u8, 141u8, + 194u8, 157u8, 149u8, 58u8, 208u8, 113u8, 77u8, 4u8, 248u8, + 114u8, 94u8, 153u8, 20u8, 179u8, 4u8, 43u8, 32u8, 248u8, + 118u8, 115u8, 206u8, 228u8, 28u8, + ] + { + let entry = HrmpOpenChannelRequestCount(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " This mapping tracks how many open channel requests are initiated by a given sender para."] #[doc = " Invariant: `HrmpOpenChannelRequests` should contain the same number of items that has"] #[doc = " `(X, _)` as the number of `HrmpOpenChannelRequestCount` for `X`."] pub async fn hrmp_open_channel_request_count_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, HrmpOpenChannelRequestCount<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 103u8, 47u8, 152u8, 1u8, 119u8, 244u8, 62u8, 249u8, 141u8, + 194u8, 157u8, 149u8, 58u8, 208u8, 113u8, 77u8, 4u8, 248u8, + 114u8, 94u8, 153u8, 20u8, 179u8, 4u8, 43u8, 32u8, 248u8, + 118u8, 115u8, 206u8, 228u8, 28u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " This mapping tracks how many open channel requests were accepted by a given recipient para."] #[doc = " Invariant: `HrmpOpenChannelRequests` should contain the same number of items `(_, X)` with"] @@ -21946,23 +31573,54 @@ pub mod api { pub async fn hrmp_accepted_channel_request_count( &self, _0: &runtime_types::polkadot_parachain::primitives::Id, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let entry = HrmpAcceptedChannelRequestCount(_0); - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 166u8, 207u8, 97u8, 222u8, 30u8, 204u8, 203u8, 122u8, 72u8, + 66u8, 247u8, 169u8, 128u8, 122u8, 145u8, 124u8, 214u8, 183u8, + 251u8, 85u8, 93u8, 37u8, 143u8, 71u8, 45u8, 61u8, 168u8, + 211u8, 222u8, 58u8, 91u8, 202u8, + ] + { + let entry = HrmpAcceptedChannelRequestCount(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " This mapping tracks how many open channel requests were accepted by a given recipient para."] #[doc = " Invariant: `HrmpOpenChannelRequests` should contain the same number of items `(_, X)` with"] #[doc = " `confirmed` set to true, as the number of `HrmpAcceptedChannelRequestCount` for `X`."] pub async fn hrmp_accepted_channel_request_count_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, HrmpAcceptedChannelRequestCount<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 166u8, 207u8, 97u8, 222u8, 30u8, 204u8, 203u8, 122u8, 72u8, + 66u8, 247u8, 169u8, 128u8, 122u8, 145u8, 124u8, 214u8, 183u8, + 251u8, 85u8, 93u8, 37u8, 143u8, 71u8, 45u8, 61u8, 168u8, + 211u8, 222u8, 58u8, 91u8, 202u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " A set of pending HRMP close channel requests that are going to be closed during the session"] #[doc = " change. Used for checking if a given channel is registered for closure."] @@ -21974,11 +31632,25 @@ pub mod api { pub async fn hrmp_close_channel_requests( &self, _0: &runtime_types::polkadot_parachain::primitives::HrmpChannelId, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::option::Option<()>, ::subxt::BasicError> { - let entry = HrmpCloseChannelRequests(_0); - self.client.storage().fetch(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 118u8, 8u8, 142u8, 158u8, 184u8, 200u8, 38u8, 112u8, 217u8, + 69u8, 161u8, 255u8, 116u8, 143u8, 94u8, 185u8, 95u8, 247u8, + 227u8, 101u8, 107u8, 55u8, 172u8, 164u8, 58u8, 182u8, 193u8, + 140u8, 142u8, 118u8, 223u8, 240u8, + ] + { + let entry = HrmpCloseChannelRequests(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " A set of pending HRMP close channel requests that are going to be closed during the session"] #[doc = " change. Used for checking if a given channel is registered for closure."] @@ -21989,24 +31661,55 @@ pub mod api { #[doc = " - There are no channels that exists in list but not in the set and vice versa."] pub async fn hrmp_close_channel_requests_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, HrmpCloseChannelRequests<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 118u8, 8u8, 142u8, 158u8, 184u8, 200u8, 38u8, 112u8, 217u8, + 69u8, 161u8, 255u8, 116u8, 143u8, 94u8, 185u8, 95u8, 247u8, + 227u8, 101u8, 107u8, 55u8, 172u8, 164u8, 58u8, 182u8, 193u8, + 140u8, 142u8, 118u8, 223u8, 240u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } pub async fn hrmp_close_channel_requests_list( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec< runtime_types::polkadot_parachain::primitives::HrmpChannelId, >, ::subxt::BasicError, > { - let entry = HrmpCloseChannelRequestsList; - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 203u8, 46u8, 200u8, 63u8, 120u8, 238u8, 88u8, 170u8, 239u8, + 27u8, 99u8, 104u8, 254u8, 194u8, 152u8, 221u8, 126u8, 188u8, + 2u8, 153u8, 79u8, 183u8, 236u8, 145u8, 120u8, 151u8, 235u8, + 56u8, 130u8, 240u8, 74u8, 211u8, + ] + { + let entry = HrmpCloseChannelRequestsList; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The HRMP watermark associated with each para."] #[doc = " Invariant:"] @@ -22014,25 +31717,47 @@ pub mod api { pub async fn hrmp_watermarks( &self, _0: &runtime_types::polkadot_parachain::primitives::Id, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<::core::primitive::u32>, ::subxt::BasicError, > { - let entry = HrmpWatermarks(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 28u8, 187u8, 5u8, 0u8, 130u8, 11u8, 241u8, 171u8, 141u8, + 109u8, 236u8, 151u8, 194u8, 124u8, 172u8, 180u8, 36u8, 144u8, + 134u8, 53u8, 162u8, 247u8, 138u8, 209u8, 99u8, 194u8, 213u8, + 100u8, 254u8, 15u8, 51u8, 94u8, + ] + { + let entry = HrmpWatermarks(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The HRMP watermark associated with each para."] #[doc = " Invariant:"] #[doc = " - each para `P` used here as a key should satisfy `Paras::is_valid_para(P)` within a session."] pub async fn hrmp_watermarks_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, HrmpWatermarks<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 28u8, 187u8, 5u8, 0u8, 130u8, 11u8, 241u8, 171u8, 141u8, + 109u8, 236u8, 151u8, 194u8, 124u8, 172u8, 180u8, 36u8, 144u8, + 134u8, 53u8, 162u8, 247u8, 138u8, 209u8, 99u8, 194u8, 213u8, + 100u8, 254u8, 15u8, 51u8, 94u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " HRMP channel data associated with each para."] #[doc = " Invariant:"] @@ -22040,27 +31765,49 @@ pub mod api { pub async fn hrmp_channels( &self, _0: &runtime_types::polkadot_parachain::primitives::HrmpChannelId, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::polkadot_runtime_parachains::hrmp::HrmpChannel, >, ::subxt::BasicError, > { - let entry = HrmpChannels(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 241u8, 160u8, 242u8, 167u8, 251u8, 8u8, 131u8, 194u8, 179u8, + 216u8, 231u8, 125u8, 58u8, 118u8, 61u8, 113u8, 46u8, 47u8, + 6u8, 71u8, 46u8, 113u8, 192u8, 1u8, 199u8, 207u8, 179u8, + 253u8, 144u8, 146u8, 19u8, 1u8, + ] + { + let entry = HrmpChannels(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " HRMP channel data associated with each para."] #[doc = " Invariant:"] #[doc = " - each participant in the channel should satisfy `Paras::is_valid_para(P)` within a session."] pub async fn hrmp_channels_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, HrmpChannels<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 241u8, 160u8, 242u8, 167u8, 251u8, 8u8, 131u8, 194u8, 179u8, + 216u8, 231u8, 125u8, 58u8, 118u8, 61u8, 113u8, 46u8, 47u8, + 6u8, 71u8, 46u8, 113u8, 192u8, 1u8, 199u8, 207u8, 179u8, + 253u8, 144u8, 146u8, 19u8, 1u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Ingress/egress indexes allow to find all the senders and receivers given the opposite side."] #[doc = " I.e."] @@ -22078,13 +31825,30 @@ pub mod api { pub async fn hrmp_ingress_channels_index( &self, _0: &runtime_types::polkadot_parachain::primitives::Id, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec, ::subxt::BasicError, > { - let entry = HrmpIngressChannelsIndex(_0); - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 193u8, 185u8, 164u8, 194u8, 89u8, 218u8, 214u8, 184u8, 100u8, + 238u8, 232u8, 90u8, 243u8, 230u8, 93u8, 191u8, 197u8, 182u8, + 215u8, 254u8, 192u8, 11u8, 171u8, 211u8, 150u8, 210u8, 75u8, + 216u8, 149u8, 60u8, 49u8, 166u8, + ] + { + let entry = HrmpIngressChannelsIndex(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Ingress/egress indexes allow to find all the senders and receivers given the opposite side."] #[doc = " I.e."] @@ -22101,39 +31865,84 @@ pub mod api { #[doc = " - the vectors are sorted."] pub async fn hrmp_ingress_channels_index_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, HrmpIngressChannelsIndex<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 193u8, 185u8, 164u8, 194u8, 89u8, 218u8, 214u8, 184u8, 100u8, + 238u8, 232u8, 90u8, 243u8, 230u8, 93u8, 191u8, 197u8, 182u8, + 215u8, 254u8, 192u8, 11u8, 171u8, 211u8, 150u8, 210u8, 75u8, + 216u8, 149u8, 60u8, 49u8, 166u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } pub async fn hrmp_egress_channels_index( &self, _0: &runtime_types::polkadot_parachain::primitives::Id, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec, ::subxt::BasicError, > { - let entry = HrmpEgressChannelsIndex(_0); - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 242u8, 138u8, 89u8, 201u8, 60u8, 216u8, 73u8, 66u8, 167u8, + 82u8, 225u8, 42u8, 61u8, 50u8, 54u8, 187u8, 212u8, 8u8, + 255u8, 183u8, 85u8, 180u8, 176u8, 0u8, 226u8, 173u8, 45u8, + 155u8, 172u8, 28u8, 229u8, 157u8, + ] + { + let entry = HrmpEgressChannelsIndex(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } pub async fn hrmp_egress_channels_index_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, HrmpEgressChannelsIndex<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 242u8, 138u8, 89u8, 201u8, 60u8, 216u8, 73u8, 66u8, 167u8, + 82u8, 225u8, 42u8, 61u8, 50u8, 54u8, 187u8, 212u8, 8u8, + 255u8, 183u8, 85u8, 180u8, 176u8, 0u8, 226u8, 173u8, 45u8, + 155u8, 172u8, 28u8, 229u8, 157u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Storage for the messages for each channel."] #[doc = " Invariant: cannot be non-empty if the corresponding channel in `HrmpChannels` is `None`."] pub async fn hrmp_channel_contents( &self, _0: &runtime_types::polkadot_parachain::primitives::HrmpChannelId, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec< runtime_types::polkadot_core_primitives::InboundHrmpMessage< @@ -22142,19 +31951,50 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = HrmpChannelContents(_0); - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 71u8, 246u8, 41u8, 12u8, 125u8, 10u8, 60u8, 209u8, 14u8, + 254u8, 125u8, 217u8, 251u8, 172u8, 243u8, 73u8, 33u8, 230u8, + 242u8, 16u8, 207u8, 165u8, 33u8, 136u8, 78u8, 83u8, 206u8, + 134u8, 65u8, 115u8, 166u8, 192u8, + ] + { + let entry = HrmpChannelContents(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Storage for the messages for each channel."] #[doc = " Invariant: cannot be non-empty if the corresponding channel in `HrmpChannels` is `None`."] pub async fn hrmp_channel_contents_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, HrmpChannelContents<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 71u8, 246u8, 41u8, 12u8, 125u8, 10u8, 60u8, 209u8, 14u8, + 254u8, 125u8, 217u8, 251u8, 172u8, 243u8, 73u8, 33u8, 230u8, + 242u8, 16u8, 207u8, 165u8, 33u8, 136u8, 78u8, 83u8, 206u8, + 134u8, 65u8, 115u8, 166u8, 192u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Maintains a mapping that can be used to answer the question: What paras sent a message at"] #[doc = " the given block number for a given receiver. Invariants:"] @@ -22165,7 +32005,7 @@ pub mod api { pub async fn hrmp_channel_digests( &self, _0: &runtime_types::polkadot_parachain::primitives::Id, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec<( ::core::primitive::u32, @@ -22175,8 +32015,25 @@ pub mod api { )>, ::subxt::BasicError, > { - let entry = HrmpChannelDigests(_0); - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 54u8, 106u8, 76u8, 21u8, 18u8, 49u8, 1u8, 34u8, 247u8, 101u8, + 150u8, 142u8, 214u8, 137u8, 193u8, 100u8, 208u8, 162u8, 55u8, + 229u8, 203u8, 36u8, 154u8, 138u8, 48u8, 204u8, 114u8, 243u8, + 54u8, 185u8, 27u8, 173u8, + ] + { + let entry = HrmpChannelDigests(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Maintains a mapping that can be used to answer the question: What paras sent a message at"] #[doc = " the given block number for a given receiver. Invariants:"] @@ -22186,12 +32043,26 @@ pub mod api { #[doc = " same block number."] pub async fn hrmp_channel_digests_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, HrmpChannelDigests<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 54u8, 106u8, 76u8, 21u8, 18u8, 49u8, 1u8, 34u8, 247u8, 101u8, + 150u8, 142u8, 214u8, 137u8, 193u8, 100u8, 208u8, 162u8, 55u8, + 229u8, 203u8, 36u8, 154u8, 138u8, 48u8, 204u8, 114u8, 243u8, + 54u8, 185u8, 27u8, 173u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -22247,24 +32118,58 @@ pub mod api { #[doc = " When in doubt, use `Sessions` API instead."] pub async fn assignment_keys_unsafe( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec< runtime_types::polkadot_primitives::v2::assignment_app::Public, >, ::subxt::BasicError, > { - let entry = AssignmentKeysUnsafe; - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 243u8, 5u8, 37u8, 167u8, 29u8, 59u8, 87u8, 66u8, 53u8, 91u8, + 181u8, 9u8, 144u8, 248u8, 225u8, 121u8, 130u8, 111u8, 140u8, + 35u8, 79u8, 187u8, 159u8, 22u8, 192u8, 166u8, 144u8, 161u8, + 239u8, 98u8, 255u8, 108u8, + ] + { + let entry = AssignmentKeysUnsafe; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The earliest session for which previous session info is stored."] pub async fn earliest_stored_session( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let entry = EarliestStoredSession; - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 25u8, 143u8, 246u8, 184u8, 35u8, 166u8, 140u8, 147u8, 171u8, + 5u8, 164u8, 159u8, 228u8, 21u8, 248u8, 236u8, 48u8, 210u8, + 133u8, 140u8, 171u8, 3u8, 85u8, 250u8, 160u8, 102u8, 95u8, + 46u8, 33u8, 81u8, 102u8, 241u8, + ] + { + let entry = EarliestStoredSession; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Session information in a rolling window."] #[doc = " Should have an entry in range `EarliestStoredSession..=CurrentSessionIndex`."] @@ -22272,27 +32177,49 @@ pub mod api { pub async fn sessions( &self, _0: &::core::primitive::u32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::polkadot_primitives::v2::SessionInfo, >, ::subxt::BasicError, > { - let entry = Sessions(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 95u8, 222u8, 240u8, 96u8, 203u8, 233u8, 100u8, 160u8, 180u8, + 161u8, 180u8, 123u8, 168u8, 102u8, 93u8, 172u8, 93u8, 174u8, + 103u8, 211u8, 254u8, 30u8, 207u8, 199u8, 148u8, 200u8, 100u8, + 155u8, 149u8, 48u8, 238u8, 51u8, + ] + { + let entry = Sessions(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Session information in a rolling window."] #[doc = " Should have an entry in range `EarliestStoredSession..=CurrentSessionIndex`."] #[doc = " Does not have any entries before the session index in the first session change notification."] pub async fn sessions_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Sessions<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 95u8, 222u8, 240u8, 96u8, 203u8, 233u8, 100u8, 160u8, 180u8, + 161u8, 180u8, 123u8, 168u8, 102u8, 93u8, 172u8, 93u8, 174u8, + 103u8, 211u8, 254u8, 30u8, 207u8, 199u8, 148u8, 200u8, 100u8, + 155u8, 149u8, 48u8, 238u8, 51u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -22331,16 +32258,30 @@ pub mod api { } pub fn force_unfreeze( &self, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ForceUnfreeze, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ForceUnfreeze, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ForceUnfreeze {}; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 212u8, 211u8, 58u8, 159u8, 23u8, 220u8, 64u8, 175u8, 65u8, + 50u8, 192u8, 122u8, 113u8, 189u8, 74u8, 191u8, 48u8, 93u8, + 251u8, 50u8, 237u8, 240u8, 91u8, 139u8, 193u8, 114u8, 131u8, + 125u8, 124u8, 236u8, 191u8, 190u8, + ] + { + let call = ForceUnfreeze {}; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -22482,20 +32423,31 @@ pub mod api { #[doc = " references sessions."] pub async fn last_pruned_session( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<::core::primitive::u32>, ::subxt::BasicError, > { - let entry = LastPrunedSession; - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 125u8, 138u8, 99u8, 242u8, 9u8, 246u8, 215u8, 246u8, 141u8, + 6u8, 129u8, 87u8, 27u8, 58u8, 53u8, 121u8, 61u8, 119u8, 35u8, + 104u8, 33u8, 43u8, 179u8, 82u8, 244u8, 121u8, 174u8, 135u8, + 87u8, 119u8, 236u8, 105u8, + ] + { + let entry = LastPrunedSession; + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " All ongoing or concluded disputes for the last several sessions."] pub async fn disputes( &self, _0: &::core::primitive::u32, _1: &runtime_types::polkadot_core_primitives::CandidateHash, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::polkadot_primitives::v2::DisputeState< @@ -22504,18 +32456,40 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = Disputes(_0, _1); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 37u8, 50u8, 243u8, 127u8, 8u8, 137u8, 232u8, 140u8, 200u8, + 76u8, 211u8, 245u8, 26u8, 63u8, 113u8, 31u8, 169u8, 92u8, + 165u8, 143u8, 11u8, 29u8, 2u8, 25u8, 55u8, 250u8, 173u8, + 237u8, 153u8, 4u8, 235u8, 10u8, + ] + { + let entry = Disputes(_0, _1); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " All ongoing or concluded disputes for the last several sessions."] pub async fn disputes_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Disputes<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 37u8, 50u8, 243u8, 127u8, 8u8, 137u8, 232u8, 140u8, 200u8, + 76u8, 211u8, 245u8, 26u8, 63u8, 113u8, 31u8, 169u8, 92u8, + 165u8, 143u8, 11u8, 29u8, 2u8, 25u8, 55u8, 250u8, 173u8, + 237u8, 153u8, 4u8, 235u8, 10u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " All included blocks on the chain, as well as the block number in this chain that"] #[doc = " should be reverted back to if the candidate is disputed and determined to be invalid."] @@ -22523,24 +32497,46 @@ pub mod api { &self, _0: &::core::primitive::u32, _1: &runtime_types::polkadot_core_primitives::CandidateHash, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<::core::primitive::u32>, ::subxt::BasicError, > { - let entry = Included(_0, _1); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 32u8, 107u8, 8u8, 112u8, 201u8, 81u8, 66u8, 223u8, 120u8, + 51u8, 166u8, 240u8, 229u8, 141u8, 231u8, 132u8, 114u8, 36u8, + 213u8, 48u8, 249u8, 153u8, 143u8, 157u8, 93u8, 204u8, 207u8, + 144u8, 52u8, 36u8, 46u8, 12u8, + ] + { + let entry = Included(_0, _1); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " All included blocks on the chain, as well as the block number in this chain that"] #[doc = " should be reverted back to if the candidate is disputed and determined to be invalid."] pub async fn included_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Included<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 32u8, 107u8, 8u8, 112u8, 201u8, 81u8, 66u8, 223u8, 120u8, + 51u8, 166u8, 240u8, 229u8, 141u8, 231u8, 132u8, 114u8, 36u8, + 213u8, 48u8, 249u8, 153u8, 143u8, 157u8, 93u8, 204u8, 207u8, + 144u8, 52u8, 36u8, 46u8, 12u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Maps session indices to a vector indicating the number of potentially-spam disputes"] #[doc = " each validator is participating in. Potentially-spam disputes are remote disputes which have"] @@ -22550,13 +32546,24 @@ pub mod api { pub async fn spam_slots( &self, _0: &::core::primitive::u32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<::std::vec::Vec<::core::primitive::u32>>, ::subxt::BasicError, > { - let entry = SpamSlots(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 172u8, 23u8, 120u8, 188u8, 71u8, 248u8, 252u8, 41u8, 132u8, + 221u8, 98u8, 215u8, 33u8, 242u8, 168u8, 196u8, 90u8, 123u8, + 190u8, 27u8, 147u8, 6u8, 196u8, 175u8, 198u8, 216u8, 50u8, + 74u8, 138u8, 122u8, 251u8, 238u8, + ] + { + let entry = SpamSlots(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Maps session indices to a vector indicating the number of potentially-spam disputes"] #[doc = " each validator is participating in. Potentially-spam disputes are remote disputes which have"] @@ -22565,12 +32572,23 @@ pub mod api { #[doc = " The i'th entry of the vector corresponds to the i'th validator in the session."] pub async fn spam_slots_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, SpamSlots<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 172u8, 23u8, 120u8, 188u8, 71u8, 248u8, 252u8, 41u8, 132u8, + 221u8, 98u8, 215u8, 33u8, 242u8, 168u8, 196u8, 90u8, 123u8, + 190u8, 27u8, 147u8, 6u8, 196u8, 175u8, 198u8, 216u8, 50u8, + 74u8, 138u8, 122u8, 251u8, 238u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Whether the chain is frozen. Starts as `None`. When this is `Some`,"] #[doc = " the chain will not accept any new parachain blocks for backing or inclusion,"] @@ -22578,13 +32596,27 @@ pub mod api { #[doc = " It can only be set back to `None` by governance intervention."] pub async fn frozen( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<::core::primitive::u32>, ::subxt::BasicError, > { - let entry = Frozen; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 133u8, 100u8, 86u8, 220u8, 180u8, 189u8, 65u8, 131u8, 64u8, + 56u8, 219u8, 47u8, 130u8, 167u8, 210u8, 125u8, 49u8, 7u8, + 153u8, 254u8, 20u8, 53u8, 218u8, 177u8, 122u8, 148u8, 16u8, + 198u8, 251u8, 50u8, 194u8, 128u8, + ] + { + let entry = Frozen; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -22689,20 +32721,34 @@ pub mod api { id: runtime_types::polkadot_parachain::primitives::Id, genesis_head: runtime_types::polkadot_parachain::primitives::HeadData, validation_code : runtime_types :: polkadot_parachain :: primitives :: ValidationCode, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Register, - DispatchError, - root_mod::Event, - > { - let call = Register { - id, - genesis_head, - validation_code, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Register, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 180u8, 21u8, 142u8, 73u8, 21u8, 31u8, 64u8, 210u8, 196u8, + 4u8, 142u8, 153u8, 172u8, 207u8, 95u8, 209u8, 177u8, 75u8, + 202u8, 85u8, 95u8, 208u8, 123u8, 237u8, 190u8, 148u8, 5u8, + 64u8, 65u8, 191u8, 221u8, 203u8, + ] + { + let call = Register { + id, + genesis_head, + validation_code, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Force the registration of a Para Id on the relay chain."] #[doc = ""] @@ -22717,22 +32763,36 @@ pub mod api { id: runtime_types::polkadot_parachain::primitives::Id, genesis_head: runtime_types::polkadot_parachain::primitives::HeadData, validation_code : runtime_types :: polkadot_parachain :: primitives :: ValidationCode, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ForceRegister, - DispatchError, - root_mod::Event, - > { - let call = ForceRegister { - who, - deposit, - id, - genesis_head, - validation_code, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ForceRegister, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 191u8, 198u8, 172u8, 68u8, 118u8, 126u8, 110u8, 47u8, 193u8, + 147u8, 61u8, 27u8, 122u8, 107u8, 49u8, 222u8, 87u8, 199u8, + 184u8, 247u8, 153u8, 137u8, 205u8, 153u8, 6u8, 15u8, 246u8, + 8u8, 36u8, 76u8, 54u8, 63u8, + ] + { + let call = ForceRegister { + who, + deposit, + id, + genesis_head, + validation_code, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Deregister a Para Id, freeing all data and returning any deposit."] #[doc = ""] @@ -22740,16 +32800,30 @@ pub mod api { pub fn deregister( &self, id: runtime_types::polkadot_parachain::primitives::Id, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Deregister, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Deregister, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = Deregister { id }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 147u8, 4u8, 172u8, 215u8, 67u8, 142u8, 93u8, 245u8, 108u8, + 83u8, 5u8, 250u8, 87u8, 138u8, 231u8, 10u8, 159u8, 216u8, + 85u8, 233u8, 244u8, 200u8, 37u8, 33u8, 160u8, 143u8, 119u8, + 11u8, 70u8, 177u8, 8u8, 123u8, + ] + { + let call = Deregister { id }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Swap a parachain with another parachain or parathread."] #[doc = ""] @@ -22766,16 +32840,30 @@ pub mod api { &self, id: runtime_types::polkadot_parachain::primitives::Id, other: runtime_types::polkadot_parachain::primitives::Id, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Swap, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Swap, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = Swap { id, other }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 145u8, 163u8, 246u8, 239u8, 241u8, 209u8, 58u8, 241u8, 63u8, + 134u8, 102u8, 55u8, 217u8, 125u8, 176u8, 91u8, 27u8, 32u8, + 220u8, 236u8, 18u8, 20u8, 7u8, 187u8, 100u8, 116u8, 161u8, + 133u8, 127u8, 187u8, 86u8, 109u8, + ] + { + let call = Swap { id, other }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Remove a manager lock from a para. This will allow the manager of a"] #[doc = "previously locked para to deregister or swap a para without using governance."] @@ -22784,16 +32872,30 @@ pub mod api { pub fn force_remove_lock( &self, para: runtime_types::polkadot_parachain::primitives::Id, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ForceRemoveLock, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ForceRemoveLock, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ForceRemoveLock { para }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 205u8, 174u8, 132u8, 188u8, 1u8, 59u8, 82u8, 135u8, 123u8, + 55u8, 144u8, 39u8, 205u8, 171u8, 13u8, 252u8, 65u8, 56u8, + 98u8, 216u8, 23u8, 175u8, 16u8, 200u8, 198u8, 252u8, 133u8, + 238u8, 81u8, 142u8, 254u8, 124u8, + ] + { + let call = ForceRemoveLock { para }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Reserve a Para Id on the relay chain."] #[doc = ""] @@ -22811,16 +32913,30 @@ pub mod api { #[doc = "The `Reserved` event is emitted in case of success, which provides the ID reserved for use."] pub fn reserve( &self, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Reserve, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Reserve, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = Reserve {}; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 22u8, 210u8, 13u8, 54u8, 253u8, 13u8, 89u8, 174u8, 232u8, + 119u8, 148u8, 206u8, 130u8, 133u8, 199u8, 127u8, 201u8, + 205u8, 8u8, 213u8, 108u8, 93u8, 135u8, 88u8, 238u8, 171u8, + 31u8, 193u8, 23u8, 113u8, 106u8, 135u8, + ] + { + let call = Reserve {}; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -22909,25 +33025,47 @@ pub mod api { pub async fn pending_swap( &self, _0: &runtime_types::polkadot_parachain::primitives::Id, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::polkadot_parachain::primitives::Id, >, ::subxt::BasicError, > { - let entry = PendingSwap(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 130u8, 4u8, 116u8, 91u8, 196u8, 41u8, 66u8, 48u8, 17u8, 2u8, + 255u8, 189u8, 132u8, 10u8, 129u8, 102u8, 117u8, 56u8, 114u8, + 231u8, 78u8, 112u8, 11u8, 76u8, 152u8, 41u8, 70u8, 232u8, + 212u8, 71u8, 193u8, 107u8, + ] + { + let entry = PendingSwap(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Pending swap operations."] pub async fn pending_swap_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, PendingSwap<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 130u8, 4u8, 116u8, 91u8, 196u8, 41u8, 66u8, 48u8, 17u8, 2u8, + 255u8, 189u8, 132u8, 10u8, 129u8, 102u8, 117u8, 56u8, 114u8, + 231u8, 78u8, 112u8, 11u8, 76u8, 152u8, 41u8, 70u8, 232u8, + 212u8, 71u8, 193u8, 107u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Amount held on deposit for each para and the original depositor."] #[doc = ""] @@ -22936,7 +33074,7 @@ pub mod api { pub async fn paras( &self, _0: &runtime_types::polkadot_parachain::primitives::Id, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::polkadot_runtime_common::paras_registrar::ParaInfo< @@ -22946,8 +33084,19 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = Paras(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 180u8, 146u8, 122u8, 242u8, 222u8, 203u8, 19u8, 110u8, 22u8, + 53u8, 147u8, 127u8, 165u8, 158u8, 113u8, 196u8, 105u8, 209u8, + 45u8, 250u8, 163u8, 78u8, 120u8, 129u8, 180u8, 128u8, 63u8, + 195u8, 71u8, 176u8, 247u8, 206u8, + ] + { + let entry = Paras(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Amount held on deposit for each para and the original depositor."] #[doc = ""] @@ -22955,23 +33104,48 @@ pub mod api { #[doc = " so if it isn't yet registered. (After that, it's up to governance to do so.)"] pub async fn paras_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Paras<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 180u8, 146u8, 122u8, 242u8, 222u8, 203u8, 19u8, 110u8, 22u8, + 53u8, 147u8, 127u8, 165u8, 158u8, 113u8, 196u8, 105u8, 209u8, + 45u8, 250u8, 163u8, 78u8, 120u8, 129u8, 180u8, 128u8, 63u8, + 195u8, 71u8, 176u8, 247u8, 206u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The next free `ParaId`."] pub async fn next_free_para_id( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< runtime_types::polkadot_parachain::primitives::Id, ::subxt::BasicError, > { - let entry = NextFreeParaId; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 112u8, 52u8, 84u8, 181u8, 132u8, 61u8, 46u8, 69u8, 165u8, + 85u8, 253u8, 243u8, 228u8, 151u8, 15u8, 239u8, 172u8, 28u8, + 102u8, 38u8, 155u8, 90u8, 55u8, 162u8, 254u8, 139u8, 59u8, + 186u8, 152u8, 239u8, 53u8, 216u8, + ] + { + let entry = NextFreeParaId; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -22990,20 +33164,50 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Registrar")?; - let constant = pallet.constant("ParaDeposit")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Registrar", "ParaDeposit")? + == [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, + 200u8, 214u8, 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, + 101u8, 54u8, 210u8, 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, + 15u8, 178u8, 98u8, 148u8, 156u8, + ] + { + let pallet = self.client.metadata().pallet("Registrar")?; + let constant = pallet.constant("ParaDeposit")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The deposit to be paid per byte stored on chain."] pub fn data_deposit_per_byte( &self, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Registrar")?; - let constant = pallet.constant("DataDepositPerByte")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Registrar", "DataDepositPerByte")? + == [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, + 200u8, 214u8, 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, + 101u8, 54u8, 210u8, 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, + 15u8, 178u8, 98u8, 148u8, 156u8, + ] + { + let pallet = self.client.metadata().pallet("Registrar")?; + let constant = pallet.constant("DataDepositPerByte")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -23073,22 +33277,36 @@ pub mod api { amount: ::core::primitive::u128, period_begin: ::core::primitive::u32, period_count: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ForceLease, - DispatchError, - root_mod::Event, - > { - let call = ForceLease { - para, - leaser, - amount, - period_begin, - period_count, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ForceLease, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 110u8, 205u8, 106u8, 226u8, 3u8, 177u8, 198u8, 116u8, 52u8, + 161u8, 90u8, 240u8, 43u8, 160u8, 144u8, 63u8, 97u8, 231u8, + 232u8, 176u8, 92u8, 253u8, 16u8, 243u8, 187u8, 94u8, 20u8, + 114u8, 23u8, 46u8, 231u8, 249u8, + ] + { + let call = ForceLease { + para, + leaser, + amount, + period_begin, + period_count, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Clear all leases for a Para Id, refunding any deposits back to the original owners."] #[doc = ""] @@ -23096,16 +33314,30 @@ pub mod api { pub fn clear_all_leases( &self, para: runtime_types::polkadot_parachain::primitives::Id, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ClearAllLeases, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ClearAllLeases, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ClearAllLeases { para }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 101u8, 225u8, 10u8, 139u8, 34u8, 12u8, 48u8, 76u8, 97u8, + 178u8, 5u8, 110u8, 19u8, 3u8, 237u8, 183u8, 54u8, 113u8, 7u8, + 138u8, 180u8, 201u8, 245u8, 151u8, 61u8, 40u8, 69u8, 31u8, + 28u8, 172u8, 253u8, 227u8, + ] + { + let call = ClearAllLeases { para }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Try to onboard a parachain that has a lease for the current lease period."] #[doc = ""] @@ -23117,16 +33349,30 @@ pub mod api { pub fn trigger_onboard( &self, para: runtime_types::polkadot_parachain::primitives::Id, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - TriggerOnboard, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + TriggerOnboard, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = TriggerOnboard { para }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 85u8, 246u8, 247u8, 252u8, 46u8, 143u8, 200u8, 102u8, 105u8, + 51u8, 148u8, 164u8, 27u8, 25u8, 139u8, 167u8, 150u8, 129u8, + 131u8, 187u8, 153u8, 6u8, 169u8, 153u8, 192u8, 116u8, 130u8, + 12u8, 22u8, 199u8, 52u8, 8u8, + ] + { + let call = TriggerOnboard { para }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -23210,7 +33456,7 @@ pub mod api { pub async fn leases( &self, _0: &runtime_types::polkadot_parachain::primitives::Id, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec< ::core::option::Option<( @@ -23220,8 +33466,22 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = Leases(_0); - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 83u8, 145u8, 119u8, 74u8, 166u8, 90u8, 141u8, 47u8, 125u8, + 250u8, 173u8, 63u8, 193u8, 78u8, 96u8, 119u8, 111u8, 126u8, + 83u8, 83u8, 80u8, 32u8, 43u8, 173u8, 123u8, 126u8, 132u8, + 166u8, 252u8, 39u8, 18u8, 39u8, + ] + { + let entry = Leases(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Amounts held on deposit for each (possibly future) leased parachain."] #[doc = ""] @@ -23241,12 +33501,23 @@ pub mod api { #[doc = " It is illegal for a `None` value to trail in the list."] pub async fn leases_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Leases<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 83u8, 145u8, 119u8, 74u8, 166u8, 90u8, 141u8, 47u8, 125u8, + 250u8, 173u8, 63u8, 193u8, 78u8, 96u8, 119u8, 111u8, 126u8, + 83u8, 83u8, 80u8, 32u8, 43u8, 173u8, 123u8, 126u8, 132u8, + 166u8, 252u8, 39u8, 18u8, 39u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -23264,20 +33535,50 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Slots")?; - let constant = pallet.constant("LeasePeriod")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Slots", "LeasePeriod")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Slots")?; + let constant = pallet.constant("LeasePeriod")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The number of blocks to offset each lease period by."] pub fn lease_offset( &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Slots")?; - let constant = pallet.constant("LeaseOffset")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Slots", "LeaseOffset")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Slots")?; + let constant = pallet.constant("LeaseOffset")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -23351,19 +33652,33 @@ pub mod api { &self, duration: ::core::primitive::u32, lease_period_index: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - NewAuction, - DispatchError, - root_mod::Event, - > { - let call = NewAuction { - duration, - lease_period_index, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + NewAuction, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 12u8, 43u8, 152u8, 0u8, 229u8, 15u8, 32u8, 205u8, 208u8, + 71u8, 57u8, 169u8, 201u8, 177u8, 52u8, 10u8, 93u8, 183u8, + 5u8, 156u8, 231u8, 188u8, 77u8, 238u8, 119u8, 238u8, 87u8, + 251u8, 121u8, 199u8, 18u8, 129u8, + ] + { + let call = NewAuction { + duration, + lease_period_index, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Make a new bid from an account (including a parachain account) for deploying a new"] #[doc = "parachain."] @@ -23388,38 +33703,66 @@ pub mod api { first_slot: ::core::primitive::u32, last_slot: ::core::primitive::u32, amount: ::core::primitive::u128, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Bid, - DispatchError, - root_mod::Event, - > { - let call = Bid { - para, - auction_index, - first_slot, - last_slot, - amount, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Bid, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 206u8, 22u8, 15u8, 251u8, 222u8, 193u8, 192u8, 125u8, 160u8, + 131u8, 209u8, 129u8, 105u8, 46u8, 77u8, 204u8, 107u8, 112u8, + 13u8, 188u8, 193u8, 73u8, 225u8, 232u8, 179u8, 205u8, 39u8, + 69u8, 242u8, 79u8, 36u8, 121u8, + ] + { + let call = Bid { + para, + auction_index, + first_slot, + last_slot, + amount, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Cancel an in-progress auction."] #[doc = ""] #[doc = "Can only be called by Root origin."] pub fn cancel_auction( &self, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - CancelAuction, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + CancelAuction, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = CancelAuction {}; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 182u8, 223u8, 178u8, 136u8, 1u8, 115u8, 229u8, 78u8, 166u8, + 128u8, 28u8, 106u8, 6u8, 248u8, 46u8, 55u8, 110u8, 120u8, + 213u8, 11u8, 90u8, 217u8, 42u8, 120u8, 47u8, 83u8, 126u8, + 216u8, 236u8, 251u8, 255u8, 50u8, + ] + { + let call = CancelAuction {}; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -23573,11 +33916,25 @@ pub mod api { #[doc = " Number of auctions started so far."] pub async fn auction_counter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let entry = AuctionCounter; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 67u8, 247u8, 96u8, 152u8, 0u8, 224u8, 230u8, 98u8, 194u8, + 107u8, 3u8, 203u8, 51u8, 201u8, 149u8, 22u8, 184u8, 80u8, + 251u8, 239u8, 253u8, 19u8, 58u8, 192u8, 65u8, 96u8, 189u8, + 54u8, 175u8, 130u8, 143u8, 181u8, + ] + { + let entry = AuctionCounter; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Information relating to the current auction, if there is one."] #[doc = ""] @@ -23586,7 +33943,7 @@ pub mod api { #[doc = " auction will \"begin to end\", i.e. the first block of the Ending Period of the auction."] pub async fn auction_info( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<( ::core::primitive::u32, @@ -23594,8 +33951,19 @@ pub mod api { )>, ::subxt::BasicError, > { - let entry = AuctionInfo; - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 73u8, 216u8, 173u8, 230u8, 132u8, 78u8, 83u8, 62u8, 200u8, + 69u8, 17u8, 73u8, 57u8, 107u8, 160u8, 90u8, 147u8, 84u8, + 29u8, 110u8, 144u8, 215u8, 169u8, 110u8, 217u8, 77u8, 109u8, + 204u8, 1u8, 164u8, 95u8, 83u8, + ] + { + let entry = AuctionInfo; + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Amounts currently reserved in the accounts of the bidders currently winning"] #[doc = " (sub-)ranges."] @@ -23603,24 +33971,46 @@ pub mod api { &self, _0: &::subxt::sp_core::crypto::AccountId32, _1: &runtime_types::polkadot_parachain::primitives::Id, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<::core::primitive::u128>, ::subxt::BasicError, > { - let entry = ReservedAmounts(_0, _1); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 195u8, 56u8, 142u8, 154u8, 193u8, 115u8, 13u8, 64u8, 101u8, + 179u8, 69u8, 175u8, 185u8, 12u8, 31u8, 65u8, 147u8, 211u8, + 74u8, 40u8, 190u8, 254u8, 190u8, 176u8, 117u8, 159u8, 234u8, + 214u8, 157u8, 83u8, 56u8, 192u8, + ] + { + let entry = ReservedAmounts(_0, _1); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Amounts currently reserved in the accounts of the bidders currently winning"] #[doc = " (sub-)ranges."] pub async fn reserved_amounts_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, ReservedAmounts<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 195u8, 56u8, 142u8, 154u8, 193u8, 115u8, 13u8, 64u8, 101u8, + 179u8, 69u8, 175u8, 185u8, 12u8, 31u8, 65u8, 147u8, 211u8, + 74u8, 40u8, 190u8, 254u8, 190u8, 176u8, 117u8, 159u8, 234u8, + 214u8, 157u8, 83u8, 56u8, 192u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The winning bids for each of the 10 ranges at each sample in the final Ending Period of"] #[doc = " the current auction. The map's key is the 0-based index into the Sample Size. The"] @@ -23628,7 +34018,7 @@ pub mod api { pub async fn winning( &self, _0: &::core::primitive::u32, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< [::core::option::Option<( @@ -23639,20 +34029,42 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = Winning(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 152u8, 246u8, 158u8, 193u8, 21u8, 56u8, 204u8, 29u8, 146u8, + 90u8, 133u8, 246u8, 75u8, 111u8, 157u8, 150u8, 175u8, 33u8, + 127u8, 215u8, 158u8, 55u8, 231u8, 78u8, 143u8, 128u8, 92u8, + 70u8, 61u8, 23u8, 43u8, 68u8, + ] + { + let entry = Winning(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The winning bids for each of the 10 ranges at each sample in the final Ending Period of"] #[doc = " the current auction. The map's key is the 0-based index into the Sample Size. The"] #[doc = " first sample of the ending period is 0; the last is `Sample Size - 1`."] pub async fn winning_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Winning<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 152u8, 246u8, 158u8, 193u8, 21u8, 56u8, 204u8, 29u8, 146u8, + 90u8, 133u8, 246u8, 75u8, 111u8, 157u8, 150u8, 175u8, 33u8, + 127u8, 215u8, 158u8, 55u8, 231u8, 78u8, 143u8, 128u8, 92u8, + 70u8, 61u8, 23u8, 43u8, 68u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -23670,10 +34082,25 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Auctions")?; - let constant = pallet.constant("EndingPeriod")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Auctions", "EndingPeriod")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Auctions")?; + let constant = pallet.constant("EndingPeriod")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The length of each sample to take during the ending period."] #[doc = ""] @@ -23682,28 +34109,73 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Auctions")?; - let constant = pallet.constant("SampleLength")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Auctions", "SampleLength")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Auctions")?; + let constant = pallet.constant("SampleLength")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } pub fn slot_range_count( &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Auctions")?; - let constant = pallet.constant("SlotRangeCount")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Auctions", "SlotRangeCount")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Auctions")?; + let constant = pallet.constant("SlotRangeCount")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } pub fn lease_periods_per_slot( &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Auctions")?; - let constant = pallet.constant("LeasePeriodsPerSlot")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Auctions", "LeasePeriodsPerSlot")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Auctions")?; + let constant = pallet.constant("LeasePeriodsPerSlot")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -23855,23 +34327,37 @@ pub mod api { verifier: ::core::option::Option< runtime_types::sp_runtime::MultiSigner, >, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Create, - DispatchError, - root_mod::Event, - > { - let call = Create { - index, - cap, - first_period, - last_period, - end, - verifier, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Create, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 94u8, 115u8, 154u8, 239u8, 215u8, 180u8, 175u8, 240u8, 137u8, + 240u8, 74u8, 159u8, 67u8, 54u8, 69u8, 199u8, 161u8, 155u8, + 243u8, 222u8, 205u8, 163u8, 142u8, 251u8, 156u8, 94u8, 65u8, + 153u8, 39u8, 226u8, 79u8, 195u8, + ] + { + let call = Create { + index, + cap, + first_period, + last_period, + end, + verifier, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Contribute to a crowd sale. This will transfer some balance over to fund a parachain"] #[doc = "slot. It will be withdrawable when the crowdloan has ended and the funds are unused."] @@ -23882,20 +34368,34 @@ pub mod api { signature: ::core::option::Option< runtime_types::sp_runtime::MultiSignature, >, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Contribute, - DispatchError, - root_mod::Event, - > { - let call = Contribute { - index, - value, - signature, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Contribute, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 95u8, 255u8, 35u8, 30u8, 44u8, 150u8, 10u8, 166u8, 0u8, + 204u8, 106u8, 59u8, 150u8, 254u8, 216u8, 128u8, 232u8, 129u8, + 30u8, 101u8, 196u8, 198u8, 180u8, 156u8, 122u8, 252u8, 139u8, + 28u8, 164u8, 115u8, 153u8, 109u8, + ] + { + let call = Contribute { + index, + value, + signature, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Withdraw full balance of a specific contributor."] #[doc = ""] @@ -23918,16 +34418,30 @@ pub mod api { &self, who: ::subxt::sp_core::crypto::AccountId32, index: runtime_types::polkadot_parachain::primitives::Id, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Withdraw, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Withdraw, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = Withdraw { who, index }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 67u8, 65u8, 89u8, 108u8, 193u8, 99u8, 74u8, 32u8, 163u8, + 13u8, 81u8, 131u8, 64u8, 107u8, 72u8, 23u8, 35u8, 177u8, + 130u8, 171u8, 70u8, 232u8, 246u8, 254u8, 67u8, 219u8, 84u8, + 96u8, 165u8, 20u8, 183u8, 209u8, + ] + { + let call = Withdraw { who, index }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Automatically refund contributors of an ended crowdloan."] #[doc = "Due to weight restrictions, this function may need to be called multiple"] @@ -23937,31 +34451,59 @@ pub mod api { pub fn refund( &self, index: runtime_types::polkadot_parachain::primitives::Id, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Refund, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Refund, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = Refund { index }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 202u8, 206u8, 79u8, 226u8, 114u8, 228u8, 110u8, 18u8, 178u8, + 173u8, 23u8, 83u8, 64u8, 11u8, 201u8, 19u8, 57u8, 75u8, + 181u8, 241u8, 231u8, 189u8, 211u8, 48u8, 82u8, 64u8, 220u8, + 22u8, 247u8, 7u8, 68u8, 211u8, + ] + { + let call = Refund { index }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Remove a fund after the retirement period has ended and all funds have been returned."] pub fn dissolve( &self, index: runtime_types::polkadot_parachain::primitives::Id, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Dissolve, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Dissolve, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = Dissolve { index }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 210u8, 3u8, 221u8, 185u8, 64u8, 178u8, 56u8, 132u8, 72u8, + 127u8, 105u8, 31u8, 167u8, 107u8, 127u8, 224u8, 174u8, 221u8, + 111u8, 105u8, 47u8, 247u8, 10u8, 5u8, 37u8, 180u8, 61u8, + 180u8, 3u8, 164u8, 196u8, 194u8, + ] + { + let call = Dissolve { index }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Edit the configuration for an in-progress crowdloan."] #[doc = ""] @@ -23976,23 +34518,37 @@ pub mod api { verifier: ::core::option::Option< runtime_types::sp_runtime::MultiSigner, >, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Edit, - DispatchError, - root_mod::Event, - > { - let call = Edit { - index, - cap, - first_period, - last_period, - end, - verifier, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Edit, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 34u8, 43u8, 47u8, 39u8, 106u8, 245u8, 49u8, 40u8, 191u8, + 195u8, 202u8, 113u8, 137u8, 98u8, 143u8, 172u8, 191u8, 55u8, + 240u8, 75u8, 234u8, 180u8, 90u8, 206u8, 93u8, 214u8, 115u8, + 215u8, 140u8, 144u8, 105u8, 89u8, + ] + { + let call = Edit { + index, + cap, + first_period, + last_period, + end, + verifier, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Add an optional memo to an existing crowdloan contribution."] #[doc = ""] @@ -24001,16 +34557,30 @@ pub mod api { &self, index: runtime_types::polkadot_parachain::primitives::Id, memo: ::std::vec::Vec<::core::primitive::u8>, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - AddMemo, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + AddMemo, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = AddMemo { index, memo }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 97u8, 218u8, 115u8, 187u8, 167u8, 70u8, 229u8, 231u8, 148u8, + 77u8, 169u8, 139u8, 16u8, 15u8, 116u8, 128u8, 32u8, 59u8, + 154u8, 146u8, 12u8, 65u8, 36u8, 36u8, 69u8, 19u8, 74u8, 79u8, + 66u8, 25u8, 215u8, 57u8, + ] + { + let call = AddMemo { index, memo }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Poke the fund into `NewRaise`"] #[doc = ""] @@ -24018,16 +34588,30 @@ pub mod api { pub fn poke( &self, index: runtime_types::polkadot_parachain::primitives::Id, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Poke, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Poke, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = Poke { index }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 99u8, 158u8, 48u8, 3u8, 228u8, 210u8, 249u8, 42u8, 44u8, + 49u8, 24u8, 212u8, 69u8, 69u8, 189u8, 194u8, 124u8, 251u8, + 25u8, 123u8, 234u8, 3u8, 184u8, 227u8, 1u8, 195u8, 219u8, + 118u8, 235u8, 237u8, 11u8, 159u8, + ] + { + let call = Poke { index }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Contribute your entire balance to a crowd sale. This will transfer the entire balance of a user over to fund a parachain"] #[doc = "slot. It will be withdrawable when the crowdloan has ended and the funds are unused."] @@ -24037,16 +34621,30 @@ pub mod api { signature: ::core::option::Option< runtime_types::sp_runtime::MultiSignature, >, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ContributeAll, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ContributeAll, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ContributeAll { index, signature }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self.client.metadata().call_hash::()? + == [ + 64u8, 224u8, 233u8, 196u8, 182u8, 109u8, 69u8, 220u8, 46u8, + 60u8, 189u8, 125u8, 17u8, 28u8, 207u8, 63u8, 129u8, 56u8, + 32u8, 239u8, 182u8, 214u8, 237u8, 95u8, 228u8, 171u8, 209u8, + 233u8, 205u8, 212u8, 147u8, 176u8, + ] + { + let call = ContributeAll { index, signature }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -24204,7 +34802,7 @@ pub mod api { pub async fn funds( &self, _0: &runtime_types::polkadot_parachain::primitives::Id, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::polkadot_runtime_common::crowdloan::FundInfo< @@ -24216,48 +34814,112 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = Funds(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 13u8, 211u8, 240u8, 138u8, 231u8, 78u8, 123u8, 252u8, 210u8, + 27u8, 202u8, 82u8, 157u8, 118u8, 209u8, 218u8, 160u8, 183u8, + 225u8, 77u8, 230u8, 131u8, 180u8, 238u8, 83u8, 202u8, 29u8, + 106u8, 114u8, 223u8, 250u8, 3u8, + ] + { + let entry = Funds(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Info on all of the funds."] pub async fn funds_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Funds<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 13u8, 211u8, 240u8, 138u8, 231u8, 78u8, 123u8, 252u8, 210u8, + 27u8, 202u8, 82u8, 157u8, 118u8, 209u8, 218u8, 160u8, 183u8, + 225u8, 77u8, 230u8, 131u8, 180u8, 238u8, 83u8, 202u8, 29u8, + 106u8, 114u8, 223u8, 250u8, 3u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The funds that have had additional contributions during the last block. This is used"] #[doc = " in order to determine which funds should submit new or updated bids."] pub async fn new_raise( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::std::vec::Vec, ::subxt::BasicError, > { - let entry = NewRaise; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 243u8, 204u8, 121u8, 230u8, 151u8, 223u8, 248u8, 199u8, 68u8, + 209u8, 226u8, 159u8, 217u8, 105u8, 39u8, 127u8, 162u8, 133u8, + 56u8, 1u8, 70u8, 7u8, 176u8, 56u8, 81u8, 49u8, 155u8, 143u8, + 100u8, 153u8, 59u8, 86u8, + ] + { + let entry = NewRaise; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The number of auctions that have entered into their ending period so far."] pub async fn endings_count( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let entry = EndingsCount; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 12u8, 159u8, 166u8, 75u8, 192u8, 33u8, 21u8, 244u8, 149u8, + 200u8, 49u8, 54u8, 191u8, 174u8, 202u8, 86u8, 76u8, 115u8, + 189u8, 35u8, 192u8, 175u8, 156u8, 188u8, 41u8, 23u8, 92u8, + 36u8, 141u8, 235u8, 248u8, 143u8, + ] + { + let entry = EndingsCount; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Tracker for the next available fund index"] pub async fn next_fund_index( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let entry = NextFundIndex; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 1u8, 215u8, 164u8, 194u8, 231u8, 34u8, 207u8, 19u8, 149u8, + 187u8, 3u8, 176u8, 194u8, 240u8, 180u8, 169u8, 214u8, 194u8, + 202u8, 240u8, 209u8, 6u8, 244u8, 46u8, 54u8, 142u8, 61u8, + 220u8, 240u8, 96u8, 10u8, 168u8, + ] + { + let entry = NextFundIndex; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -24277,10 +34939,25 @@ pub mod api { runtime_types::frame_support::PalletId, ::subxt::BasicError, > { - let pallet = self.client.metadata().pallet("Crowdloan")?; - let constant = pallet.constant("PalletId")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Crowdloan", "PalletId")? + == [ + 11u8, 72u8, 189u8, 18u8, 254u8, 229u8, 67u8, 29u8, 4u8, + 241u8, 192u8, 5u8, 210u8, 194u8, 124u8, 31u8, 19u8, 174u8, + 240u8, 245u8, 169u8, 141u8, 67u8, 251u8, 106u8, 103u8, 15u8, + 167u8, 107u8, 31u8, 121u8, 239u8, + ] + { + let pallet = self.client.metadata().pallet("Crowdloan")?; + let constant = pallet.constant("PalletId")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The minimum amount that may be contributed into a crowdloan. Should almost certainly be at"] #[doc = " least `ExistentialDeposit`."] @@ -24288,20 +34965,50 @@ pub mod api { &self, ) -> ::core::result::Result<::core::primitive::u128, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Crowdloan")?; - let constant = pallet.constant("MinContribution")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Crowdloan", "MinContribution")? + == [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, + 200u8, 214u8, 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, + 101u8, 54u8, 210u8, 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, + 15u8, 178u8, 98u8, 148u8, 156u8, + ] + { + let pallet = self.client.metadata().pallet("Crowdloan")?; + let constant = pallet.constant("MinContribution")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Max number of storage keys to remove per extrinsic call."] pub fn remove_keys_limit( &self, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let pallet = self.client.metadata().pallet("Crowdloan")?; - let constant = pallet.constant("RemoveKeysLimit")?; - let value = ::subxt::codec::Decode::decode(&mut &constant.value[..])?; - Ok(value) + if self + .client + .metadata() + .constant_hash("Crowdloan", "RemoveKeysLimit")? + == [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, + 157u8, 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, + 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, + 90u8, 203u8, 100u8, 41u8, 145u8, + ] + { + let pallet = self.client.metadata().pallet("Crowdloan")?; + let constant = pallet.constant("RemoveKeysLimit")?; + let value = + ::subxt::codec::Decode::decode(&mut &constant.value[..])?; + Ok(value) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -24441,19 +35148,33 @@ pub mod api { &self, dest: runtime_types::xcm::VersionedMultiLocation, message: runtime_types::xcm::VersionedXcm, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Send, - DispatchError, - root_mod::Event, - > { - let call = Send { - dest: ::std::boxed::Box::new(dest), - message: ::std::boxed::Box::new(message), - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Send, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 232u8, 188u8, 205u8, 27u8, 92u8, 141u8, 251u8, 24u8, 90u8, + 155u8, 20u8, 139u8, 7u8, 160u8, 39u8, 85u8, 205u8, 11u8, + 111u8, 1u8, 250u8, 168u8, 134u8, 61u8, 19u8, 216u8, 239u8, + 127u8, 137u8, 136u8, 48u8, 19u8, + ] + { + let call = Send { + dest: ::std::boxed::Box::new(dest), + message: ::std::boxed::Box::new(message), + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Teleport some assets from the local chain to some destination chain."] #[doc = ""] @@ -24476,21 +35197,35 @@ pub mod api { beneficiary: runtime_types::xcm::VersionedMultiLocation, assets: runtime_types::xcm::VersionedMultiAssets, fee_asset_item: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - TeleportAssets, - DispatchError, - root_mod::Event, - > { - let call = TeleportAssets { - dest: ::std::boxed::Box::new(dest), - beneficiary: ::std::boxed::Box::new(beneficiary), - assets: ::std::boxed::Box::new(assets), - fee_asset_item, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + TeleportAssets, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 55u8, 192u8, 217u8, 186u8, 230u8, 234u8, 26u8, 194u8, 243u8, + 199u8, 16u8, 227u8, 225u8, 88u8, 130u8, 219u8, 228u8, 110u8, + 20u8, 255u8, 233u8, 147u8, 121u8, 173u8, 126u8, 248u8, 192u8, + 243u8, 211u8, 91u8, 115u8, 148u8, + ] + { + let call = TeleportAssets { + dest: ::std::boxed::Box::new(dest), + beneficiary: ::std::boxed::Box::new(beneficiary), + assets: ::std::boxed::Box::new(assets), + fee_asset_item, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Transfer some assets from the local chain to the sovereign account of a destination"] #[doc = "chain and forward a notification XCM."] @@ -24514,21 +35249,38 @@ pub mod api { beneficiary: runtime_types::xcm::VersionedMultiLocation, assets: runtime_types::xcm::VersionedMultiAssets, fee_asset_item: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ReserveTransferAssets, - DispatchError, - root_mod::Event, - > { - let call = ReserveTransferAssets { - dest: ::std::boxed::Box::new(dest), - beneficiary: ::std::boxed::Box::new(beneficiary), - assets: ::std::boxed::Box::new(assets), - fee_asset_item, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ReserveTransferAssets, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self + .client + .metadata() + .call_hash::()? + == [ + 134u8, 229u8, 104u8, 209u8, 160u8, 7u8, 99u8, 175u8, 128u8, + 110u8, 189u8, 225u8, 141u8, 1u8, 10u8, 17u8, 247u8, 233u8, + 146u8, 19u8, 31u8, 145u8, 217u8, 144u8, 85u8, 223u8, 197u8, + 249u8, 1u8, 222u8, 98u8, 13u8, + ] + { + let call = ReserveTransferAssets { + dest: ::std::boxed::Box::new(dest), + beneficiary: ::std::boxed::Box::new(beneficiary), + assets: ::std::boxed::Box::new(assets), + fee_asset_item, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Execute an XCM message from a local, signed, origin."] #[doc = ""] @@ -24545,19 +35297,33 @@ pub mod api { &self, message: runtime_types::xcm::VersionedXcm, max_weight: ::core::primitive::u64, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - Execute, - DispatchError, - root_mod::Event, - > { - let call = Execute { - message: ::std::boxed::Box::new(message), - max_weight, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + Execute, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 95u8, 48u8, 201u8, 232u8, 83u8, 23u8, 20u8, 126u8, 116u8, + 116u8, 176u8, 206u8, 145u8, 9u8, 155u8, 109u8, 141u8, 226u8, + 253u8, 196u8, 37u8, 230u8, 243u8, 68u8, 39u8, 133u8, 233u8, + 108u8, 226u8, 87u8, 5u8, 247u8, + ] + { + let call = Execute { + message: ::std::boxed::Box::new(message), + max_weight, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Extoll that a particular destination can be communicated with through a particular"] #[doc = "version of XCM."] @@ -24569,19 +35335,33 @@ pub mod api { &self, location: runtime_types::xcm::v1::multilocation::MultiLocation, xcm_version: ::core::primitive::u32, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ForceXcmVersion, - DispatchError, - root_mod::Event, - > { - let call = ForceXcmVersion { - location: ::std::boxed::Box::new(location), - xcm_version, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ForceXcmVersion, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self.client.metadata().call_hash::()? + == [ + 32u8, 219u8, 213u8, 152u8, 203u8, 73u8, 121u8, 64u8, 78u8, + 53u8, 110u8, 23u8, 87u8, 93u8, 34u8, 166u8, 205u8, 189u8, + 25u8, 160u8, 172u8, 178u8, 125u8, 182u8, 37u8, 254u8, 220u8, + 179u8, 70u8, 252u8, 63u8, 94u8, + ] + { + let call = ForceXcmVersion { + location: ::std::boxed::Box::new(location), + xcm_version, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Set a safe XCM version (the version that XCM should be encoded with if the most recent"] #[doc = "version a destination can accept is unknown)."] @@ -24591,16 +35371,33 @@ pub mod api { pub fn force_default_xcm_version( &self, maybe_xcm_version: ::core::option::Option<::core::primitive::u32>, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ForceDefaultXcmVersion, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ForceDefaultXcmVersion, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = ForceDefaultXcmVersion { maybe_xcm_version }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 44u8, 161u8, 28u8, 189u8, 162u8, 221u8, 14u8, 31u8, 8u8, + 211u8, 181u8, 51u8, 197u8, 14u8, 87u8, 198u8, 3u8, 240u8, + 90u8, 78u8, 141u8, 131u8, 205u8, 250u8, 211u8, 150u8, 237u8, + 160u8, 239u8, 226u8, 233u8, 29u8, + ] + { + let call = ForceDefaultXcmVersion { maybe_xcm_version }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Ask a location to notify us regarding their XCM version and any changes to it."] #[doc = ""] @@ -24609,18 +35406,35 @@ pub mod api { pub fn force_subscribe_version_notify( &self, location: runtime_types::xcm::VersionedMultiLocation, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ForceSubscribeVersionNotify, - DispatchError, - root_mod::Event, - > { - let call = ForceSubscribeVersionNotify { - location: ::std::boxed::Box::new(location), - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ForceSubscribeVersionNotify, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self + .client + .metadata() + .call_hash::()? + == [ + 41u8, 248u8, 187u8, 195u8, 146u8, 143u8, 0u8, 246u8, 248u8, + 38u8, 128u8, 200u8, 143u8, 149u8, 127u8, 73u8, 3u8, 247u8, + 106u8, 6u8, 56u8, 50u8, 207u8, 234u8, 137u8, 201u8, 16u8, + 21u8, 226u8, 148u8, 181u8, 44u8, + ] + { + let call = ForceSubscribeVersionNotify { + location: ::std::boxed::Box::new(location), + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Require that a particular destination should no longer notify us regarding any XCM"] #[doc = "version changes."] @@ -24631,18 +35445,35 @@ pub mod api { pub fn force_unsubscribe_version_notify( &self, location: runtime_types::xcm::VersionedMultiLocation, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - ForceUnsubscribeVersionNotify, - DispatchError, - root_mod::Event, - > { - let call = ForceUnsubscribeVersionNotify { - location: ::std::boxed::Box::new(location), - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + ForceUnsubscribeVersionNotify, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self + .client + .metadata() + .call_hash::()? + == [ + 150u8, 202u8, 148u8, 13u8, 187u8, 169u8, 5u8, 60u8, 25u8, + 144u8, 43u8, 196u8, 35u8, 215u8, 184u8, 72u8, 143u8, 220u8, + 176u8, 27u8, 100u8, 245u8, 31u8, 243u8, 0u8, 83u8, 165u8, + 7u8, 102u8, 172u8, 218u8, 133u8, + ] + { + let call = ForceUnsubscribeVersionNotify { + location: ::std::boxed::Box::new(location), + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Transfer some assets from the local chain to the sovereign account of a destination"] #[doc = "chain and forward a notification XCM."] @@ -24669,22 +35500,39 @@ pub mod api { assets: runtime_types::xcm::VersionedMultiAssets, fee_asset_item: ::core::primitive::u32, weight_limit: runtime_types::xcm::v2::WeightLimit, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - LimitedReserveTransferAssets, - DispatchError, - root_mod::Event, - > { - let call = LimitedReserveTransferAssets { - dest: ::std::boxed::Box::new(dest), - beneficiary: ::std::boxed::Box::new(beneficiary), - assets: ::std::boxed::Box::new(assets), - fee_asset_item, - weight_limit, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + LimitedReserveTransferAssets, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, + > { + if self + .client + .metadata() + .call_hash::()? + == [ + 242u8, 206u8, 126u8, 164u8, 44u8, 116u8, 181u8, 90u8, 121u8, + 124u8, 120u8, 240u8, 129u8, 217u8, 131u8, 100u8, 248u8, + 149u8, 56u8, 154u8, 35u8, 91u8, 210u8, 118u8, 207u8, 110u8, + 42u8, 249u8, 160u8, 155u8, 251u8, 68u8, + ] + { + let call = LimitedReserveTransferAssets { + dest: ::std::boxed::Box::new(dest), + beneficiary: ::std::boxed::Box::new(beneficiary), + assets: ::std::boxed::Box::new(assets), + fee_asset_item, + weight_limit, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = "Teleport some assets from the local chain to some destination chain."] #[doc = ""] @@ -24710,22 +35558,39 @@ pub mod api { assets: runtime_types::xcm::VersionedMultiAssets, fee_asset_item: ::core::primitive::u32, weight_limit: runtime_types::xcm::v2::WeightLimit, - ) -> ::subxt::SubmittableExtrinsic< - 'a, - T, - X, - LimitedTeleportAssets, - DispatchError, - root_mod::Event, + ) -> Result< + ::subxt::SubmittableExtrinsic< + 'a, + T, + X, + LimitedTeleportAssets, + DispatchError, + root_mod::Event, + >, + ::subxt::BasicError, > { - let call = LimitedTeleportAssets { - dest: ::std::boxed::Box::new(dest), - beneficiary: ::std::boxed::Box::new(beneficiary), - assets: ::std::boxed::Box::new(assets), - fee_asset_item, - weight_limit, - }; - ::subxt::SubmittableExtrinsic::new(self.client, call) + if self + .client + .metadata() + .call_hash::()? + == [ + 189u8, 233u8, 43u8, 16u8, 158u8, 114u8, 154u8, 233u8, 179u8, + 144u8, 81u8, 179u8, 169u8, 38u8, 4u8, 130u8, 95u8, 237u8, + 172u8, 167u8, 2u8, 169u8, 53u8, 252u8, 159u8, 42u8, 143u8, + 216u8, 112u8, 155u8, 48u8, 129u8, + ] + { + let call = LimitedTeleportAssets { + dest: ::std::boxed::Box::new(dest), + beneficiary: ::std::boxed::Box::new(beneficiary), + assets: ::std::boxed::Box::new(assets), + fee_asset_item, + weight_limit, + }; + Ok(::subxt::SubmittableExtrinsic::new(self.client, call)) + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -25101,17 +35966,31 @@ pub mod api { #[doc = " The latest available query index."] pub async fn query_counter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u64, ::subxt::BasicError> { - let entry = QueryCounter; - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 137u8, 58u8, 184u8, 88u8, 247u8, 22u8, 151u8, 64u8, 50u8, + 77u8, 49u8, 10u8, 234u8, 84u8, 213u8, 156u8, 26u8, 200u8, + 214u8, 225u8, 125u8, 231u8, 42u8, 93u8, 159u8, 168u8, 86u8, + 201u8, 116u8, 153u8, 41u8, 127u8, + ] + { + let entry = QueryCounter; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The ongoing queries."] pub async fn queries( &self, _0: &::core::primitive::u64, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::pallet_xcm::pallet::QueryStatus< @@ -25120,18 +35999,40 @@ pub mod api { >, ::subxt::BasicError, > { - let entry = Queries(_0); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 47u8, 241u8, 126u8, 71u8, 203u8, 121u8, 171u8, 226u8, 89u8, + 17u8, 61u8, 198u8, 123u8, 73u8, 20u8, 197u8, 6u8, 23u8, 34u8, + 127u8, 89u8, 35u8, 49u8, 101u8, 110u8, 15u8, 206u8, 203u8, + 155u8, 93u8, 0u8, 97u8, + ] + { + let entry = Queries(_0); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The ongoing queries."] pub async fn queries_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, Queries<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 47u8, 241u8, 126u8, 71u8, 203u8, 121u8, 171u8, 226u8, 89u8, + 17u8, 61u8, 198u8, 123u8, 73u8, 20u8, 197u8, 6u8, 23u8, 34u8, + 127u8, 89u8, 35u8, 49u8, 101u8, 110u8, 15u8, 206u8, 203u8, + 155u8, 93u8, 0u8, 97u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The existing asset traps."] #[doc = ""] @@ -25140,11 +36041,25 @@ pub mod api { pub async fn asset_traps( &self, _0: &::subxt::sp_core::H256, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result<::core::primitive::u32, ::subxt::BasicError> { - let entry = AssetTraps(_0); - self.client.storage().fetch_or_default(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 46u8, 170u8, 126u8, 101u8, 101u8, 243u8, 31u8, 53u8, 166u8, + 45u8, 90u8, 63u8, 2u8, 87u8, 36u8, 221u8, 101u8, 190u8, 51u8, + 103u8, 66u8, 193u8, 76u8, 224u8, 74u8, 160u8, 120u8, 212u8, + 45u8, 230u8, 57u8, 122u8, + ] + { + let entry = AssetTraps(_0); + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The existing asset traps."] #[doc = ""] @@ -25152,70 +36067,136 @@ pub mod api { #[doc = " times this pair has been trapped (usually just 1 if it exists at all)."] pub async fn asset_traps_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, AssetTraps<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 46u8, 170u8, 126u8, 101u8, 101u8, 243u8, 31u8, 53u8, 166u8, + 45u8, 90u8, 63u8, 2u8, 87u8, 36u8, 221u8, 101u8, 190u8, 51u8, + 103u8, 66u8, 193u8, 76u8, 224u8, 74u8, 160u8, 120u8, 212u8, + 45u8, 230u8, 57u8, 122u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Default version to encode XCM when latest version of destination is unknown. If `None`,"] #[doc = " then the destinations whose XCM version is unknown are considered unreachable."] pub async fn safe_xcm_version( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<::core::primitive::u32>, ::subxt::BasicError, > { - let entry = SafeXcmVersion; - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 1u8, 223u8, 218u8, 204u8, 222u8, 129u8, 137u8, 237u8, 197u8, + 142u8, 233u8, 66u8, 229u8, 153u8, 138u8, 222u8, 113u8, 164u8, + 135u8, 213u8, 233u8, 34u8, 24u8, 23u8, 215u8, 59u8, 40u8, + 188u8, 45u8, 244u8, 205u8, 199u8, + ] + { + let entry = SafeXcmVersion; + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The Latest versions that we know various locations support."] pub async fn supported_version( &self, _0: &::core::primitive::u32, _1: &runtime_types::xcm::VersionedMultiLocation, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<::core::primitive::u32>, ::subxt::BasicError, > { - let entry = SupportedVersion(_0, _1); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 231u8, 202u8, 129u8, 82u8, 121u8, 63u8, 67u8, 57u8, 191u8, + 190u8, 25u8, 27u8, 219u8, 42u8, 180u8, 142u8, 71u8, 119u8, + 212u8, 211u8, 21u8, 11u8, 8u8, 7u8, 9u8, 243u8, 11u8, 117u8, + 66u8, 47u8, 246u8, 85u8, + ] + { + let entry = SupportedVersion(_0, _1); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The Latest versions that we know various locations support."] pub async fn supported_version_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, SupportedVersion<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 231u8, 202u8, 129u8, 82u8, 121u8, 63u8, 67u8, 57u8, 191u8, + 190u8, 25u8, 27u8, 219u8, 42u8, 180u8, 142u8, 71u8, 119u8, + 212u8, 211u8, 21u8, 11u8, 8u8, 7u8, 9u8, 243u8, 11u8, 117u8, + 66u8, 47u8, 246u8, 85u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " All locations that we have requested version notifications from."] pub async fn version_notifiers( &self, _0: &::core::primitive::u32, _1: &runtime_types::xcm::VersionedMultiLocation, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<::core::primitive::u64>, ::subxt::BasicError, > { - let entry = VersionNotifiers(_0, _1); - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 126u8, 49u8, 13u8, 135u8, 137u8, 68u8, 248u8, 211u8, 160u8, + 160u8, 93u8, 128u8, 157u8, 230u8, 62u8, 119u8, 191u8, 51u8, + 147u8, 149u8, 60u8, 227u8, 154u8, 97u8, 244u8, 249u8, 0u8, + 220u8, 189u8, 92u8, 178u8, 149u8, + ] + { + let entry = VersionNotifiers(_0, _1); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " All locations that we have requested version notifications from."] pub async fn version_notifiers_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, VersionNotifiers<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self.client.metadata().storage_hash::()? + == [ + 126u8, 49u8, 13u8, 135u8, 137u8, 68u8, 248u8, 211u8, 160u8, + 160u8, 93u8, 128u8, 157u8, 230u8, 62u8, 119u8, 191u8, 51u8, + 147u8, 149u8, 60u8, 227u8, 154u8, 97u8, 244u8, 249u8, 0u8, + 220u8, 189u8, 92u8, 178u8, 149u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The target locations that are subscribed to our version changes, as well as the most recent"] #[doc = " of our versions we informed them of."] @@ -25223,7 +36204,7 @@ pub mod api { &self, _0: &::core::primitive::u32, _1: &runtime_types::xcm::VersionedMultiLocation, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option<( ::core::primitive::u64, @@ -25232,26 +36213,54 @@ pub mod api { )>, ::subxt::BasicError, > { - let entry = VersionNotifyTargets(_0, _1); - self.client.storage().fetch(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 251u8, 128u8, 243u8, 94u8, 162u8, 11u8, 206u8, 101u8, 33u8, + 24u8, 163u8, 157u8, 112u8, 50u8, 91u8, 155u8, 241u8, 73u8, + 77u8, 185u8, 231u8, 3u8, 220u8, 161u8, 36u8, 208u8, 116u8, + 183u8, 80u8, 38u8, 56u8, 104u8, + ] + { + let entry = VersionNotifyTargets(_0, _1); + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The target locations that are subscribed to our version changes, as well as the most recent"] #[doc = " of our versions we informed them of."] pub async fn version_notify_targets_iter( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::subxt::KeyIter<'a, T, VersionNotifyTargets<'a>>, ::subxt::BasicError, > { - self.client.storage().iter(hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 251u8, 128u8, 243u8, 94u8, 162u8, 11u8, 206u8, 101u8, 33u8, + 24u8, 163u8, 157u8, 112u8, 50u8, 91u8, 155u8, 241u8, 73u8, + 77u8, 185u8, 231u8, 3u8, 220u8, 161u8, 36u8, 208u8, 116u8, + 183u8, 80u8, 38u8, 56u8, 104u8, + ] + { + self.client.storage().iter(block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " Destinations whose latest XCM version we would like to know. Duplicates not allowed, and"] #[doc = " the `u32` counter is the number of times that a send to the destination has been attempted,"] #[doc = " which is used as a prioritization."] pub async fn version_discovery_queue( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< runtime_types::frame_support::storage::bounded_vec::BoundedVec<( runtime_types::xcm::VersionedMultiLocation, @@ -25259,21 +36268,49 @@ pub mod api { )>, ::subxt::BasicError, > { - let entry = VersionDiscoveryQueue; - self.client.storage().fetch_or_default(&entry, hash).await + if self + .client + .metadata() + .storage_hash::()? + == [ + 45u8, 28u8, 29u8, 233u8, 239u8, 65u8, 24u8, 214u8, 153u8, + 189u8, 132u8, 235u8, 62u8, 197u8, 252u8, 56u8, 38u8, 97u8, + 13u8, 16u8, 149u8, 25u8, 252u8, 181u8, 206u8, 54u8, 250u8, + 133u8, 133u8, 74u8, 186u8, 22u8, + ] + { + let entry = VersionDiscoveryQueue; + self.client + .storage() + .fetch_or_default(&entry, block_hash) + .await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } #[doc = " The current migration's stage, if any."] pub async fn current_migration( &self, - hash: ::core::option::Option, + block_hash: ::core::option::Option, ) -> ::core::result::Result< ::core::option::Option< runtime_types::pallet_xcm::pallet::VersionMigrationStage, >, ::subxt::BasicError, > { - let entry = CurrentMigration; - self.client.storage().fetch(&entry, hash).await + if self.client.metadata().storage_hash::()? + == [ + 228u8, 254u8, 240u8, 20u8, 92u8, 79u8, 40u8, 65u8, 176u8, + 111u8, 243u8, 168u8, 238u8, 147u8, 247u8, 170u8, 185u8, + 107u8, 58u8, 54u8, 224u8, 222u8, 141u8, 113u8, 95u8, 92u8, + 17u8, 69u8, 162u8, 242u8, 245u8, 95u8, + ] + { + let entry = CurrentMigration; + self.client.storage().fetch(&entry, block_hash).await + } else { + Err(::subxt::MetadataError::IncompatibleMetadata.into()) + } } } } @@ -36124,6 +47161,20 @@ pub mod api { T: ::subxt::Config, X: ::subxt::extrinsic::ExtrinsicParams, { + pub fn validate_metadata(&'a self) -> Result<(), ::subxt::MetadataError> { + if self.client.metadata().metadata_hash(&PALLETS) + != [ + 222u8, 70u8, 96u8, 67u8, 220u8, 49u8, 147u8, 114u8, 199u8, 254u8, + 88u8, 102u8, 188u8, 14u8, 180u8, 163u8, 55u8, 109u8, 43u8, 71u8, + 135u8, 161u8, 80u8, 151u8, 66u8, 252u8, 126u8, 104u8, 59u8, 80u8, + 140u8, 193u8, + ] + { + Err(::subxt::MetadataError::IncompatibleMetadata) + } else { + Ok(()) + } + } pub fn constants(&'a self) -> ConstantsApi<'a, T> { ConstantsApi { client: &self.client, diff --git a/subxt/tests/integration/events.rs b/subxt/tests/integration/events.rs index 6f01ce70e2..937a4faf91 100644 --- a/subxt/tests/integration/events.rs +++ b/subxt/tests/integration/events.rs @@ -116,7 +116,7 @@ async fn balance_transfer_subscription() -> Result<(), subxt::BasicError> { ctx.api .tx() .balances() - .transfer(bob.clone().into(), 10_000) + .transfer(bob.clone().into(), 10_000)? .sign_and_submit_then_watch_default(&alice) .await?; diff --git a/subxt/tests/integration/frame/balances.rs b/subxt/tests/integration/frame/balances.rs index b86bc83ca7..b977eee427 100644 --- a/subxt/tests/integration/frame/balances.rs +++ b/subxt/tests/integration/frame/balances.rs @@ -58,7 +58,7 @@ async fn tx_basic_transfer() -> Result<(), subxt::Error> { let events = api .tx() .balances() - .transfer(bob_address, 10_000) + .transfer(bob_address, 10_000)? .sign_and_submit_then_watch_default(&alice) .await? .wait_for_finalized_success() @@ -114,7 +114,7 @@ async fn multiple_transfers_work_nonce_incremented( api .tx() .balances() - .transfer(bob_address.clone(), 10_000) + .transfer(bob_address.clone(), 10_000)? .sign_and_submit_then_watch_default(&alice) .await? .wait_for_in_block() // Don't need to wait for finalization; this is quicker. @@ -159,7 +159,7 @@ async fn storage_balance_lock() -> Result<(), subxt::Error> { charlie.into(), 100_000_000_000_000, runtime_types::pallet_staking::RewardDestination::Stash, - ) + )? .sign_and_submit_then_watch_default(&bob) .await? .wait_for_finalized_success() @@ -200,6 +200,7 @@ async fn transfer_error() { .tx() .balances() .transfer(hans_address, 100_000_000_000_000_000) + .unwrap() .sign_and_submit_then_watch_default(&alice) .await .unwrap() @@ -212,6 +213,7 @@ async fn transfer_error() { .tx() .balances() .transfer(alice_addr, 100_000_000_000_000_000) + .unwrap() .sign_and_submit_then_watch_default(&hans) .await .unwrap() @@ -239,6 +241,7 @@ async fn transfer_implicit_subscription() { .tx() .balances() .transfer(bob_addr, 10_000) + .unwrap() .sign_and_submit_then_watch_default(&alice) .await .unwrap() diff --git a/subxt/tests/integration/frame/contracts.rs b/subxt/tests/integration/frame/contracts.rs index 43091b6aca..944d33779b 100644 --- a/subxt/tests/integration/frame/contracts.rs +++ b/subxt/tests/integration/frame/contracts.rs @@ -90,7 +90,7 @@ impl ContractsTestContext { code, vec![], // data vec![], // salt - ) + )? .sign_and_submit_then_watch_default(&self.signer) .await? .wait_for_finalized_success() @@ -130,7 +130,7 @@ impl ContractsTestContext { code_hash, data, salt, - ) + )? .sign_and_submit_then_watch_default(&self.signer) .await? .wait_for_finalized_success() @@ -161,7 +161,7 @@ impl ContractsTestContext { 500_000_000, // gas_limit None, // storage_deposit_limit input_data, - ) + )? .sign_and_submit_then_watch_default(&self.signer) .await?; diff --git a/subxt/tests/integration/frame/staking.rs b/subxt/tests/integration/frame/staking.rs index 49e3a476d3..e5a9ddd1aa 100644 --- a/subxt/tests/integration/frame/staking.rs +++ b/subxt/tests/integration/frame/staking.rs @@ -55,6 +55,7 @@ async fn validate_with_controller_account() { .tx() .staking() .validate(default_validator_prefs()) + .unwrap() .sign_and_submit_then_watch_default(&alice) .await .unwrap() @@ -71,7 +72,7 @@ async fn validate_not_possible_for_stash_account() -> Result<(), Error Result<(), Error Result<(), Error> { ctx.api .tx() .staking() - .nominate(vec![bob_stash.account_id().clone().into()]) + .nominate(vec![bob_stash.account_id().clone().into()])? .sign_and_submit_then_watch_default(&alice) .await? .wait_for_finalized_success() @@ -154,7 +156,7 @@ async fn chill_works_for_controller_only() -> Result<(), Error> { .api .tx() .staking() - .chill() + .chill()? .sign_and_submit_then_watch_default(&alice_stash) .await? .wait_for_finalized_success() @@ -169,7 +171,7 @@ async fn chill_works_for_controller_only() -> Result<(), Error> { .api .tx() .staking() - .chill() + .chill()? .sign_and_submit_then_watch_default(&alice) .await? .wait_for_finalized_success() @@ -194,6 +196,7 @@ async fn tx_bond() -> Result<(), Error> { 100_000_000_000_000, RewardDestination::Stash, ) + .unwrap() .sign_and_submit_then_watch_default(&alice) .await? .wait_for_finalized_success() @@ -210,6 +213,7 @@ async fn tx_bond() -> Result<(), Error> { 100_000_000_000_000, RewardDestination::Stash, ) + .unwrap() .sign_and_submit_then_watch_default(&alice) .await? .wait_for_finalized_success() diff --git a/subxt/tests/integration/frame/sudo.rs b/subxt/tests/integration/frame/sudo.rs index 16eae0ea3c..501320d44b 100644 --- a/subxt/tests/integration/frame/sudo.rs +++ b/subxt/tests/integration/frame/sudo.rs @@ -43,7 +43,7 @@ async fn test_sudo() -> Result<(), subxt::Error> { .api .tx() .sudo() - .sudo(call) + .sudo(call)? .sign_and_submit_then_watch_default(&alice) .await? .wait_for_finalized_success() @@ -69,7 +69,7 @@ async fn test_sudo_unchecked_weight() -> Result<(), subxt::Error> .api .tx() .sudo() - .sudo_unchecked_weight(call, 0) + .sudo_unchecked_weight(call, 0)? .sign_and_submit_then_watch_default(&alice) .await? .wait_for_finalized_success() diff --git a/subxt/tests/integration/frame/system.rs b/subxt/tests/integration/frame/system.rs index fae5ba70b5..ff7e9a9c01 100644 --- a/subxt/tests/integration/frame/system.rs +++ b/subxt/tests/integration/frame/system.rs @@ -50,7 +50,7 @@ async fn tx_remark_with_event() -> Result<(), subxt::Error> { .api .tx() .system() - .remark_with_event(b"remarkable".to_vec()) + .remark_with_event(b"remarkable".to_vec())? .sign_and_submit_then_watch_default(&alice) .await? .wait_for_finalized_success() diff --git a/subxt/tests/integration/main.rs b/subxt/tests/integration/main.rs index 4a44d07b98..e288745714 100644 --- a/subxt/tests/integration/main.rs +++ b/subxt/tests/integration/main.rs @@ -24,6 +24,9 @@ mod events; #[cfg(test)] mod frame; #[cfg(test)] +#[cfg(integration_tests)] +mod metadata; +#[cfg(test)] mod storage; use test_runtime::node_runtime; diff --git a/subxt/tests/integration/metadata/mod.rs b/subxt/tests/integration/metadata/mod.rs new file mode 100644 index 0000000000..3217f6bbfe --- /dev/null +++ b/subxt/tests/integration/metadata/mod.rs @@ -0,0 +1,17 @@ +// Copyright 2019-2022 Parity Technologies (UK) Ltd. +// This file is part of subxt. +// +// subxt is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// subxt is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with subxt. If not, see . + +mod validation; diff --git a/subxt/tests/integration/metadata/validation.rs b/subxt/tests/integration/metadata/validation.rs new file mode 100644 index 0000000000..fa8db37738 --- /dev/null +++ b/subxt/tests/integration/metadata/validation.rs @@ -0,0 +1,334 @@ +// Copyright 2019-2022 Parity Technologies (UK) Ltd. +// This file is part of subxt. +// +// subxt is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// subxt is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with subxt. If not, see . + +use crate::{ + test_context, + TestContext, +}; +use frame_metadata::{ + ExtrinsicMetadata, + PalletCallMetadata, + PalletMetadata, + PalletStorageMetadata, + RuntimeMetadataPrefixed, + RuntimeMetadataV14, + StorageEntryMetadata, + StorageEntryModifier, + StorageEntryType, +}; +use scale_info::{ + build::{ + Fields, + Variants, + }, + meta_type, + Path, + Type, + TypeInfo, +}; +use subxt::{ + ClientBuilder, + DefaultConfig, + Metadata, + SubstrateExtrinsicParams, +}; + +use crate::utils::node_runtime; + +type RuntimeApi = + node_runtime::RuntimeApi>; + +async fn metadata_to_api(metadata: RuntimeMetadataV14, cxt: &TestContext) -> RuntimeApi { + let prefixed = RuntimeMetadataPrefixed::from(metadata); + let metadata = Metadata::try_from(prefixed).unwrap(); + + ClientBuilder::new() + .set_url(cxt.node_proc.ws_url().to_string()) + .set_metadata(metadata) + .build() + .await + .unwrap() + .to_runtime_api::, + >>() +} + +#[tokio::test] +async fn full_metadata_check() { + let cxt = test_context().await; + let api = &cxt.api; + + // Runtime metadata is identical to the metadata used during API generation. + assert!(api.validate_metadata().is_ok()); + + // Modify the metadata. + let mut metadata: RuntimeMetadataV14 = + api.client.metadata().runtime_metadata().clone(); + metadata.pallets[0].name = "NewPallet".to_string(); + + let new_api = metadata_to_api(metadata, &cxt).await; + assert_eq!( + new_api + .validate_metadata() + .err() + .expect("Validation should fail for incompatible metadata"), + ::subxt::MetadataError::IncompatibleMetadata + ); +} + +#[tokio::test] +async fn constants_check() { + let cxt = test_context().await; + let api = &cxt.api; + + // Ensure that `ExistentialDeposit` is compatible before altering the metadata. + assert!(cxt.api.constants().balances().existential_deposit().is_ok()); + + // Modify the metadata. + let mut metadata: RuntimeMetadataV14 = + api.client.metadata().runtime_metadata().clone(); + + let mut existential = metadata + .pallets + .iter_mut() + .find(|pallet| pallet.name == "Balances") + .expect("Metadata must contain Balances pallet") + .constants + .iter_mut() + .find(|constant| constant.name == "ExistentialDeposit") + .expect("ExistentialDeposit constant must be present"); + existential.value = vec![0u8; 32]; + + let new_api = metadata_to_api(metadata, &cxt).await; + + assert!(new_api.validate_metadata().is_err()); + assert!(new_api + .constants() + .balances() + .existential_deposit() + .is_err()); + + // Other constant validation should not be impacted. + assert!(new_api.constants().balances().max_locks().is_ok()); +} + +fn default_pallet() -> PalletMetadata { + PalletMetadata { + name: "Test", + storage: None, + calls: None, + event: None, + constants: vec![], + error: None, + index: 0, + } +} + +fn pallets_to_metadata(pallets: Vec) -> RuntimeMetadataV14 { + RuntimeMetadataV14::new( + pallets, + ExtrinsicMetadata { + ty: meta_type::<()>(), + version: 0, + signed_extensions: vec![], + }, + meta_type::<()>(), + ) +} + +#[tokio::test] +async fn calls_check() { + let cxt = test_context().await; + + // Ensure that `Unbond` and `WinthdrawUnbonded` calls are compatible before altering the metadata. + assert!(cxt.api.tx().staking().unbond(123_456_789_012_345).is_ok()); + assert!(cxt.api.tx().staking().withdraw_unbonded(10).is_ok()); + + // Reconstruct the `Staking` call as is. + struct CallRec; + impl TypeInfo for CallRec { + type Identity = Self; + fn type_info() -> Type { + Type::builder() + .path(Path::new("Call", "pallet_staking::pallet::pallet")) + .variant( + Variants::new() + .variant("unbond", |v| { + v.index(0).fields(Fields::named().field(|f| { + f.compact::() + .name("value") + .type_name("BalanceOf") + })) + }) + .variant("withdraw_unbonded", |v| { + v.index(1).fields(Fields::named().field(|f| { + f.ty::().name("num_slashing_spans").type_name("u32") + })) + }), + ) + } + } + let pallet = PalletMetadata { + name: "Staking", + calls: Some(PalletCallMetadata { + ty: meta_type::(), + }), + ..default_pallet() + }; + let metadata = pallets_to_metadata(vec![pallet]); + let new_api = metadata_to_api(metadata, &cxt).await; + assert!(new_api.tx().staking().unbond(123_456_789_012_345).is_ok()); + assert!(new_api.tx().staking().withdraw_unbonded(10).is_ok()); + + // Change `Unbond` call but leave the rest as is. + struct CallRecSecond; + impl TypeInfo for CallRecSecond { + type Identity = Self; + fn type_info() -> Type { + Type::builder() + .path(Path::new("Call", "pallet_staking::pallet::pallet")) + .variant( + Variants::new() + .variant("unbond", |v| { + v.index(0).fields(Fields::named().field(|f| { + // Is of type u32 instead of u128. + f.compact::().name("value").type_name("BalanceOf") + })) + }) + .variant("withdraw_unbonded", |v| { + v.index(1).fields(Fields::named().field(|f| { + f.ty::().name("num_slashing_spans").type_name("u32") + })) + }), + ) + } + } + let pallet = PalletMetadata { + name: "Staking", + calls: Some(PalletCallMetadata { + ty: meta_type::(), + }), + ..default_pallet() + }; + let metadata = pallets_to_metadata(vec![pallet]); + let new_api = metadata_to_api(metadata, &cxt).await; + // Unbond call should fail, while withdraw_unbonded remains compatible. + assert!(new_api.tx().staking().unbond(123_456_789_012_345).is_err()); + assert!(new_api.tx().staking().withdraw_unbonded(10).is_ok()); +} + +#[tokio::test] +async fn storage_check() { + let cxt = test_context().await; + + // Ensure that `ExtrinsicCount` and `EventCount` storages are compatible before altering the metadata. + assert!(cxt + .api + .storage() + .system() + .extrinsic_count(None) + .await + .is_ok()); + assert!(cxt + .api + .storage() + .system() + .all_extrinsics_len(None) + .await + .is_ok()); + + // Reconstruct the storage. + let storage = PalletStorageMetadata { + prefix: "System", + entries: vec![ + StorageEntryMetadata { + name: "ExtrinsicCount", + modifier: StorageEntryModifier::Optional, + ty: StorageEntryType::Plain(meta_type::()), + default: vec![0], + docs: vec![], + }, + StorageEntryMetadata { + name: "AllExtrinsicsLen", + modifier: StorageEntryModifier::Optional, + ty: StorageEntryType::Plain(meta_type::()), + default: vec![0], + docs: vec![], + }, + ], + }; + let pallet = PalletMetadata { + name: "System", + storage: Some(storage), + ..default_pallet() + }; + let metadata = pallets_to_metadata(vec![pallet]); + let new_api = metadata_to_api(metadata, &cxt).await; + assert!(new_api + .storage() + .system() + .extrinsic_count(None) + .await + .is_ok()); + assert!(new_api + .storage() + .system() + .all_extrinsics_len(None) + .await + .is_ok()); + + // Reconstruct the storage while modifying ExtrinsicCount. + let storage = PalletStorageMetadata { + prefix: "System", + entries: vec![ + StorageEntryMetadata { + name: "ExtrinsicCount", + modifier: StorageEntryModifier::Optional, + // Previously was u32. + ty: StorageEntryType::Plain(meta_type::()), + default: vec![0], + docs: vec![], + }, + StorageEntryMetadata { + name: "AllExtrinsicsLen", + modifier: StorageEntryModifier::Optional, + ty: StorageEntryType::Plain(meta_type::()), + default: vec![0], + docs: vec![], + }, + ], + }; + let pallet = PalletMetadata { + name: "System", + storage: Some(storage), + ..default_pallet() + }; + let metadata = pallets_to_metadata(vec![pallet]); + let new_api = metadata_to_api(metadata, &cxt).await; + assert!(new_api + .storage() + .system() + .extrinsic_count(None) + .await + .is_err()); + assert!(new_api + .storage() + .system() + .all_extrinsics_len(None) + .await + .is_ok()); +} diff --git a/subxt/tests/integration/storage.rs b/subxt/tests/integration/storage.rs index 278d6448cf..552a06278f 100644 --- a/subxt/tests/integration/storage.rs +++ b/subxt/tests/integration/storage.rs @@ -48,7 +48,7 @@ async fn storage_map_lookup() -> Result<(), subxt::Error> { ctx.api .tx() .system() - .remark(vec![1, 2, 3, 4, 5]) + .remark(vec![1, 2, 3, 4, 5])? .sign_and_submit_then_watch_default(&signer) .await? .wait_for_finalized_success() @@ -113,7 +113,7 @@ async fn storage_n_map_storage_lookup() -> Result<(), subxt::Error Result<(), subxt::Error { proc: process::Child, client: Client, + #[cfg(integration_tests)] + ws_url: String, } impl Drop for TestNodeProcess @@ -75,6 +77,12 @@ where pub fn client(&self) -> &Client { &self.client } + + /// Returns the address to which the client is connected. + #[cfg(integration_tests)] + pub fn ws_url(&self) -> &str { + &self.ws_url + } } /// Construct a test node process. @@ -137,7 +145,14 @@ impl TestNodeProcessBuilder { // Connect to the node with a subxt client: let client = ClientBuilder::new().set_url(ws_url.clone()).build().await; match client { - Ok(client) => Ok(TestNodeProcess { proc, client }), + Ok(client) => { + Ok(TestNodeProcess { + proc, + client, + #[cfg(integration_tests)] + ws_url, + }) + } Err(err) => { let err = format!("Failed to connect to node rpc at {}: {}", ws_url, err); log::error!("{}", err);