mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 14:37:57 +00:00
Adds instance support for composite enums (#1857)
Fixes https://github.com/paritytech/polkadot-sdk/issues/1839 Currently, `composite_enum`s do not support pallet instances. This PR allows the following: ```rust #[pallet::composite_enum] pub enum HoldReason<I: 'static = ()> { SomeHoldReason } ``` ### Todo - [x] UI Test
This commit is contained in:
@@ -1646,8 +1646,7 @@ pub mod pallet_prelude {
|
||||
/// the enum:
|
||||
///
|
||||
/// ```ignore
|
||||
/// Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, MaxEncodedLen, TypeInfo,
|
||||
/// RuntimeDebug
|
||||
/// Copy, Clone, Eq, PartialEq, Encode, Decode, MaxEncodedLen, TypeInfo, RuntimeDebug
|
||||
/// ```
|
||||
///
|
||||
/// The inverse is also true: if there are any #[derive] attributes present for the enum, then
|
||||
@@ -1815,6 +1814,15 @@ pub mod pallet_prelude {
|
||||
/// #[pallet::origin]
|
||||
/// pub struct Origin<T>(PhantomData<T>);
|
||||
///
|
||||
/// // Declare a hold reason (this is optional).
|
||||
/// //
|
||||
/// // Creates a hold reason for this pallet that is aggregated by `construct_runtime`.
|
||||
/// // A similar enum can be defined for `FreezeReason`, `LockId` or `SlashReason`.
|
||||
/// #[pallet::composite_enum]
|
||||
/// pub enum HoldReason {
|
||||
/// SomeHoldReason
|
||||
/// }
|
||||
///
|
||||
/// // Declare validate_unsigned implementation (this is optional).
|
||||
/// #[pallet::validate_unsigned]
|
||||
/// impl<T: Config> ValidateUnsigned for Pallet<T> {
|
||||
@@ -1949,6 +1957,11 @@ pub mod pallet_prelude {
|
||||
/// #[pallet::origin]
|
||||
/// pub struct Origin<T, I = ()>(PhantomData<(T, I)>);
|
||||
///
|
||||
/// #[pallet::composite_enum]
|
||||
/// pub enum HoldReason<I: 'static = ()> {
|
||||
/// SomeHoldReason
|
||||
/// }
|
||||
///
|
||||
/// #[pallet::validate_unsigned]
|
||||
/// impl<T: Config<I>, I: 'static> ValidateUnsigned for Pallet<T, I> {
|
||||
/// type Call = Call<T, I>;
|
||||
|
||||
Reference in New Issue
Block a user