mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-11 07:11:06 +00:00
fix examples with core crate
This commit is contained in:
+10
-6
@@ -15,7 +15,7 @@ pub mod config;
|
||||
pub mod constants;
|
||||
pub mod custom_values;
|
||||
pub mod dynamic;
|
||||
mod error;
|
||||
pub mod error;
|
||||
pub mod metadata;
|
||||
pub mod runtime_api;
|
||||
pub mod signer;
|
||||
@@ -23,17 +23,21 @@ pub mod storage;
|
||||
pub mod tx;
|
||||
pub mod utils;
|
||||
|
||||
pub use error::{Error, ExtrinsicParamsError, MetadataError, StorageAddressError};
|
||||
|
||||
pub use client::{ClientBase, RuntimeVersion};
|
||||
pub use config::{
|
||||
BlockHash, Config, ExtrinsicParams, ExtrinsicParamsEncoder, PolkadotConfig,
|
||||
PolkadotExtrinsicParams, SubstrateConfig, SubstrateExtrinsicParams,
|
||||
signed_extensions, BlockHash, Config, ExtrinsicParams, ExtrinsicParamsEncoder, Hasher, Header,
|
||||
PolkadotConfig, PolkadotExtrinsicParams, SignedExtension, SubstrateConfig,
|
||||
SubstrateExtrinsicParams,
|
||||
};
|
||||
pub use dynamic::{DecodedValue, DecodedValueThunk};
|
||||
pub use error::{Error, ExtrinsicParamsError, MetadataError, StorageAddressError};
|
||||
pub use metadata::Metadata;
|
||||
pub use signer::Signer;
|
||||
pub use storage::StorageAddress;
|
||||
pub use utils::{to_hex, AccountId32, MultiAddress, MultiSignature, Yes, H160, H256, H512};
|
||||
pub use utils::{
|
||||
strip_compact_prefix, to_hex, AccountId32, KeyedVec, MultiAddress, MultiSignature, Yes, H160,
|
||||
H256, H512,
|
||||
};
|
||||
|
||||
#[macro_use]
|
||||
mod macros;
|
||||
|
||||
@@ -38,6 +38,20 @@ pub trait TxPayload {
|
||||
fn validation_details(&self) -> Option<ValidationDetails<'_>> {
|
||||
None
|
||||
}
|
||||
|
||||
fn validate(&self, metadata: &Metadata) -> Result<(), Error> {
|
||||
if let Some(details) = self.validation_details() {
|
||||
let expected_hash = metadata
|
||||
.pallet_by_name_err(details.pallet_name)?
|
||||
.call_hash(details.call_name)
|
||||
.ok_or_else(|| MetadataError::CallNameNotFound(details.call_name.to_owned()))?;
|
||||
|
||||
if details.hash != expected_hash {
|
||||
return Err(MetadataError::IncompatibleCodegen.into());
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ValidationDetails<'a> {
|
||||
|
||||
Reference in New Issue
Block a user