pub struct Metadata { /* private fields */ }Expand description
Node metadata. This can be constructed by providing some compatible frame_metadata
which is then decoded into this. We aim to preserve all of the existing information in
the incoming metadata while optimizing the format a little for Subxt’s use cases.
Implementations§
Source§impl Metadata
impl Metadata
Sourcepub fn arc(self) -> Arc<Metadata> ⓘ
pub fn arc(self) -> Arc<Metadata> ⓘ
Metadata tends to be passed around wrapped in an Arc so that it can be
cheaply cloned. This is a shorthand to return that.
Sourcepub fn decode_from(bytes: &[u8]) -> Result<Metadata, Error>
pub fn decode_from(bytes: &[u8]) -> Result<Metadata, Error>
This is similar to<Metadata as codec::Decode>::decode(&mut bytes), except it
is able to attempt to decode from several types.
- The default assumption is that metadata is encoded as
frame_metadata::RuntimeMetadataPrefixed. This is the expected format that metadata is encoded into, and what thecodec::Decodeimpl tries. - if this fails, we also try to decode as
frame_metadata::RuntimeMetadata. - If this all fails, we finally will try to decode as
frame_metadata::OpaqueMetadata.
Sourcepub fn from_v16(metadata: RuntimeMetadataV16) -> Result<Metadata, TryFromError>
pub fn from_v16(metadata: RuntimeMetadataV16) -> Result<Metadata, TryFromError>
Convert V16 metadata into Metadata.
Sourcepub fn from_v15(metadata: RuntimeMetadataV15) -> Result<Metadata, TryFromError>
pub fn from_v15(metadata: RuntimeMetadataV15) -> Result<Metadata, TryFromError>
Convert V15 metadata into Metadata.
Sourcepub fn from_v14(metadata: RuntimeMetadataV14) -> Result<Metadata, TryFromError>
pub fn from_v14(metadata: RuntimeMetadataV14) -> Result<Metadata, TryFromError>
Convert V14 metadata into Metadata.
Sourcepub fn from_v13(
metadata: &RuntimeMetadataV13,
types: &TypeRegistrySet<'_>,
) -> Result<Metadata, Error>
pub fn from_v13( metadata: &RuntimeMetadataV13, types: &TypeRegistrySet<'_>, ) -> Result<Metadata, Error>
Convert V13 metadata into Metadata, given the necessary extra type information.
Sourcepub fn from_v12(
metadata: &RuntimeMetadataV12,
types: &TypeRegistrySet<'_>,
) -> Result<Metadata, Error>
pub fn from_v12( metadata: &RuntimeMetadataV12, types: &TypeRegistrySet<'_>, ) -> Result<Metadata, Error>
Convert V12 metadata into Metadata, given the necessary extra type information.
Sourcepub fn from_v11(
metadata: &RuntimeMetadataV11,
types: &TypeRegistrySet<'_>,
) -> Result<Metadata, Error>
pub fn from_v11( metadata: &RuntimeMetadataV11, types: &TypeRegistrySet<'_>, ) -> Result<Metadata, Error>
Convert V13 metadata into Metadata, given the necessary extra type information.
Sourcepub fn from_v10(
metadata: &RuntimeMetadataV10,
types: &TypeRegistrySet<'_>,
) -> Result<Metadata, Error>
pub fn from_v10( metadata: &RuntimeMetadataV10, types: &TypeRegistrySet<'_>, ) -> Result<Metadata, Error>
Convert V13 metadata into Metadata, given the necessary extra type information.
Sourcepub fn from_v9(
metadata: &RuntimeMetadataV9,
types: &TypeRegistrySet<'_>,
) -> Result<Metadata, Error>
pub fn from_v9( metadata: &RuntimeMetadataV9, types: &TypeRegistrySet<'_>, ) -> Result<Metadata, Error>
Convert V9 metadata into Metadata, given the necessary extra type information.
Sourcepub fn from_v8(
metadata: &RuntimeMetadataV8,
types: &TypeRegistrySet<'_>,
) -> Result<Metadata, Error>
pub fn from_v8( metadata: &RuntimeMetadataV8, types: &TypeRegistrySet<'_>, ) -> Result<Metadata, Error>
Convert V8 metadata into Metadata, given the necessary extra type information.
Sourcepub fn types(&self) -> &PortableRegistry
pub fn types(&self) -> &PortableRegistry
Access the underlying type registry.
Sourcepub fn types_mut(&mut self) -> &mut PortableRegistry
pub fn types_mut(&mut self) -> &mut PortableRegistry
Mutable access to the underlying type registry.
Sourcepub fn dispatch_error_ty(&self) -> Option<u32>
pub fn dispatch_error_ty(&self) -> Option<u32>
The type ID of the DispatchError type, if it exists.
Sourcepub fn extrinsic(&self) -> &ExtrinsicMetadata
pub fn extrinsic(&self) -> &ExtrinsicMetadata
Return details about the extrinsic format.
Sourcepub fn outer_enums(&self) -> OuterEnumsMetadata
pub fn outer_enums(&self) -> OuterEnumsMetadata
Return details about the outer enums.
Sourcepub fn pallets(&self) -> impl ExactSizeIterator
pub fn pallets(&self) -> impl ExactSizeIterator
An iterator over all of the available pallets.
Sourcepub fn pallet_by_call_index(
&self,
variant_index: u8,
) -> Option<PalletMetadata<'_>>
pub fn pallet_by_call_index( &self, variant_index: u8, ) -> Option<PalletMetadata<'_>>
Access a pallet given some call/extrinsic pallet index byte
Sourcepub fn pallet_by_event_index(
&self,
variant_index: u8,
) -> Option<PalletMetadata<'_>>
pub fn pallet_by_event_index( &self, variant_index: u8, ) -> Option<PalletMetadata<'_>>
Access a pallet given some event pallet index byte
Sourcepub fn pallet_by_error_index(
&self,
variant_index: u8,
) -> Option<PalletMetadata<'_>>
pub fn pallet_by_error_index( &self, variant_index: u8, ) -> Option<PalletMetadata<'_>>
Access a pallet given some error pallet index byte
Sourcepub fn pallet_by_name(&self, pallet_name: &str) -> Option<PalletMetadata<'_>>
pub fn pallet_by_name(&self, pallet_name: &str) -> Option<PalletMetadata<'_>>
Access a pallet given its name.
Sourcepub fn runtime_api_traits(&self) -> impl ExactSizeIterator
pub fn runtime_api_traits(&self) -> impl ExactSizeIterator
An iterator over all of the runtime APIs.
Sourcepub fn runtime_api_trait_by_name(
&self,
name: &str,
) -> Option<RuntimeApiMetadata<'_>>
pub fn runtime_api_trait_by_name( &self, name: &str, ) -> Option<RuntimeApiMetadata<'_>>
Access a runtime API trait given its name.
Sourcepub fn custom(&self) -> CustomMetadata<'_>
pub fn custom(&self) -> CustomMetadata<'_>
Returns custom user defined types
Sourcepub fn hasher(&self) -> MetadataHasher<'_>
pub fn hasher(&self) -> MetadataHasher<'_>
Obtain a unique hash representing this metadata or specific parts of it.
Trait Implementations§
Source§impl ConstantEntryInfo for Metadata
impl ConstantEntryInfo for Metadata
Source§fn constant_entries(
&self,
) -> impl Iterator<Item = Entry<Cow<'_, str>, Cow<'_, str>>>
fn constant_entries( &self, ) -> impl Iterator<Item = Entry<Cow<'_, str>, Cow<'_, str>>>
Entry as we go.Source§impl ConstantTypeInfo for Metadata
impl ConstantTypeInfo for Metadata
Source§fn constant_info(
&self,
pallet_name: &str,
constant_name: &str,
) -> Result<ConstantInfo<'_, <Metadata as ConstantTypeInfo>::TypeId>, ConstantInfoError<'_>>
fn constant_info( &self, pallet_name: &str, constant_name: &str, ) -> Result<ConstantInfo<'_, <Metadata as ConstantTypeInfo>::TypeId>, ConstantInfoError<'_>>
Source§impl CustomValueEntryInfo for Metadata
impl CustomValueEntryInfo for Metadata
Source§fn custom_values(&self) -> impl Iterator<Item = CustomValue<'_>>
fn custom_values(&self) -> impl Iterator<Item = CustomValue<'_>>
CustomValue as we go.Source§impl CustomValueTypeInfo for Metadata
impl CustomValueTypeInfo for Metadata
Source§fn custom_value_info(
&self,
name: &str,
) -> Result<CustomValueInfo<'_, <Metadata as CustomValueTypeInfo>::TypeId>, CustomValueInfoError>
fn custom_value_info( &self, name: &str, ) -> Result<CustomValueInfo<'_, <Metadata as CustomValueTypeInfo>::TypeId>, CustomValueInfoError>
Source§impl Decode for Metadata
impl Decode for Metadata
Source§fn decode<I>(input: &mut I) -> Result<Metadata, Error>where
I: Input,
fn decode<I>(input: &mut I) -> Result<Metadata, Error>where
I: Input,
Source§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
Source§impl ExtrinsicTypeInfo for Metadata
impl ExtrinsicTypeInfo for Metadata
Source§fn extrinsic_call_info_by_index(
&self,
pallet_index: u8,
call_index: u8,
) -> Result<ExtrinsicCallInfo<'_, <Metadata as ExtrinsicTypeInfo>::TypeId>, ExtrinsicInfoError<'_>>
fn extrinsic_call_info_by_index( &self, pallet_index: u8, call_index: u8, ) -> Result<ExtrinsicCallInfo<'_, <Metadata as ExtrinsicTypeInfo>::TypeId>, ExtrinsicInfoError<'_>>
Source§fn extrinsic_call_info_by_name(
&self,
pallet_name: &str,
call_name: &str,
) -> Result<ExtrinsicCallInfo<'_, <Metadata as ExtrinsicTypeInfo>::TypeId>, ExtrinsicInfoError<'_>>
fn extrinsic_call_info_by_name( &self, pallet_name: &str, call_name: &str, ) -> Result<ExtrinsicCallInfo<'_, <Metadata as ExtrinsicTypeInfo>::TypeId>, ExtrinsicInfoError<'_>>
Source§fn extrinsic_signature_info(
&self,
) -> Result<ExtrinsicSignatureInfo<<Metadata as ExtrinsicTypeInfo>::TypeId>, ExtrinsicInfoError<'_>>
fn extrinsic_signature_info( &self, ) -> Result<ExtrinsicSignatureInfo<<Metadata as ExtrinsicTypeInfo>::TypeId>, ExtrinsicInfoError<'_>>
Source§fn extrinsic_extension_version_info(
&self,
) -> Result<impl Iterator<Item = u8>, ExtrinsicInfoError<'_>>
fn extrinsic_extension_version_info( &self, ) -> Result<impl Iterator<Item = u8>, ExtrinsicInfoError<'_>>
Source§fn extrinsic_extension_info(
&self,
extension_version: Option<u8>,
) -> Result<ExtrinsicExtensionInfo<'_, <Metadata as ExtrinsicTypeInfo>::TypeId>, ExtrinsicInfoError<'_>>
fn extrinsic_extension_info( &self, extension_version: Option<u8>, ) -> Result<ExtrinsicExtensionInfo<'_, <Metadata as ExtrinsicTypeInfo>::TypeId>, ExtrinsicInfoError<'_>>
Source§impl RuntimeApiEntryInfo for Metadata
impl RuntimeApiEntryInfo for Metadata
Source§fn runtime_api_entries(
&self,
) -> impl Iterator<Item = Entry<Cow<'_, str>, Cow<'_, str>>>
fn runtime_api_entries( &self, ) -> impl Iterator<Item = Entry<Cow<'_, str>, Cow<'_, str>>>
Entry as we go.Source§impl RuntimeApiTypeInfo for Metadata
impl RuntimeApiTypeInfo for Metadata
Source§fn runtime_api_info(
&self,
trait_name: &str,
method_name: &str,
) -> Result<RuntimeApiInfo<'_, <Metadata as RuntimeApiTypeInfo>::TypeId>, RuntimeApiInfoError<'_>>
fn runtime_api_info( &self, trait_name: &str, method_name: &str, ) -> Result<RuntimeApiInfo<'_, <Metadata as RuntimeApiTypeInfo>::TypeId>, RuntimeApiInfoError<'_>>
Source§impl StorageEntryInfo for Metadata
impl StorageEntryInfo for Metadata
Source§fn storage_entries(
&self,
) -> impl Iterator<Item = Entry<Cow<'_, str>, Cow<'_, str>>>
fn storage_entries( &self, ) -> impl Iterator<Item = Entry<Cow<'_, str>, Cow<'_, str>>>
Entry as we go.Source§impl StorageTypeInfo for Metadata
impl StorageTypeInfo for Metadata
Source§fn storage_info(
&self,
pallet_name: &str,
storage_entry: &str,
) -> Result<StorageInfo<'_, <Metadata as StorageTypeInfo>::TypeId>, StorageInfoError<'_>>
fn storage_info( &self, pallet_name: &str, storage_entry: &str, ) -> Result<StorageInfo<'_, <Metadata as StorageTypeInfo>::TypeId>, StorageInfoError<'_>>
Source§impl TryFrom<RuntimeMetadataPrefixed> for Metadata
impl TryFrom<RuntimeMetadataPrefixed> for Metadata
Source§type Error = TryFromError
type Error = TryFromError
Source§fn try_from(
value: RuntimeMetadataPrefixed,
) -> Result<Metadata, <Metadata as TryFrom<RuntimeMetadataPrefixed>>::Error>
fn try_from( value: RuntimeMetadataPrefixed, ) -> Result<Metadata, <Metadata as TryFrom<RuntimeMetadataPrefixed>>::Error>
Source§impl TryFrom<RuntimeMetadataV14> for Metadata
impl TryFrom<RuntimeMetadataV14> for Metadata
Source§type Error = TryFromError
type Error = TryFromError
Source§fn try_from(m: RuntimeMetadataV14) -> Result<Metadata, TryFromError>
fn try_from(m: RuntimeMetadataV14) -> Result<Metadata, TryFromError>
Source§impl TryFrom<RuntimeMetadataV15> for Metadata
impl TryFrom<RuntimeMetadataV15> for Metadata
Source§type Error = TryFromError
type Error = TryFromError
Source§fn try_from(m: RuntimeMetadataV15) -> Result<Metadata, TryFromError>
fn try_from(m: RuntimeMetadataV15) -> Result<Metadata, TryFromError>
Source§impl TryFrom<RuntimeMetadataV16> for Metadata
impl TryFrom<RuntimeMetadataV16> for Metadata
Source§type Error = TryFromError
type Error = TryFromError
Source§fn try_from(m: RuntimeMetadataV16) -> Result<Metadata, TryFromError>
fn try_from(m: RuntimeMetadataV16) -> Result<Metadata, TryFromError>
Source§impl ViewFunctionEntryInfo for Metadata
impl ViewFunctionEntryInfo for Metadata
Source§fn view_function_entries(
&self,
) -> impl Iterator<Item = Entry<Cow<'_, str>, Cow<'_, str>>>
fn view_function_entries( &self, ) -> impl Iterator<Item = Entry<Cow<'_, str>, Cow<'_, str>>>
Entry as we go.Source§impl ViewFunctionTypeInfo for Metadata
impl ViewFunctionTypeInfo for Metadata
Source§fn view_function_info(
&self,
pallet_name: &str,
function_name: &str,
) -> Result<ViewFunctionInfo<'_, <Metadata as ViewFunctionTypeInfo>::TypeId>, ViewFunctionInfoError<'_>>
fn view_function_info( &self, pallet_name: &str, function_name: &str, ) -> Result<ViewFunctionInfo<'_, <Metadata as ViewFunctionTypeInfo>::TypeId>, ViewFunctionInfoError<'_>>
Auto Trait Implementations§
impl Freeze for Metadata
impl RefUnwindSafe for Metadata
impl Send for Metadata
impl Sync for Metadata
impl Unpin for Metadata
impl UnsafeUnpin for Metadata
impl UnwindSafe for Metadata
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> DecodeLimit for Twhere
T: Decode,
impl<T> DecodeLimit for Twhere
T: Decode,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more