pub struct Runtime {
pub spec_version: u32,
pub transaction_version: u32,
pub ss58_format: u16,
pub is_v15: bool,
pub metadata_bytes: Vec<u8>,
pub types: PortableRegistry,
pub pallets: Vec<PalletInfo>,
pub extrinsic: ExtrinsicInfo,
pub apis: Vec<RuntimeApiInfo>,
pub outer_event_type: Option<u32>,
/* private fields */
}Expand description
One runtime’s complete metadata view.
Fields§
§spec_version: u32§transaction_version: u32§ss58_format: u16§is_v15: bool§metadata_bytes: Vec<u8>The raw MetadataVersioned blob this was parsed from (fed to the
RFC-0078 digest without re-downloading).
types: PortableRegistry§pallets: Vec<PalletInfo>§extrinsic: ExtrinsicInfo§apis: Vec<RuntimeApiInfo>§outer_event_type: Option<u32>The outer RuntimeEvent enum type id (drives the flattened event shape).
Implementations§
Source§impl Runtime
impl Runtime
Sourcepub fn decode_batch(
&self,
type_strings: &[String],
datas: &[Vec<u8>],
) -> Result<Vec<Value>, CoreError>
pub fn decode_batch( &self, type_strings: &[String], datas: &[Vec<u8>], ) -> Result<Vec<Value>, CoreError>
Decode a batch of (type string, SCALE bytes) pairs. Consecutive
duplicate type strings (the common case: one storage item’s page)
resolve to a spec once.
Sourcepub fn decode_map_page(
&self,
entry: &StorageInfo,
raw_keys: &[Vec<u8>],
raw_values: &[Vec<u8>],
fixed: usize,
) -> Result<Vec<DecodedPair>, CoreError>
pub fn decode_map_page( &self, entry: &StorageInfo, raw_keys: &[Vec<u8>], raw_values: &[Vec<u8>], fixed: usize, ) -> Result<Vec<DecodedPair>, CoreError>
Decode one page of a storage map: recover the free key components
from each full storage key (fixed leading params were part of the
queried prefix) and decode each value.
Sourcepub fn decode_map_changes(
&self,
entry: &StorageInfo,
changes: &[(String, Option<String>)],
fixed: usize,
) -> Result<Vec<DecodedPair>, CoreError>
pub fn decode_map_changes( &self, entry: &StorageInfo, changes: &[(String, Option<String>)], fixed: usize, ) -> Result<Vec<DecodedPair>, CoreError>
Like Runtime::decode_map_page, but takes the raw
state_queryStorageAt change tuples (0x-hex key/value strings;
None values — keys deleted between the key listing and the value
fetch — are skipped), so hex parsing also runs in the parallel
section.
Source§impl Runtime
impl Runtime
Sourcepub fn decode_spec(
&self,
spec: &TypeSpec,
data: &[u8],
strict: bool,
) -> Result<Value, CoreError>
pub fn decode_spec( &self, spec: &TypeSpec, data: &[u8], strict: bool, ) -> Result<Value, CoreError>
Decode data as the given type spec; errors on trailing bytes when
strict.
pub fn decode_value( &self, spec: &TypeSpec, cursor: &mut Cursor<'_>, ) -> Result<Value, CoreError>
Source§impl Runtime
impl Runtime
pub fn encode_spec( &self, spec: &TypeSpec, value: &Value, ) -> Result<Vec<u8>, CoreError>
pub fn encode_value( &self, spec: &TypeSpec, value: &Value, out: &mut Vec<u8>, ) -> Result<(), CoreError>
pub fn encode_id( &self, id: u32, value: &Value, out: &mut Vec<u8>, ) -> Result<(), CoreError>
Sourcepub fn encode_era_value(
&self,
value: &Value,
out: &mut Vec<u8>,
) -> Result<(), CoreError>
pub fn encode_era_value( &self, value: &Value, out: &mut Vec<u8>, ) -> Result<(), CoreError>
Era inputs: "00" (immortal), 0/None-like handled by caller, or
{"period": N, "current": M} / {"period": N, "phase": P}.
Source§impl Runtime
impl Runtime
Sourcepub fn signature_payload_parts(
&self,
params: &TxParams,
) -> Result<(Vec<u8>, Vec<u8>), CoreError>
pub fn signature_payload_parts( &self, params: &TxParams, ) -> Result<(Vec<u8>, Vec<u8>), CoreError>
The signature payload split at its wire seams:
(included_in_extrinsic, included_in_signed_data). Prepending the raw
call bytes gives the exact unhashed payload; hardware signers that
prove the runtime on-device need the parts separately.
Sourcepub fn signature_payload(
&self,
call_data: &[u8],
params: &TxParams,
) -> Result<Vec<u8>, CoreError>
pub fn signature_payload( &self, call_data: &[u8], params: &TxParams, ) -> Result<Vec<u8>, CoreError>
The exact bytes a signer signs for the given raw call. Payloads longer than 256 bytes are blake2b-256 hashed, per the Substrate convention.
Sourcepub fn encode_signed_extrinsic(
&self,
call_data: &[u8],
public_key: [u8; 32],
signature: &[u8],
signature_version: u8,
params: &TxParams,
) -> Result<(Vec<u8>, [u8; 32]), CoreError>
pub fn encode_signed_extrinsic( &self, call_data: &[u8], public_key: [u8; 32], signature: &[u8], signature_version: u8, params: &TxParams, ) -> Result<(Vec<u8>, [u8; 32]), CoreError>
Assemble the full signed extrinsic; returns (bytes, hash).
The metadata-hash mode must match what the payload was signed with
(the digest itself is implied data and never travels in the
extrinsic — set params.metadata_hash accordingly).
Sourcepub fn supports_mldsa_profile(&self, profile: u8) -> bool
pub fn supports_mldsa_profile(&self, profile: u8) -> bool
Detect the explicit ML-DSA registration variant on the original call. Presence of HashedAccounts alone does not imply ML-DSA support.
pub fn supports_mldsa_accounts(&self) -> bool
Source§impl Runtime
impl Runtime
Sourcepub fn storage_key(
&self,
entry: &StorageInfo,
params: &[Value],
) -> Result<Vec<u8>, CoreError>
pub fn storage_key( &self, entry: &StorageInfo, params: &[Value], ) -> Result<Vec<u8>, CoreError>
The full storage key for one item; params may be a partial prefix
(for map iteration).
Sourcepub fn decode_storage_key_params(
&self,
entry: &StorageInfo,
key: &[u8],
fixed: usize,
) -> Result<Vec<Value>, CoreError>
pub fn decode_storage_key_params( &self, entry: &StorageInfo, key: &[u8], fixed: usize, ) -> Result<Vec<Value>, CoreError>
Recover the free map-key components from one full storage key.
fixed is how many leading params were fixed in the queried prefix;
the remaining components decode from the key’s trailing bytes
(reversible hashers only).
Source§impl Runtime
impl Runtime
Sourcepub fn parse(
metadata_bytes: &[u8],
spec_version: u32,
transaction_version: u32,
ss58_format: u16,
) -> Result<Self, CoreError>
pub fn parse( metadata_bytes: &[u8], spec_version: u32, transaction_version: u32, ss58_format: u16, ) -> Result<Self, CoreError>
Parse a raw MetadataVersioned blob (magic meta + version byte +
V14/V15 payload — what state_getMetadata / Metadata_metadata_at_version
return, unwrapped).
pub fn pallet(&self, name: &str) -> Option<&PalletInfo>
pub fn pallet_at(&self, index: u8) -> Option<&PalletInfo>
pub fn storage_entry(&self, pallet: &str, name: &str) -> Option<&StorageInfo>
pub fn constant(&self, pallet: &str, name: &str) -> Option<&ConstantInfo>
pub fn type_id_of(&self, name: &str) -> Option<u32>
pub fn type_name_of(&self, id: u32) -> Option<&str>
pub fn resolve(&self, id: u32) -> Result<&Type<PortableForm>, CoreError>
Sourcepub fn type_ident(&self, id: u32) -> String
pub fn type_ident(&self, id: u32) -> String
A short, human-facing identity for a registry type: the last segment
of its path (e.g. “TaoBalance”, “NetUid”, “AccountId32”), with
Option’s payload kept (Option<Timepoint>). Path-less types render
structurally: “u64”, “Vec
This is what the codegen IR carries per call parameter, so generated builders can surface newtype identity (a TaoBalance argument vs a bare u64) even though the wire encoding is the inner value.
Sourcepub fn registry_json(&self) -> Result<String, CoreError>
pub fn registry_json(&self) -> Result<String, CoreError>
The portable registry as JSON ({"types": [{"id", "type": {...}}]}).
For registry-walking tooling (the shape-corpus recorder); not a hot path.
Auto Trait Implementations§
impl Forget for Runtime
impl Freeze for Runtime
impl Move for Runtime
impl RefUnwindSafe for Runtime
impl Send for Runtime
impl Sync for Runtime
impl Unpin for Runtime
impl UnsafeUnpin for Runtime
impl UnwindSafe for Runtime
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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 moreimpl<T> JsonSchemaMaybe for T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
Source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from.