mirror of
https://github.com/pezkuwichain/pezframe-metadata.git
synced 2026-06-14 02:51:11 +00:00
add no_std support (#42)
* Metadata supporting scale-info can be decoded and serialized in no_std (#2) * Metadata supporting scale-info can be decoded and serialized in no_std (feature flag scale_info) * Changes from review: rename feature flag into full_derive * Changes from review: std implies full-derive * Changes from review: optimization Co-authored-by: echevrier <edith.chevrier@scs.ch> * split full_derive into decode and sered_codec features. (drop new Debug impls) * cargo fmt * rename serde_codec to serde_full * Prior to v14 everything was Debug. Are there any downsides? Unused debug impls will just get optimised away won't they? * rust fmt * Debug for the masses. Make it work for no_std * check all combos of features (if this plays well with ci then we should double up, doing the same again but target wasm32) * all wasm feature combos Co-authored-by: echevrier <84318241+echevrier@users.noreply.github.com> Co-authored-by: echevrier <edith.chevrier@scs.ch>
This commit is contained in:
+19
-28
@@ -69,12 +69,20 @@ jobs:
|
|||||||
- name: Add WASM Utilities
|
- name: Add WASM Utilities
|
||||||
run: rustup target add wasm32-unknown-unknown --toolchain stable
|
run: rustup target add wasm32-unknown-unknown --toolchain stable
|
||||||
## Check Stage
|
## Check Stage
|
||||||
- name: Checking wasm32
|
- name: Checking wasm32 (v14)
|
||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
|
uses: taiki-e/install-action@cargo-hack
|
||||||
with:
|
with:
|
||||||
command: check
|
command: hack
|
||||||
toolchain: stable
|
toolchain: stable
|
||||||
args: --manifest-path ./frame-metadata/Cargo.toml --target wasm32-unknown-unknown --no-default-features
|
args: check --manifest-path ./frame-metadata/Cargo.toml --feature-powerset --no-dev-deps --features v14 --skip legacy,v8,v9,v10,v11,v12,v13 --depth 4 --target wasm32-unknown-unknown
|
||||||
|
- name: Checking wasm32 (all features)
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
uses: taiki-e/install-action@cargo-hack
|
||||||
|
with:
|
||||||
|
command: hack
|
||||||
|
toolchain: stable
|
||||||
|
args: check --manifest-path ./frame-metadata/Cargo.toml --feature-powerset --no-dev-deps --skip decode,serde_full --depth 4 --target wasm32-unknown-unknown
|
||||||
|
|
||||||
check-features:
|
check-features:
|
||||||
name: Check Features
|
name: Check Features
|
||||||
@@ -92,34 +100,17 @@ jobs:
|
|||||||
fetch-depth: 5
|
fetch-depth: 5
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
## Check Stage
|
## Check Stage
|
||||||
- name: Checking without any features
|
- name: Checking v14 feature combinations (native)
|
||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
|
uses: taiki-e/install-action@cargo-hack
|
||||||
with:
|
with:
|
||||||
command: check
|
command: hack
|
||||||
toolchain: stable
|
toolchain: stable
|
||||||
args: --manifest-path ./frame-metadata/Cargo.toml --no-default-features
|
args: check --manifest-path ./frame-metadata/Cargo.toml --feature-powerset --no-dev-deps --features v14 --skip legacy,v8,v9,v10,v11,v12,v13 --depth 4
|
||||||
- name: Checking v12
|
- name: Checking feature combinations excluding decode/serde_full (native)
|
||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
|
uses: taiki-e/install-action@cargo-hack
|
||||||
with:
|
with:
|
||||||
command: check
|
command: hack
|
||||||
toolchain: stable
|
toolchain: stable
|
||||||
args: --manifest-path ./frame-metadata/Cargo.toml --no-default-features --features v12
|
args: check --manifest-path ./frame-metadata/Cargo.toml --feature-powerset --no-dev-deps --skip decode,serde_full --depth 4
|
||||||
- name: Checking v13
|
|
||||||
uses: actions-rs/cargo@v1
|
|
||||||
with:
|
|
||||||
command: check
|
|
||||||
toolchain: stable
|
|
||||||
args: --manifest-path ./frame-metadata/Cargo.toml --no-default-features --features v13
|
|
||||||
- name: Checking v14
|
|
||||||
uses: actions-rs/cargo@v1
|
|
||||||
with:
|
|
||||||
command: check
|
|
||||||
toolchain: stable
|
|
||||||
args: --manifest-path ./frame-metadata/Cargo.toml --no-default-features --features v14
|
|
||||||
- name: Checking all versions
|
|
||||||
uses: actions-rs/cargo@v1
|
|
||||||
with:
|
|
||||||
command: check
|
|
||||||
toolchain: stable
|
|
||||||
args: --manifest-path ./frame-metadata/Cargo.toml --no-default-features --features v12,v13,v14
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"]
|
|||||||
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
|
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
|
||||||
cfg-if = "1.0.0"
|
cfg-if = "1.0.0"
|
||||||
scale-info = { version = "2.0.0", default-features = false, optional = true, features = ["derive"] }
|
scale-info = { version = "2.0.0", default-features = false, optional = true, features = ["derive"] }
|
||||||
serde = { version = "1.0.101", optional = true, features = ["derive"] }
|
serde = { version = "1.0.101", default-features = false, optional = true, features = ["derive"] }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["std", "v14"]
|
default = ["std", "v14"]
|
||||||
@@ -28,10 +28,20 @@ v12 = []
|
|||||||
v13 = []
|
v13 = []
|
||||||
legacy = ["v13", "v12", "v11", "v10", "v9", "v8"]
|
legacy = ["v13", "v12", "v11", "v10", "v9", "v8"]
|
||||||
v14 = ["scale-info"]
|
v14 = ["scale-info"]
|
||||||
|
|
||||||
|
# Serde support without relying on std features
|
||||||
|
serde_full = [
|
||||||
|
"scale-info/serde",
|
||||||
|
"serde",
|
||||||
|
"serde/alloc",
|
||||||
|
]
|
||||||
|
# Scale decode support without relying on std features
|
||||||
|
decode = ["scale-info/decode"]
|
||||||
|
|
||||||
std = [
|
std = [
|
||||||
|
"decode",
|
||||||
|
"serde_full",
|
||||||
"codec/std",
|
"codec/std",
|
||||||
"scale-info/std",
|
"scale-info/std",
|
||||||
"scale-info/serde",
|
"serde/std",
|
||||||
"scale-info/decode",
|
|
||||||
"serde",
|
|
||||||
]
|
]
|
||||||
|
|||||||
+33
-16
@@ -19,15 +19,29 @@
|
|||||||
|
|
||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
#![warn(missing_docs)]
|
#![warn(missing_docs)]
|
||||||
|
#[cfg(all(
|
||||||
|
any(feature = "decode", feature = "serde_full"),
|
||||||
|
any(
|
||||||
|
feature = "v13",
|
||||||
|
feature = "v12",
|
||||||
|
feature = "v11",
|
||||||
|
feature = "v10",
|
||||||
|
feature = "v9",
|
||||||
|
feature = "v8",
|
||||||
|
feature = "legacy"
|
||||||
|
),
|
||||||
|
not(feature = "std")
|
||||||
|
))]
|
||||||
|
compile_error!("decode and serde_full features prior to v14 require std");
|
||||||
|
|
||||||
|
#[cfg(feature = "serde_full")]
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[cfg(feature = "decode")]
|
||||||
|
use codec::{Decode, Error, Input};
|
||||||
|
|
||||||
cfg_if::cfg_if! {
|
cfg_if::cfg_if! {
|
||||||
if #[cfg(feature = "std")] {
|
if #[cfg(not(feature = "std"))] {
|
||||||
use codec::{Decode, Error, Input};
|
|
||||||
use serde::{
|
|
||||||
Deserialize,
|
|
||||||
Serialize,
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
extern crate alloc;
|
extern crate alloc;
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
}
|
}
|
||||||
@@ -82,8 +96,9 @@ pub mod v14;
|
|||||||
pub use self::v14::*;
|
pub use self::v14::*;
|
||||||
|
|
||||||
/// Metadata prefixed by a u32 for reserved usage
|
/// Metadata prefixed by a u32 for reserved usage
|
||||||
#[derive(Eq, Encode, PartialEq)]
|
#[derive(Eq, Encode, PartialEq, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "decode", derive(Decode))]
|
||||||
|
#[cfg_attr(feature = "serde_full", derive(Serialize))]
|
||||||
pub struct RuntimeMetadataPrefixed(pub u32, pub RuntimeMetadata);
|
pub struct RuntimeMetadataPrefixed(pub u32, pub RuntimeMetadata);
|
||||||
|
|
||||||
impl Into<Vec<u8>> for RuntimeMetadataPrefixed {
|
impl Into<Vec<u8>> for RuntimeMetadataPrefixed {
|
||||||
@@ -95,8 +110,9 @@ impl Into<Vec<u8>> for RuntimeMetadataPrefixed {
|
|||||||
/// The metadata of a runtime.
|
/// The metadata of a runtime.
|
||||||
/// The version ID encoded/decoded through
|
/// The version ID encoded/decoded through
|
||||||
/// the enum nature of `RuntimeMetadata`.
|
/// the enum nature of `RuntimeMetadata`.
|
||||||
#[derive(Eq, Encode, PartialEq)]
|
#[derive(Eq, Encode, PartialEq, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "decode", derive(Decode))]
|
||||||
|
#[cfg_attr(feature = "serde_full", derive(Serialize))]
|
||||||
pub enum RuntimeMetadata {
|
pub enum RuntimeMetadata {
|
||||||
/// Unused; enum filler.
|
/// Unused; enum filler.
|
||||||
V0(RuntimeMetadataDeprecated),
|
V0(RuntimeMetadataDeprecated),
|
||||||
@@ -182,13 +198,14 @@ impl RuntimeMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Stores the encoded `RuntimeMetadata` as raw bytes.
|
/// Stores the encoded `RuntimeMetadata` as raw bytes.
|
||||||
#[derive(Encode, Eq, PartialEq)]
|
#[derive(Encode, Eq, PartialEq, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Deserialize, Debug))]
|
#[cfg_attr(feature = "decode", derive(Decode))]
|
||||||
|
#[cfg_attr(feature = "serde_full", derive(Serialize, Deserialize))]
|
||||||
pub struct OpaqueMetadata(pub Vec<u8>);
|
pub struct OpaqueMetadata(pub Vec<u8>);
|
||||||
|
|
||||||
/// Enum that should fail.
|
/// Enum that should fail.
|
||||||
#[derive(Eq, PartialEq)]
|
#[derive(Eq, PartialEq, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))]
|
#[cfg_attr(feature = "serde_full", derive(Serialize, Deserialize))]
|
||||||
pub enum RuntimeMetadataDeprecated {}
|
pub enum RuntimeMetadataDeprecated {}
|
||||||
|
|
||||||
impl Encode for RuntimeMetadataDeprecated {
|
impl Encode for RuntimeMetadataDeprecated {
|
||||||
@@ -197,7 +214,7 @@ impl Encode for RuntimeMetadataDeprecated {
|
|||||||
|
|
||||||
impl codec::EncodeLike for RuntimeMetadataDeprecated {}
|
impl codec::EncodeLike for RuntimeMetadataDeprecated {}
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "decode")]
|
||||||
impl Decode for RuntimeMetadataDeprecated {
|
impl Decode for RuntimeMetadataDeprecated {
|
||||||
fn decode<I: Input>(_input: &mut I) -> Result<Self, Error> {
|
fn decode<I: Input>(_input: &mut I) -> Result<Self, Error> {
|
||||||
Err("Decoding is not supported".into())
|
Err("Decoding is not supported".into())
|
||||||
|
|||||||
+26
-26
@@ -43,8 +43,8 @@ cfg_if::cfg_if! {
|
|||||||
pub const META_RESERVED: u32 = 0x6174656d; // 'meta' warn endianness
|
pub const META_RESERVED: u32 = 0x6174656d; // 'meta' warn endianness
|
||||||
|
|
||||||
/// All the metadata about a function.
|
/// All the metadata about a function.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct FunctionMetadata {
|
pub struct FunctionMetadata {
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
pub arguments: DecodeDifferentArray<FunctionArgumentMetadata>,
|
pub arguments: DecodeDifferentArray<FunctionArgumentMetadata>,
|
||||||
@@ -52,16 +52,16 @@ pub struct FunctionMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// All the metadata about a function argument.
|
/// All the metadata about a function argument.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct FunctionArgumentMetadata {
|
pub struct FunctionArgumentMetadata {
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
pub ty: DecodeDifferentStr,
|
pub ty: DecodeDifferentStr,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// All the metadata about an outer event.
|
/// All the metadata about an outer event.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct OuterEventMetadata {
|
pub struct OuterEventMetadata {
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
pub events: DecodeDifferentArray<
|
pub events: DecodeDifferentArray<
|
||||||
@@ -71,8 +71,8 @@ pub struct OuterEventMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// All the metadata about an event.
|
/// All the metadata about an event.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct EventMetadata {
|
pub struct EventMetadata {
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
pub arguments: DecodeDifferentArray<&'static str, StringBuf>,
|
pub arguments: DecodeDifferentArray<&'static str, StringBuf>,
|
||||||
@@ -80,8 +80,8 @@ pub struct EventMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// All the metadata about one storage entry.
|
/// All the metadata about one storage entry.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct StorageEntryMetadata {
|
pub struct StorageEntryMetadata {
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
pub modifier: StorageEntryModifier,
|
pub modifier: StorageEntryModifier,
|
||||||
@@ -91,8 +91,8 @@ pub struct StorageEntryMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// All the metadata about one module constant.
|
/// All the metadata about one module constant.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct ModuleConstantMetadata {
|
pub struct ModuleConstantMetadata {
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
pub ty: DecodeDifferentStr,
|
pub ty: DecodeDifferentStr,
|
||||||
@@ -101,8 +101,8 @@ pub struct ModuleConstantMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// All the metadata about a module error.
|
/// All the metadata about a module error.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct ErrorMetadata {
|
pub struct ErrorMetadata {
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
pub documentation: DecodeDifferentArray<&'static str, StringBuf>,
|
pub documentation: DecodeDifferentArray<&'static str, StringBuf>,
|
||||||
@@ -166,8 +166,8 @@ impl core::fmt::Debug for DefaultByteGetter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Hasher used by storage maps
|
/// Hasher used by storage maps
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub enum StorageHasher {
|
pub enum StorageHasher {
|
||||||
Blake2_128,
|
Blake2_128,
|
||||||
Blake2_256,
|
Blake2_256,
|
||||||
@@ -178,8 +178,8 @@ pub enum StorageHasher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A storage entry type.
|
/// A storage entry type.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub enum StorageEntryType {
|
pub enum StorageEntryType {
|
||||||
Plain(DecodeDifferentStr),
|
Plain(DecodeDifferentStr),
|
||||||
Map {
|
Map {
|
||||||
@@ -202,16 +202,16 @@ pub enum StorageEntryType {
|
|||||||
///
|
///
|
||||||
/// `Optional` means you should expect an `Option<T>`, with `None` returned if the key is not present.
|
/// `Optional` means you should expect an `Option<T>`, with `None` returned if the key is not present.
|
||||||
/// `Default` means you should expect a `T` with the default value of default if the key is not present.
|
/// `Default` means you should expect a `T` with the default value of default if the key is not present.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub enum StorageEntryModifier {
|
pub enum StorageEntryModifier {
|
||||||
Optional,
|
Optional,
|
||||||
Default,
|
Default,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// All metadata of the storage.
|
/// All metadata of the storage.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct StorageMetadata {
|
pub struct StorageMetadata {
|
||||||
/// The common prefix used by all storage entries.
|
/// The common prefix used by all storage entries.
|
||||||
pub prefix: DecodeDifferent<&'static str, StringBuf>,
|
pub prefix: DecodeDifferent<&'static str, StringBuf>,
|
||||||
@@ -219,15 +219,15 @@ pub struct StorageMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The metadata of a runtime.
|
/// The metadata of a runtime.
|
||||||
#[derive(Eq, Encode, PartialEq)]
|
#[derive(Eq, Encode, PartialEq, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct RuntimeMetadataV10 {
|
pub struct RuntimeMetadataV10 {
|
||||||
pub modules: DecodeDifferentArray<ModuleMetadata>,
|
pub modules: DecodeDifferentArray<ModuleMetadata>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// All metadata about an runtime module.
|
/// All metadata about an runtime module.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct ModuleMetadata {
|
pub struct ModuleMetadata {
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
pub storage: Option<DecodeDifferent<FnEncode<StorageMetadata>, StorageMetadata>>,
|
pub storage: Option<DecodeDifferent<FnEncode<StorageMetadata>, StorageMetadata>>,
|
||||||
|
|||||||
+28
-28
@@ -43,8 +43,8 @@ cfg_if::cfg_if! {
|
|||||||
pub const META_RESERVED: u32 = 0x6174656d; // 'meta' warn endianness
|
pub const META_RESERVED: u32 = 0x6174656d; // 'meta' warn endianness
|
||||||
|
|
||||||
/// All the metadata about a function.
|
/// All the metadata about a function.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct FunctionMetadata {
|
pub struct FunctionMetadata {
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
pub arguments: DecodeDifferentArray<FunctionArgumentMetadata>,
|
pub arguments: DecodeDifferentArray<FunctionArgumentMetadata>,
|
||||||
@@ -52,16 +52,16 @@ pub struct FunctionMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// All the metadata about a function argument.
|
/// All the metadata about a function argument.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct FunctionArgumentMetadata {
|
pub struct FunctionArgumentMetadata {
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
pub ty: DecodeDifferentStr,
|
pub ty: DecodeDifferentStr,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// All the metadata about an outer event.
|
/// All the metadata about an outer event.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct OuterEventMetadata {
|
pub struct OuterEventMetadata {
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
pub events: DecodeDifferentArray<
|
pub events: DecodeDifferentArray<
|
||||||
@@ -71,8 +71,8 @@ pub struct OuterEventMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// All the metadata about an event.
|
/// All the metadata about an event.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct EventMetadata {
|
pub struct EventMetadata {
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
pub arguments: DecodeDifferentArray<&'static str, StringBuf>,
|
pub arguments: DecodeDifferentArray<&'static str, StringBuf>,
|
||||||
@@ -80,8 +80,8 @@ pub struct EventMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// All the metadata about one storage entry.
|
/// All the metadata about one storage entry.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct StorageEntryMetadata {
|
pub struct StorageEntryMetadata {
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
pub modifier: StorageEntryModifier,
|
pub modifier: StorageEntryModifier,
|
||||||
@@ -91,8 +91,8 @@ pub struct StorageEntryMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// All the metadata about one module constant.
|
/// All the metadata about one module constant.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct ModuleConstantMetadata {
|
pub struct ModuleConstantMetadata {
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
pub ty: DecodeDifferentStr,
|
pub ty: DecodeDifferentStr,
|
||||||
@@ -101,8 +101,8 @@ pub struct ModuleConstantMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// All the metadata about a module error.
|
/// All the metadata about a module error.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct ErrorMetadata {
|
pub struct ErrorMetadata {
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
pub documentation: DecodeDifferentArray<&'static str, StringBuf>,
|
pub documentation: DecodeDifferentArray<&'static str, StringBuf>,
|
||||||
@@ -166,8 +166,8 @@ impl core::fmt::Debug for DefaultByteGetter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Hasher used by storage maps
|
/// Hasher used by storage maps
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub enum StorageHasher {
|
pub enum StorageHasher {
|
||||||
Blake2_128,
|
Blake2_128,
|
||||||
Blake2_256,
|
Blake2_256,
|
||||||
@@ -179,8 +179,8 @@ pub enum StorageHasher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A storage entry type.
|
/// A storage entry type.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub enum StorageEntryType {
|
pub enum StorageEntryType {
|
||||||
Plain(DecodeDifferentStr),
|
Plain(DecodeDifferentStr),
|
||||||
Map {
|
Map {
|
||||||
@@ -204,16 +204,16 @@ pub enum StorageEntryType {
|
|||||||
///
|
///
|
||||||
/// `Optional` means you should expect an `Option<T>`, with `None` returned if the key is not present.
|
/// `Optional` means you should expect an `Option<T>`, with `None` returned if the key is not present.
|
||||||
/// `Default` means you should expect a `T` with the default value of default if the key is not present.
|
/// `Default` means you should expect a `T` with the default value of default if the key is not present.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub enum StorageEntryModifier {
|
pub enum StorageEntryModifier {
|
||||||
Optional,
|
Optional,
|
||||||
Default,
|
Default,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// All metadata of the storage.
|
/// All metadata of the storage.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct StorageMetadata {
|
pub struct StorageMetadata {
|
||||||
/// The common prefix used by all storage entries.
|
/// The common prefix used by all storage entries.
|
||||||
pub prefix: DecodeDifferent<&'static str, StringBuf>,
|
pub prefix: DecodeDifferent<&'static str, StringBuf>,
|
||||||
@@ -221,8 +221,8 @@ pub struct StorageMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Metadata of the extrinsic used by the runtime.
|
/// Metadata of the extrinsic used by the runtime.
|
||||||
#[derive(Eq, Encode, PartialEq)]
|
#[derive(Eq, Encode, PartialEq, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct ExtrinsicMetadata {
|
pub struct ExtrinsicMetadata {
|
||||||
/// Extrinsic version.
|
/// Extrinsic version.
|
||||||
pub version: u8,
|
pub version: u8,
|
||||||
@@ -231,8 +231,8 @@ pub struct ExtrinsicMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The metadata of a runtime.
|
/// The metadata of a runtime.
|
||||||
#[derive(Eq, Encode, PartialEq)]
|
#[derive(Eq, Encode, PartialEq, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct RuntimeMetadataV11 {
|
pub struct RuntimeMetadataV11 {
|
||||||
/// Metadata of all the modules.
|
/// Metadata of all the modules.
|
||||||
pub modules: DecodeDifferentArray<ModuleMetadata>,
|
pub modules: DecodeDifferentArray<ModuleMetadata>,
|
||||||
@@ -241,8 +241,8 @@ pub struct RuntimeMetadataV11 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// All metadata about an runtime module.
|
/// All metadata about an runtime module.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct ModuleMetadata {
|
pub struct ModuleMetadata {
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
pub storage: Option<DecodeDifferent<FnEncode<StorageMetadata>, StorageMetadata>>,
|
pub storage: Option<DecodeDifferent<FnEncode<StorageMetadata>, StorageMetadata>>,
|
||||||
|
|||||||
+28
-28
@@ -43,8 +43,8 @@ cfg_if::cfg_if! {
|
|||||||
pub const META_RESERVED: u32 = 0x6174656d; // 'meta' warn endianness
|
pub const META_RESERVED: u32 = 0x6174656d; // 'meta' warn endianness
|
||||||
|
|
||||||
/// Metadata about a function.
|
/// Metadata about a function.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct FunctionMetadata {
|
pub struct FunctionMetadata {
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
pub arguments: DecodeDifferentArray<FunctionArgumentMetadata>,
|
pub arguments: DecodeDifferentArray<FunctionArgumentMetadata>,
|
||||||
@@ -52,16 +52,16 @@ pub struct FunctionMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Metadata about a function argument.
|
/// Metadata about a function argument.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct FunctionArgumentMetadata {
|
pub struct FunctionArgumentMetadata {
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
pub ty: DecodeDifferentStr,
|
pub ty: DecodeDifferentStr,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Metadata about an outer event.
|
/// Metadata about an outer event.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct OuterEventMetadata {
|
pub struct OuterEventMetadata {
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
pub events: DecodeDifferentArray<
|
pub events: DecodeDifferentArray<
|
||||||
@@ -71,8 +71,8 @@ pub struct OuterEventMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Metadata about an event.
|
/// Metadata about an event.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct EventMetadata {
|
pub struct EventMetadata {
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
pub arguments: DecodeDifferentArray<&'static str, StringBuf>,
|
pub arguments: DecodeDifferentArray<&'static str, StringBuf>,
|
||||||
@@ -80,8 +80,8 @@ pub struct EventMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Metadata about one storage entry.
|
/// Metadata about one storage entry.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct StorageEntryMetadata {
|
pub struct StorageEntryMetadata {
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
pub modifier: StorageEntryModifier,
|
pub modifier: StorageEntryModifier,
|
||||||
@@ -91,8 +91,8 @@ pub struct StorageEntryMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Metadata about one module constant.
|
/// Metadata about one module constant.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct ModuleConstantMetadata {
|
pub struct ModuleConstantMetadata {
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
pub ty: DecodeDifferentStr,
|
pub ty: DecodeDifferentStr,
|
||||||
@@ -101,8 +101,8 @@ pub struct ModuleConstantMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Metadata about a module error.
|
/// Metadata about a module error.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct ErrorMetadata {
|
pub struct ErrorMetadata {
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
pub documentation: DecodeDifferentArray<&'static str, StringBuf>,
|
pub documentation: DecodeDifferentArray<&'static str, StringBuf>,
|
||||||
@@ -166,8 +166,8 @@ impl core::fmt::Debug for DefaultByteGetter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Hasher used by storage maps
|
/// Hasher used by storage maps
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub enum StorageHasher {
|
pub enum StorageHasher {
|
||||||
Blake2_128,
|
Blake2_128,
|
||||||
Blake2_256,
|
Blake2_256,
|
||||||
@@ -179,8 +179,8 @@ pub enum StorageHasher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A storage entry type.
|
/// A storage entry type.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub enum StorageEntryType {
|
pub enum StorageEntryType {
|
||||||
Plain(DecodeDifferentStr),
|
Plain(DecodeDifferentStr),
|
||||||
Map {
|
Map {
|
||||||
@@ -204,16 +204,16 @@ pub enum StorageEntryType {
|
|||||||
///
|
///
|
||||||
/// `Optional` means you should expect an `Option<T>`, with `None` returned if the key is not present.
|
/// `Optional` means you should expect an `Option<T>`, with `None` returned if the key is not present.
|
||||||
/// `Default` means you should expect a `T` with the default value of default if the key is not present.
|
/// `Default` means you should expect a `T` with the default value of default if the key is not present.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub enum StorageEntryModifier {
|
pub enum StorageEntryModifier {
|
||||||
Optional,
|
Optional,
|
||||||
Default,
|
Default,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// All metadata of the storage.
|
/// All metadata of the storage.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct StorageMetadata {
|
pub struct StorageMetadata {
|
||||||
/// The common prefix used by all storage entries.
|
/// The common prefix used by all storage entries.
|
||||||
pub prefix: DecodeDifferent<&'static str, StringBuf>,
|
pub prefix: DecodeDifferent<&'static str, StringBuf>,
|
||||||
@@ -221,8 +221,8 @@ pub struct StorageMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Metadata of the extrinsic used by the runtime.
|
/// Metadata of the extrinsic used by the runtime.
|
||||||
#[derive(Eq, Encode, PartialEq)]
|
#[derive(Eq, Encode, PartialEq, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct ExtrinsicMetadata {
|
pub struct ExtrinsicMetadata {
|
||||||
/// Extrinsic version.
|
/// Extrinsic version.
|
||||||
pub version: u8,
|
pub version: u8,
|
||||||
@@ -231,8 +231,8 @@ pub struct ExtrinsicMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The metadata of a runtime.
|
/// The metadata of a runtime.
|
||||||
#[derive(Eq, Encode, PartialEq)]
|
#[derive(Eq, Encode, PartialEq, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct RuntimeMetadataV12 {
|
pub struct RuntimeMetadataV12 {
|
||||||
/// Metadata of all the modules.
|
/// Metadata of all the modules.
|
||||||
pub modules: DecodeDifferentArray<ModuleMetadata>,
|
pub modules: DecodeDifferentArray<ModuleMetadata>,
|
||||||
@@ -241,8 +241,8 @@ pub struct RuntimeMetadataV12 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// All metadata about an runtime module.
|
/// All metadata about an runtime module.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct ModuleMetadata {
|
pub struct ModuleMetadata {
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
pub storage: Option<DecodeDifferent<FnEncode<StorageMetadata>, StorageMetadata>>,
|
pub storage: Option<DecodeDifferent<FnEncode<StorageMetadata>, StorageMetadata>>,
|
||||||
|
|||||||
+52
-41
@@ -15,12 +15,10 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
cfg_if::cfg_if! {
|
#[cfg(feature = "decode")]
|
||||||
if #[cfg(feature = "std")] {
|
use codec::Decode;
|
||||||
use codec::Decode;
|
#[cfg(feature = "serde_full")]
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
use super::RuntimeMetadataPrefixed;
|
use super::RuntimeMetadataPrefixed;
|
||||||
use codec::Encode;
|
use codec::Encode;
|
||||||
@@ -43,8 +41,9 @@ impl From<RuntimeMetadataLastVersion> for super::RuntimeMetadataPrefixed {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The metadata of a runtime.
|
/// The metadata of a runtime.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "decode", derive(Decode))]
|
||||||
|
#[cfg_attr(feature = "serde_full", derive(Serialize))]
|
||||||
pub struct RuntimeMetadataV14 {
|
pub struct RuntimeMetadataV14 {
|
||||||
/// Type registry containing all types used in the metadata.
|
/// Type registry containing all types used in the metadata.
|
||||||
pub types: PortableRegistry,
|
pub types: PortableRegistry,
|
||||||
@@ -77,10 +76,11 @@ impl RuntimeMetadataV14 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Metadata of the extrinsic used by the runtime.
|
/// Metadata of the extrinsic used by the runtime.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "decode", derive(Decode))]
|
||||||
|
#[cfg_attr(feature = "serde_full", derive(Serialize))]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "std",
|
feature = "serde_full",
|
||||||
serde(bound(serialize = "T::Type: Serialize, T::String: Serialize"))
|
serde(bound(serialize = "T::Type: Serialize, T::String: Serialize"))
|
||||||
)]
|
)]
|
||||||
pub struct ExtrinsicMetadata<T: Form = MetaForm> {
|
pub struct ExtrinsicMetadata<T: Form = MetaForm> {
|
||||||
@@ -105,10 +105,11 @@ impl IntoPortable for ExtrinsicMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Metadata of an extrinsic's signed extension.
|
/// Metadata of an extrinsic's signed extension.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "decode", derive(Decode))]
|
||||||
|
#[cfg_attr(feature = "serde_full", derive(Serialize))]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "std",
|
feature = "serde_full",
|
||||||
serde(bound(serialize = "T::Type: Serialize, T::String: Serialize"))
|
serde(bound(serialize = "T::Type: Serialize, T::String: Serialize"))
|
||||||
)]
|
)]
|
||||||
pub struct SignedExtensionMetadata<T: Form = MetaForm> {
|
pub struct SignedExtensionMetadata<T: Form = MetaForm> {
|
||||||
@@ -133,10 +134,11 @@ impl IntoPortable for SignedExtensionMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// All metadata about an runtime pallet.
|
/// All metadata about an runtime pallet.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "decode", derive(Decode))]
|
||||||
|
#[cfg_attr(feature = "serde_full", derive(Serialize))]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "std",
|
feature = "serde_full",
|
||||||
serde(bound(serialize = "T::Type: Serialize, T::String: Serialize"))
|
serde(bound(serialize = "T::Type: Serialize, T::String: Serialize"))
|
||||||
)]
|
)]
|
||||||
pub struct PalletMetadata<T: Form = MetaForm> {
|
pub struct PalletMetadata<T: Form = MetaForm> {
|
||||||
@@ -174,10 +176,11 @@ impl IntoPortable for PalletMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// All metadata of the pallet's storage.
|
/// All metadata of the pallet's storage.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "decode", derive(Decode))]
|
||||||
|
#[cfg_attr(feature = "serde_full", derive(Serialize))]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "std",
|
feature = "serde_full",
|
||||||
serde(bound(serialize = "T::Type: Serialize, T::String: Serialize"))
|
serde(bound(serialize = "T::Type: Serialize, T::String: Serialize"))
|
||||||
)]
|
)]
|
||||||
pub struct PalletStorageMetadata<T: Form = MetaForm> {
|
pub struct PalletStorageMetadata<T: Form = MetaForm> {
|
||||||
@@ -199,10 +202,11 @@ impl IntoPortable for PalletStorageMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Metadata about one storage entry.
|
/// Metadata about one storage entry.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "decode", derive(Decode))]
|
||||||
|
#[cfg_attr(feature = "serde_full", derive(Serialize))]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "std",
|
feature = "serde_full",
|
||||||
serde(bound(serialize = "T::Type: Serialize, T::String: Serialize"))
|
serde(bound(serialize = "T::Type: Serialize, T::String: Serialize"))
|
||||||
)]
|
)]
|
||||||
pub struct StorageEntryMetadata<T: Form = MetaForm> {
|
pub struct StorageEntryMetadata<T: Form = MetaForm> {
|
||||||
@@ -237,8 +241,9 @@ impl IntoPortable for StorageEntryMetadata {
|
|||||||
///
|
///
|
||||||
/// `Optional` means you should expect an `Option<T>`, with `None` returned if the key is not present.
|
/// `Optional` means you should expect an `Option<T>`, with `None` returned if the key is not present.
|
||||||
/// `Default` means you should expect a `T` with the default value of default if the key is not present.
|
/// `Default` means you should expect a `T` with the default value of default if the key is not present.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "decode", derive(Decode))]
|
||||||
|
#[cfg_attr(feature = "serde_full", derive(Serialize))]
|
||||||
pub enum StorageEntryModifier {
|
pub enum StorageEntryModifier {
|
||||||
/// The storage entry returns an `Option<T>`, with `None` if the key is not present.
|
/// The storage entry returns an `Option<T>`, with `None` if the key is not present.
|
||||||
Optional,
|
Optional,
|
||||||
@@ -247,8 +252,9 @@ pub enum StorageEntryModifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Hasher used by storage maps
|
/// Hasher used by storage maps
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "decode", derive(Decode))]
|
||||||
|
#[cfg_attr(feature = "serde_full", derive(Serialize))]
|
||||||
pub enum StorageHasher {
|
pub enum StorageHasher {
|
||||||
/// 128-bit Blake2 hash.
|
/// 128-bit Blake2 hash.
|
||||||
Blake2_128,
|
Blake2_128,
|
||||||
@@ -267,10 +273,11 @@ pub enum StorageHasher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A type of storage value.
|
/// A type of storage value.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "decode", derive(Decode))]
|
||||||
|
#[cfg_attr(feature = "serde_full", derive(Serialize))]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "std",
|
feature = "serde_full",
|
||||||
serde(bound(serialize = "T::Type: Serialize, T::String: Serialize"))
|
serde(bound(serialize = "T::Type: Serialize, T::String: Serialize"))
|
||||||
)]
|
)]
|
||||||
pub enum StorageEntryType<T: Form = MetaForm> {
|
pub enum StorageEntryType<T: Form = MetaForm> {
|
||||||
@@ -307,10 +314,11 @@ impl IntoPortable for StorageEntryType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Metadata for all calls in a pallet
|
/// Metadata for all calls in a pallet
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "decode", derive(Decode))]
|
||||||
|
#[cfg_attr(feature = "serde_full", derive(Serialize))]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "std",
|
feature = "serde_full",
|
||||||
serde(bound(serialize = "T::Type: Serialize, T::String: Serialize"))
|
serde(bound(serialize = "T::Type: Serialize, T::String: Serialize"))
|
||||||
)]
|
)]
|
||||||
pub struct PalletCallMetadata<T: Form = MetaForm> {
|
pub struct PalletCallMetadata<T: Form = MetaForm> {
|
||||||
@@ -335,8 +343,9 @@ impl From<MetaType> for PalletCallMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Metadata about the pallet Event type.
|
/// Metadata about the pallet Event type.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "decode", derive(Decode))]
|
||||||
|
#[cfg_attr(feature = "serde_full", derive(Serialize))]
|
||||||
pub struct PalletEventMetadata<T: Form = MetaForm> {
|
pub struct PalletEventMetadata<T: Form = MetaForm> {
|
||||||
/// The Event type.
|
/// The Event type.
|
||||||
pub ty: T::Type,
|
pub ty: T::Type,
|
||||||
@@ -359,10 +368,11 @@ impl From<MetaType> for PalletEventMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Metadata about one pallet constant.
|
/// Metadata about one pallet constant.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "decode", derive(Decode))]
|
||||||
|
#[cfg_attr(feature = "serde_full", derive(Serialize))]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "std",
|
feature = "serde_full",
|
||||||
serde(bound(serialize = "T::Type: Serialize, T::String: Serialize"))
|
serde(bound(serialize = "T::Type: Serialize, T::String: Serialize"))
|
||||||
)]
|
)]
|
||||||
pub struct PalletConstantMetadata<T: Form = MetaForm> {
|
pub struct PalletConstantMetadata<T: Form = MetaForm> {
|
||||||
@@ -390,9 +400,10 @@ impl IntoPortable for PalletConstantMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Metadata about a pallet error.
|
/// Metadata about a pallet error.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "decode", derive(Decode))]
|
||||||
#[cfg_attr(feature = "std", serde(bound(serialize = "T::Type: Serialize")))]
|
#[cfg_attr(feature = "serde_full", derive(Serialize))]
|
||||||
|
#[cfg_attr(feature = "serde_full", serde(bound(serialize = "T::Type: Serialize")))]
|
||||||
pub struct PalletErrorMetadata<T: Form = MetaForm> {
|
pub struct PalletErrorMetadata<T: Form = MetaForm> {
|
||||||
/// The error type information.
|
/// The error type information.
|
||||||
pub ty: T::Type,
|
pub ty: T::Type,
|
||||||
|
|||||||
+28
-29
@@ -42,8 +42,8 @@ cfg_if::cfg_if! {
|
|||||||
pub const META_RESERVED: u32 = 0x6174656d; // 'meta' warn endianness
|
pub const META_RESERVED: u32 = 0x6174656d; // 'meta' warn endianness
|
||||||
|
|
||||||
/// All the metadata about a function.
|
/// All the metadata about a function.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Debug, Serialize))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct FunctionMetadata {
|
pub struct FunctionMetadata {
|
||||||
/// Function name.
|
/// Function name.
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
@@ -54,8 +54,8 @@ pub struct FunctionMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// All the metadata about a function argument.
|
/// All the metadata about a function argument.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Debug, Serialize))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct FunctionArgumentMetadata {
|
pub struct FunctionArgumentMetadata {
|
||||||
/// Name of the variable for the argument.
|
/// Name of the variable for the argument.
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
@@ -64,8 +64,8 @@ pub struct FunctionArgumentMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// All the metadata about an outer event.
|
/// All the metadata about an outer event.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Debug, Serialize))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct OuterEventMetadata {
|
pub struct OuterEventMetadata {
|
||||||
/// Name of the event.
|
/// Name of the event.
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
@@ -77,8 +77,8 @@ pub struct OuterEventMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// All the metadata about an event.
|
/// All the metadata about an event.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Debug, Serialize))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct EventMetadata {
|
pub struct EventMetadata {
|
||||||
/// Name of the event.
|
/// Name of the event.
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
@@ -89,8 +89,8 @@ pub struct EventMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// All the metadata about one storage entry.
|
/// All the metadata about one storage entry.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Debug, Serialize))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct StorageEntryMetadata {
|
pub struct StorageEntryMetadata {
|
||||||
/// Variable name of the storage entry.
|
/// Variable name of the storage entry.
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
@@ -105,8 +105,8 @@ pub struct StorageEntryMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// All the metadata about one module constant.
|
/// All the metadata about one module constant.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Debug, Serialize))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct ModuleConstantMetadata {
|
pub struct ModuleConstantMetadata {
|
||||||
/// Name of the module constant.
|
/// Name of the module constant.
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
@@ -119,8 +119,8 @@ pub struct ModuleConstantMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// All the metadata about a module error.
|
/// All the metadata about a module error.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Debug, Serialize))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct ErrorMetadata {
|
pub struct ErrorMetadata {
|
||||||
/// Name of the error.
|
/// Name of the error.
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
@@ -181,16 +181,15 @@ impl serde::Serialize for DefaultByteGetter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
impl core::fmt::Debug for DefaultByteGetter {
|
||||||
impl std::fmt::Debug for DefaultByteGetter {
|
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
|
||||||
self.0.default_byte().fmt(f)
|
self.0.default_byte().fmt(f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Hasher used by storage maps
|
/// Hasher used by storage maps
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Debug, Serialize))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub enum StorageHasher {
|
pub enum StorageHasher {
|
||||||
/// 128-bit Blake2 hash.
|
/// 128-bit Blake2 hash.
|
||||||
Blake2_128,
|
Blake2_128,
|
||||||
@@ -205,8 +204,8 @@ pub enum StorageHasher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A storage entry type.
|
/// A storage entry type.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Debug, Serialize))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub enum StorageEntryType {
|
pub enum StorageEntryType {
|
||||||
/// Plain storage entry (just the value).
|
/// Plain storage entry (just the value).
|
||||||
Plain(DecodeDifferentStr),
|
Plain(DecodeDifferentStr),
|
||||||
@@ -240,8 +239,8 @@ pub enum StorageEntryType {
|
|||||||
///
|
///
|
||||||
/// `Optional` means you should expect an `Option<T>`, with `None` returned if the key is not present.
|
/// `Optional` means you should expect an `Option<T>`, with `None` returned if the key is not present.
|
||||||
/// `Default` means you should expect a `T` with the default value of default if the key is not present.
|
/// `Default` means you should expect a `T` with the default value of default if the key is not present.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Debug, Serialize))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub enum StorageEntryModifier {
|
pub enum StorageEntryModifier {
|
||||||
/// The storage entry returns an `Option<T>`, with `None` if the key is not present.
|
/// The storage entry returns an `Option<T>`, with `None` if the key is not present.
|
||||||
Optional,
|
Optional,
|
||||||
@@ -250,8 +249,8 @@ pub enum StorageEntryModifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// All metadata of the storage.
|
/// All metadata of the storage.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Debug, Serialize))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct StorageMetadata {
|
pub struct StorageMetadata {
|
||||||
/// The common prefix used by all storage entries.
|
/// The common prefix used by all storage entries.
|
||||||
pub prefix: DecodeDifferent<&'static str, StringBuf>,
|
pub prefix: DecodeDifferent<&'static str, StringBuf>,
|
||||||
@@ -259,8 +258,8 @@ pub struct StorageMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The metadata of a runtime.
|
/// The metadata of a runtime.
|
||||||
#[derive(Eq, Encode, PartialEq)]
|
#[derive(Eq, Encode, PartialEq, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Debug, Serialize))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct RuntimeMetadataV8 {
|
pub struct RuntimeMetadataV8 {
|
||||||
pub modules: DecodeDifferentArray<ModuleMetadata>,
|
pub modules: DecodeDifferentArray<ModuleMetadata>,
|
||||||
}
|
}
|
||||||
@@ -269,8 +268,8 @@ pub struct RuntimeMetadataV8 {
|
|||||||
pub type RuntimeMetadataLastVersion = RuntimeMetadataV8;
|
pub type RuntimeMetadataLastVersion = RuntimeMetadataV8;
|
||||||
|
|
||||||
/// All metadata about a runtime module.
|
/// All metadata about a runtime module.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Debug, Serialize))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct ModuleMetadata {
|
pub struct ModuleMetadata {
|
||||||
/// Module name.
|
/// Module name.
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
|
|||||||
+25
-25
@@ -43,8 +43,8 @@ cfg_if::cfg_if! {
|
|||||||
pub const META_RESERVED: u32 = 0x6174656d; // 'meta' warn endianness
|
pub const META_RESERVED: u32 = 0x6174656d; // 'meta' warn endianness
|
||||||
|
|
||||||
/// All the metadata about a function.
|
/// All the metadata about a function.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct FunctionMetadata {
|
pub struct FunctionMetadata {
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
pub arguments: DecodeDifferentArray<FunctionArgumentMetadata>,
|
pub arguments: DecodeDifferentArray<FunctionArgumentMetadata>,
|
||||||
@@ -52,15 +52,15 @@ pub struct FunctionMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// All the metadata about a function argument.
|
/// All the metadata about a function argument.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct FunctionArgumentMetadata {
|
pub struct FunctionArgumentMetadata {
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
pub ty: DecodeDifferentStr,
|
pub ty: DecodeDifferentStr,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// All the metadata about an outer event.
|
/// All the metadata about an outer event.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct OuterEventMetadata {
|
pub struct OuterEventMetadata {
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
@@ -71,8 +71,8 @@ pub struct OuterEventMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// All the metadata about an event.
|
/// All the metadata about an event.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct EventMetadata {
|
pub struct EventMetadata {
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
pub arguments: DecodeDifferentArray<&'static str, StringBuf>,
|
pub arguments: DecodeDifferentArray<&'static str, StringBuf>,
|
||||||
@@ -80,8 +80,8 @@ pub struct EventMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// All the metadata about one storage entry.
|
/// All the metadata about one storage entry.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct StorageEntryMetadata {
|
pub struct StorageEntryMetadata {
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
pub modifier: StorageEntryModifier,
|
pub modifier: StorageEntryModifier,
|
||||||
@@ -91,8 +91,8 @@ pub struct StorageEntryMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// All the metadata about one module constant.
|
/// All the metadata about one module constant.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct ModuleConstantMetadata {
|
pub struct ModuleConstantMetadata {
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
pub ty: DecodeDifferentStr,
|
pub ty: DecodeDifferentStr,
|
||||||
@@ -101,8 +101,8 @@ pub struct ModuleConstantMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// All the metadata about a module error.
|
/// All the metadata about a module error.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct ErrorMetadata {
|
pub struct ErrorMetadata {
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
pub documentation: DecodeDifferentArray<&'static str, StringBuf>,
|
pub documentation: DecodeDifferentArray<&'static str, StringBuf>,
|
||||||
@@ -166,8 +166,8 @@ impl core::fmt::Debug for DefaultByteGetter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Hasher used by storage maps
|
/// Hasher used by storage maps
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub enum StorageHasher {
|
pub enum StorageHasher {
|
||||||
Blake2_128,
|
Blake2_128,
|
||||||
Blake2_256,
|
Blake2_256,
|
||||||
@@ -178,8 +178,8 @@ pub enum StorageHasher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A storage entry type.
|
/// A storage entry type.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub enum StorageEntryType {
|
pub enum StorageEntryType {
|
||||||
Plain(DecodeDifferentStr),
|
Plain(DecodeDifferentStr),
|
||||||
Map {
|
Map {
|
||||||
@@ -202,16 +202,16 @@ pub enum StorageEntryType {
|
|||||||
///
|
///
|
||||||
/// `Optional` means you should expect an `Option<T>`, with `None` returned if the key is not present.
|
/// `Optional` means you should expect an `Option<T>`, with `None` returned if the key is not present.
|
||||||
/// `Default` means you should expect a `T` with the default value of default if the key is not present.
|
/// `Default` means you should expect a `T` with the default value of default if the key is not present.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub enum StorageEntryModifier {
|
pub enum StorageEntryModifier {
|
||||||
Optional,
|
Optional,
|
||||||
Default,
|
Default,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// All metadata of the storage.
|
/// All metadata of the storage.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct StorageMetadata {
|
pub struct StorageMetadata {
|
||||||
/// The common prefix used by all storage entries.
|
/// The common prefix used by all storage entries.
|
||||||
pub prefix: DecodeDifferent<&'static str, StringBuf>,
|
pub prefix: DecodeDifferent<&'static str, StringBuf>,
|
||||||
@@ -219,15 +219,15 @@ pub struct StorageMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The metadata of a runtime.
|
/// The metadata of a runtime.
|
||||||
#[derive(Eq, Encode, PartialEq)]
|
#[derive(Eq, Encode, PartialEq, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct RuntimeMetadataV9 {
|
pub struct RuntimeMetadataV9 {
|
||||||
pub modules: DecodeDifferentArray<ModuleMetadata>,
|
pub modules: DecodeDifferentArray<ModuleMetadata>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// All metadata about an runtime module.
|
/// All metadata about an runtime module.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "std", derive(Decode, Serialize, Debug))]
|
#[cfg_attr(feature = "std", derive(Decode, Serialize))]
|
||||||
pub struct ModuleMetadata {
|
pub struct ModuleMetadata {
|
||||||
pub name: DecodeDifferentStr,
|
pub name: DecodeDifferentStr,
|
||||||
pub storage: Option<DecodeDifferent<FnEncode<StorageMetadata>, StorageMetadata>>,
|
pub storage: Option<DecodeDifferent<FnEncode<StorageMetadata>, StorageMetadata>>,
|
||||||
|
|||||||
Reference in New Issue
Block a user