mirror of
https://github.com/pezkuwichain/pezframe-metadata.git
synced 2026-04-27 12:58:02 +00:00
fix: add back call_ty and reorder some fields (#102)
* fix: add back `call_ty` and reorder some fields * Add notes --------- Co-authored-by: James Wilson <james@jsdw.me>
This commit is contained in:
@@ -104,10 +104,10 @@ pub struct RuntimeApiMetadata<T: Form = MetaForm> {
|
|||||||
pub methods: Vec<RuntimeApiMethodMetadata<T>>,
|
pub methods: Vec<RuntimeApiMethodMetadata<T>>,
|
||||||
/// Trait documentation.
|
/// Trait documentation.
|
||||||
pub docs: Vec<T::String>,
|
pub docs: Vec<T::String>,
|
||||||
/// Deprecation info.
|
|
||||||
pub deprecation_info: ItemDeprecationInfo<T>,
|
|
||||||
/// Runtime API version.
|
/// Runtime API version.
|
||||||
pub version: Compact<u32>,
|
pub version: Compact<u32>,
|
||||||
|
/// Deprecation info.
|
||||||
|
pub deprecation_info: ItemDeprecationInfo<T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl IntoPortable for RuntimeApiMetadata {
|
impl IntoPortable for RuntimeApiMetadata {
|
||||||
@@ -118,8 +118,8 @@ impl IntoPortable for RuntimeApiMetadata {
|
|||||||
name: self.name.into_portable(registry),
|
name: self.name.into_portable(registry),
|
||||||
methods: registry.map_into_portable(self.methods),
|
methods: registry.map_into_portable(self.methods),
|
||||||
docs: registry.map_into_portable(self.docs),
|
docs: registry.map_into_portable(self.docs),
|
||||||
deprecation_info: self.deprecation_info.into_portable(registry),
|
|
||||||
version: self.version,
|
version: self.version,
|
||||||
|
deprecation_info: self.deprecation_info.into_portable(registry),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -172,6 +172,11 @@ pub struct ExtrinsicMetadata<T: Form = MetaForm> {
|
|||||||
pub versions: Vec<u8>,
|
pub versions: Vec<u8>,
|
||||||
/// The type of the address that signs the extrinsic
|
/// The type of the address that signs the extrinsic
|
||||||
pub address_ty: T::Type,
|
pub address_ty: T::Type,
|
||||||
|
/// The type of the outermost Call enum.
|
||||||
|
// Dev note: this is also exposed in outer_enums, but we duplicate
|
||||||
|
// it here so that ExtrinsicMetadata, on its own, provides everything
|
||||||
|
// needed to decode an extrinsic.
|
||||||
|
pub call_ty: T::Type,
|
||||||
/// The type of the extrinsic's signature.
|
/// The type of the extrinsic's signature.
|
||||||
pub signature_ty: T::Type,
|
pub signature_ty: T::Type,
|
||||||
/// A mapping of supported transaction extrinsic versions to their respective transaction extension indexes.
|
/// A mapping of supported transaction extrinsic versions to their respective transaction extension indexes.
|
||||||
@@ -189,6 +194,7 @@ impl IntoPortable for ExtrinsicMetadata {
|
|||||||
ExtrinsicMetadata {
|
ExtrinsicMetadata {
|
||||||
versions: self.versions,
|
versions: self.versions,
|
||||||
address_ty: registry.register_type(&self.address_ty),
|
address_ty: registry.register_type(&self.address_ty),
|
||||||
|
call_ty: registry.register_type(&self.call_ty),
|
||||||
signature_ty: registry.register_type(&self.signature_ty),
|
signature_ty: registry.register_type(&self.signature_ty),
|
||||||
transaction_extensions_by_version: self.transaction_extensions_by_version,
|
transaction_extensions_by_version: self.transaction_extensions_by_version,
|
||||||
transaction_extensions: registry.map_into_portable(self.transaction_extensions),
|
transaction_extensions: registry.map_into_portable(self.transaction_extensions),
|
||||||
@@ -494,10 +500,10 @@ impl IntoPortable for PalletAssociatedTypeMetadata {
|
|||||||
serde(bound(serialize = "T::Type: Serialize, T::String: Serialize"))
|
serde(bound(serialize = "T::Type: Serialize, T::String: Serialize"))
|
||||||
)]
|
)]
|
||||||
pub struct PalletViewFunctionMetadata<T: Form = MetaForm> {
|
pub struct PalletViewFunctionMetadata<T: Form = MetaForm> {
|
||||||
/// Method name.
|
|
||||||
pub name: T::String,
|
|
||||||
/// Method id.
|
/// Method id.
|
||||||
pub id: [u8; 32],
|
pub id: [u8; 32],
|
||||||
|
/// Method name.
|
||||||
|
pub name: T::String,
|
||||||
/// Method parameters.
|
/// Method parameters.
|
||||||
pub inputs: Vec<FunctionParamMetadata<T>>,
|
pub inputs: Vec<FunctionParamMetadata<T>>,
|
||||||
/// Method output.
|
/// Method output.
|
||||||
@@ -513,8 +519,8 @@ impl IntoPortable for PalletViewFunctionMetadata {
|
|||||||
|
|
||||||
fn into_portable(self, registry: &mut Registry) -> Self::Output {
|
fn into_portable(self, registry: &mut Registry) -> Self::Output {
|
||||||
PalletViewFunctionMetadata {
|
PalletViewFunctionMetadata {
|
||||||
name: self.name.into_portable(registry),
|
|
||||||
id: self.id,
|
id: self.id,
|
||||||
|
name: self.name.into_portable(registry),
|
||||||
inputs: registry.map_into_portable(self.inputs),
|
inputs: registry.map_into_portable(self.inputs),
|
||||||
output: registry.register_type(&self.output),
|
output: registry.register_type(&self.output),
|
||||||
docs: registry.map_into_portable(self.docs),
|
docs: registry.map_into_portable(self.docs),
|
||||||
@@ -602,6 +608,8 @@ impl IntoPortable for EnumDeprecationInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Deprecation information for an item or variant in the metadata.
|
/// Deprecation information for an item or variant in the metadata.
|
||||||
|
// Dev note: we use #[codec(index)] here to align the indexes with those
|
||||||
|
// of ItemDeprecationInfo, allowing both can decode into this asa convenience.
|
||||||
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
#[derive(Clone, PartialEq, Eq, Encode, Debug)]
|
||||||
#[cfg_attr(feature = "decode", derive(Decode))]
|
#[cfg_attr(feature = "decode", derive(Decode))]
|
||||||
#[cfg_attr(feature = "serde_full", derive(Serialize))]
|
#[cfg_attr(feature = "serde_full", derive(Serialize))]
|
||||||
@@ -611,8 +619,10 @@ impl IntoPortable for EnumDeprecationInfo {
|
|||||||
)]
|
)]
|
||||||
pub enum VariantDeprecationInfo<T: Form = MetaForm> {
|
pub enum VariantDeprecationInfo<T: Form = MetaForm> {
|
||||||
/// Variant is deprecated without a note.
|
/// Variant is deprecated without a note.
|
||||||
|
#[codec(index = 1)]
|
||||||
DeprecatedWithoutNote,
|
DeprecatedWithoutNote,
|
||||||
/// Variant is deprecated with a note and an optional `since` field.
|
/// Variant is deprecated with a note and an optional `since` field.
|
||||||
|
#[codec(index = 2)]
|
||||||
Deprecated {
|
Deprecated {
|
||||||
/// Note explaining the deprecation
|
/// Note explaining the deprecation
|
||||||
note: T::String,
|
note: T::String,
|
||||||
|
|||||||
Reference in New Issue
Block a user