Skip to main content

Metadata

Struct Metadata 

Source
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

Source

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.

Source

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.

Source

pub fn from_v16(metadata: RuntimeMetadataV16) -> Result<Metadata, TryFromError>

Convert V16 metadata into Metadata.

Source

pub fn from_v15(metadata: RuntimeMetadataV15) -> Result<Metadata, TryFromError>

Convert V15 metadata into Metadata.

Source

pub fn from_v14(metadata: RuntimeMetadataV14) -> Result<Metadata, TryFromError>

Convert V14 metadata into Metadata.

Source

pub fn from_v13( metadata: &RuntimeMetadataV13, types: &TypeRegistrySet<'_>, ) -> Result<Metadata, Error>

Convert V13 metadata into Metadata, given the necessary extra type information.

Source

pub fn from_v12( metadata: &RuntimeMetadataV12, types: &TypeRegistrySet<'_>, ) -> Result<Metadata, Error>

Convert V12 metadata into Metadata, given the necessary extra type information.

Source

pub fn from_v11( metadata: &RuntimeMetadataV11, types: &TypeRegistrySet<'_>, ) -> Result<Metadata, Error>

Convert V13 metadata into Metadata, given the necessary extra type information.

Source

pub fn from_v10( metadata: &RuntimeMetadataV10, types: &TypeRegistrySet<'_>, ) -> Result<Metadata, Error>

Convert V13 metadata into Metadata, given the necessary extra type information.

Source

pub fn from_v9( metadata: &RuntimeMetadataV9, types: &TypeRegistrySet<'_>, ) -> Result<Metadata, Error>

Convert V9 metadata into Metadata, given the necessary extra type information.

Source

pub fn from_v8( metadata: &RuntimeMetadataV8, types: &TypeRegistrySet<'_>, ) -> Result<Metadata, Error>

Convert V8 metadata into Metadata, given the necessary extra type information.

Source

pub fn types(&self) -> &PortableRegistry

Access the underlying type registry.

Source

pub fn types_mut(&mut self) -> &mut PortableRegistry

Mutable access to the underlying type registry.

Source

pub fn dispatch_error_ty(&self) -> Option<u32>

The type ID of the DispatchError type, if it exists.

Source

pub fn extrinsic(&self) -> &ExtrinsicMetadata

Return details about the extrinsic format.

Source

pub fn outer_enums(&self) -> OuterEnumsMetadata

Return details about the outer enums.

Source

pub fn pallets(&self) -> impl ExactSizeIterator

An iterator over all of the available pallets.

Source

pub fn pallet_by_call_index( &self, variant_index: u8, ) -> Option<PalletMetadata<'_>>

Access a pallet given some call/extrinsic pallet index byte

Source

pub fn pallet_by_event_index( &self, variant_index: u8, ) -> Option<PalletMetadata<'_>>

Access a pallet given some event pallet index byte

Source

pub fn pallet_by_error_index( &self, variant_index: u8, ) -> Option<PalletMetadata<'_>>

Access a pallet given some error pallet index byte

Source

pub fn pallet_by_name(&self, pallet_name: &str) -> Option<PalletMetadata<'_>>

Access a pallet given its name.

Source

pub fn runtime_api_traits(&self) -> impl ExactSizeIterator

An iterator over all of the runtime APIs.

Source

pub fn runtime_api_trait_by_name( &self, name: &str, ) -> Option<RuntimeApiMetadata<'_>>

Access a runtime API trait given its name.

Source

pub fn custom(&self) -> CustomMetadata<'_>

Returns custom user defined types

Source

pub fn hasher(&self) -> MetadataHasher<'_>

Obtain a unique hash representing this metadata or specific parts of it.

Source

pub fn type_hash(&self, id: u32) -> Option<[u8; 32]>

Get type hash for a type in the registry

Trait Implementations§

Source§

impl ConstantEntryInfo for Metadata

Source§

fn constant_entries( &self, ) -> impl Iterator<Item = Entry<Cow<'_, str>, Cow<'_, str>>>

Iterate over all of the available Constants, returning Entry as we go.
Source§

fn constant_tuples(&self) -> impl Iterator<Item = (Cow<'_, str>, Cow<'_, str>)>

Iterate over all of the available Constants, returning a pair of (pallet_name, constant_name) as we go.
Source§

fn constants_in_pallet( &self, pallet: &str, ) -> impl Iterator<Item = Cow<'_, str>>

Iterate over all of the available constants in a given pallet.
Source§

impl ConstantTypeInfo for Metadata

Source§

type TypeId = u32

The type of type IDs that we are using to obtain type information.
Source§

fn constant_info( &self, pallet_name: &str, constant_name: &str, ) -> Result<ConstantInfo<'_, <Metadata as ConstantTypeInfo>::TypeId>, ConstantInfoError<'_>>

Get information about a constant
Source§

impl CustomValueEntryInfo for Metadata

Source§

fn custom_values(&self) -> impl Iterator<Item = CustomValue<'_>>

Iterate over all of the available Custom Values, returning CustomValue as we go.
Source§

impl CustomValueTypeInfo for Metadata

Source§

type TypeId = u32

The type of type IDs that we are using to obtain type information.
Source§

fn custom_value_info( &self, name: &str, ) -> Result<CustomValueInfo<'_, <Metadata as CustomValueTypeInfo>::TypeId>, CustomValueInfoError>

Get information about a constant
Source§

impl Debug for Metadata

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Decode for Metadata

Source§

fn decode<I>(input: &mut I) -> Result<Metadata, Error>
where I: Input,

Attempt to deserialise the value from input.
Source§

fn decode_into<I>( input: &mut I, dst: &mut MaybeUninit<Self>, ) -> Result<DecodeFinished, Error>
where I: Input,

Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
Source§

fn skip<I>(input: &mut I) -> Result<(), Error>
where I: Input,

Attempt to skip the encoded value from input. Read more
Source§

fn encoded_fixed_size() -> Option<usize>

Returns the fixed encoded size of the type. Read more
Source§

impl ExtrinsicTypeInfo for Metadata

Source§

type TypeId = u32

The type of type IDs that we are using to obtain type information.
Source§

fn extrinsic_call_info_by_index( &self, pallet_index: u8, call_index: u8, ) -> Result<ExtrinsicCallInfo<'_, <Metadata as ExtrinsicTypeInfo>::TypeId>, ExtrinsicInfoError<'_>>

Get the information about the call data of a given extrinsic, given u8 indexes.
Source§

fn extrinsic_call_info_by_name( &self, pallet_name: &str, call_name: &str, ) -> Result<ExtrinsicCallInfo<'_, <Metadata as ExtrinsicTypeInfo>::TypeId>, ExtrinsicInfoError<'_>>

Get the information about the call data of a given extrinsic, given pallet and call name.
Source§

fn extrinsic_signature_info( &self, ) -> Result<ExtrinsicSignatureInfo<<Metadata as ExtrinsicTypeInfo>::TypeId>, ExtrinsicInfoError<'_>>

Get the information needed to decode or encode the extrinsic signature bytes.
Source§

fn extrinsic_extension_version_info( &self, ) -> Result<impl Iterator<Item = u8>, ExtrinsicInfoError<'_>>

Get the available transaction extension versions. Prior to runtimes supporting V5 extrinsics this should not return any entries. In runtimes supporting V5 extrinsics, 1 or more versions should be returned. Read more
Source§

fn extrinsic_extension_info( &self, extension_version: Option<u8>, ) -> Result<ExtrinsicExtensionInfo<'_, <Metadata as ExtrinsicTypeInfo>::TypeId>, ExtrinsicInfoError<'_>>

Get the information needed to decode the transaction extensions.
Source§

impl RuntimeApiEntryInfo for Metadata

Source§

fn runtime_api_entries( &self, ) -> impl Iterator<Item = Entry<Cow<'_, str>, Cow<'_, str>>>

Iterate over all of the available Runtime Apis, returning Entry as we go.
Source§

fn runtime_api_tuples( &self, ) -> impl Iterator<Item = (Cow<'_, str>, Cow<'_, str>)>

Iterate over all of the available Runtime Apis, returning a pair of (trait_name, method_name) as we go.
Source§

fn runtime_apis_in_trait( &self, pallet: &str, ) -> impl Iterator<Item = Cow<'_, str>>

Iterate over all of the available Runtime Apis in a given trait.
Source§

impl RuntimeApiTypeInfo for Metadata

Source§

type TypeId = u32

The type of type IDs that we are using to obtain type information.
Source§

fn runtime_api_info( &self, trait_name: &str, method_name: &str, ) -> Result<RuntimeApiInfo<'_, <Metadata as RuntimeApiTypeInfo>::TypeId>, RuntimeApiInfoError<'_>>

Get the information needed to encode/decode a specific Runtime API call
Source§

impl StorageEntryInfo for Metadata

Source§

fn storage_entries( &self, ) -> impl Iterator<Item = Entry<Cow<'_, str>, Cow<'_, str>>>

Iterate over all of the available Storage Entries, returning Entry as we go.
Source§

fn storage_tuples(&self) -> impl Iterator<Item = (Cow<'_, str>, Cow<'_, str>)>

Iterate over all of the available Storage Entries, returning a pair of (pallet_name, constant_name) as we go.
Source§

fn storage_in_pallet(&self, pallet: &str) -> impl Iterator<Item = Cow<'_, str>>

Iterate over all of the available Storage Entries in a given pallet.
Source§

impl StorageTypeInfo for Metadata

Source§

type TypeId = u32

The type of type IDs that we are using to obtain type information.
Source§

fn storage_info( &self, pallet_name: &str, storage_entry: &str, ) -> Result<StorageInfo<'_, <Metadata as StorageTypeInfo>::TypeId>, StorageInfoError<'_>>

Get the information needed to decode a specific storage entry key/value.
Source§

impl TryFrom<RuntimeMetadataPrefixed> for Metadata

Source§

type Error = TryFromError

The type returned in the event of a conversion error.
Source§

fn try_from( value: RuntimeMetadataPrefixed, ) -> Result<Metadata, <Metadata as TryFrom<RuntimeMetadataPrefixed>>::Error>

Performs the conversion.
Source§

impl TryFrom<RuntimeMetadataV14> for Metadata

Source§

type Error = TryFromError

The type returned in the event of a conversion error.
Source§

fn try_from(m: RuntimeMetadataV14) -> Result<Metadata, TryFromError>

Performs the conversion.
Source§

impl TryFrom<RuntimeMetadataV15> for Metadata

Source§

type Error = TryFromError

The type returned in the event of a conversion error.
Source§

fn try_from(m: RuntimeMetadataV15) -> Result<Metadata, TryFromError>

Performs the conversion.
Source§

impl TryFrom<RuntimeMetadataV16> for Metadata

Source§

type Error = TryFromError

The type returned in the event of a conversion error.
Source§

fn try_from(m: RuntimeMetadataV16) -> Result<Metadata, TryFromError>

Performs the conversion.
Source§

impl ViewFunctionEntryInfo for Metadata

Source§

fn view_function_entries( &self, ) -> impl Iterator<Item = Entry<Cow<'_, str>, Cow<'_, str>>>

Iterate over all of the available View Functions, returning Entry as we go.
Source§

fn view_function_tuples( &self, ) -> impl Iterator<Item = (Cow<'_, str>, Cow<'_, str>)>

Iterate over all of the available View Functions, returning a pair of (pallet_name, view_function_name) as we go.
Source§

fn view_functions_in_pallet( &self, pallet: &str, ) -> impl Iterator<Item = Cow<'_, str>>

Iterate over all of the available View Functions in a given pallet.
Source§

impl ViewFunctionTypeInfo for Metadata

Source§

type TypeId = u32

The type of type IDs that we are using to obtain type information.
Source§

fn view_function_info( &self, pallet_name: &str, function_name: &str, ) -> Result<ViewFunctionInfo<'_, <Metadata as ViewFunctionTypeInfo>::TypeId>, ViewFunctionInfoError<'_>>

Get the information needed to decode a specific View Function.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> DecodeAll for T
where T: Decode,

Source§

fn decode_all(input: &mut &[u8]) -> Result<T, Error>

Decode Self and consume all of the given input data. Read more
Source§

impl<T> DecodeLimit for T
where T: Decode,

Source§

fn decode_all_with_depth_limit( limit: u32, input: &mut &[u8], ) -> Result<T, Error>

Decode Self and consume all of the given input data. Read more
Source§

fn decode_with_depth_limit<I>(limit: u32, input: &mut I) -> Result<T, Error>
where I: Input,

Decode Self with the given maximum recursion depth and advance input by the number of bytes consumed. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> JsonSchemaMaybe for T

Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more