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

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<Self, Error>

This is essentially an alias for <Metadata as codec::Decode>::decode(&mut bytes)

Source

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

Convert V16 metadata into Metadata.

Source

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

Convert V15 metadata into Metadata.

Source

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

Convert V14 metadata into Metadata.

Source

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

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

Source

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

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

Source

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

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

Source

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

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

Source

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

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

Source

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

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<Item = PalletMetadata<'_>>

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<Item = RuntimeApiMetadata<'_>>

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 = ConstantEntry<'_>>

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<'_, Self::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<'_, Self::TypeId>, CustomValueInfoError>

Get information about a constant
Source§

impl Debug for Metadata

Source§

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

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

impl Decode for Metadata

Source§

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

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( &self, pallet_index: u8, call_index: u8, ) -> Result<ExtrinsicCallInfo<'_, Self::TypeId>, ExtrinsicInfoError<'_>>

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

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

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

fn extrinsic_extension_info( &self, extension_version: Option<u8>, ) -> Result<ExtrinsicExtensionInfo<'_, Self::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 = RuntimeApiEntry<'_>>

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<'_, Self::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 = StorageEntry<'_>>

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<'_, Self::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<Self, Self::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<Self, 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<Self, 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<Self, TryFromError>

Performs the conversion.
Source§

impl ViewFunctionEntryInfo for Metadata

Source§

fn view_function_entries(&self) -> impl Iterator<Item = ViewFunctionEntry<'_>>

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<'_, Self::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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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<T> JsonSchemaMaybe for T