mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 08:11:03 +00:00
Added GetCallMetadata for extrinsic calls. (#4791)
* Added GetCallMetadata for extrinsic calls. Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com> * Improved test for outer call metadata. * fixed review comments * removed dead code * fixed review suggestions * Update frame/support/src/dispatch.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
@@ -22,6 +22,7 @@ use sp_std::{prelude::*, result, marker::PhantomData, ops::Div, fmt::Debug};
|
||||
use codec::{FullCodec, Codec, Encode, Decode};
|
||||
use sp_core::u32_trait::Value as U32;
|
||||
use sp_runtime::{
|
||||
RuntimeDebug,
|
||||
ConsensusEngineId, DispatchResult, DispatchError,
|
||||
traits::{MaybeSerializeDeserialize, SimpleArithmetic, Saturating, TrailingZeroInput},
|
||||
};
|
||||
@@ -800,3 +801,24 @@ pub trait ModuleToIndex {
|
||||
impl ModuleToIndex for () {
|
||||
fn module_to_index<M: 'static>() -> Option<usize> { Some(0) }
|
||||
}
|
||||
|
||||
/// The function and pallet name of the Call.
|
||||
#[derive(Clone, Eq, PartialEq, Default, RuntimeDebug)]
|
||||
pub struct CallMetadata {
|
||||
/// Name of the function.
|
||||
pub function_name: &'static str,
|
||||
/// Name of the pallet to which the function belongs.
|
||||
pub pallet_name: &'static str,
|
||||
}
|
||||
|
||||
/// Gets the function name of the Call.
|
||||
pub trait GetCallName {
|
||||
/// Return the function name of the Call.
|
||||
fn get_call_name(&self) -> &'static str;
|
||||
}
|
||||
|
||||
/// Gets the metadata for the Call - function name and pallet name.
|
||||
pub trait GetCallMetadata {
|
||||
/// Return a [`CallMetadata`], containing function and pallet name of the Call.
|
||||
fn get_call_metadata(&self) -> CallMetadata;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user