mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 03:27:58 +00:00
Make constants exposable in metadata (#2975)
* Some cleanup * Add module constant metadata declaration * Begin to integrate the constants in `decl_module` * Fixes tests * Fix compilation and add tests * Remove duplicate code * Expose constants in democracy and staking + further fixes * Update srml/metadata/src/lib.rs Co-Authored-By: YJ <yjkimjunior@gmail.com> * Hide `RawEvent` metadata function * Prevent whitespaces in types * Fix `offchain_worker` and `constants` with instances * Up the `impl_version` * Fix macro * Incrase impl_version
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
|
||||
use runtime_io::{with_externalities, Blake2Hasher};
|
||||
use srml_support::{
|
||||
Parameter,
|
||||
Parameter, traits::Get, parameter_types,
|
||||
runtime_primitives::{generic, BuildStorage, traits::{BlakeTwo256, Block as _, Verify}},
|
||||
};
|
||||
use inherents::{
|
||||
@@ -40,10 +40,13 @@ mod module1 {
|
||||
pub trait Trait<I>: system::Trait {
|
||||
type Event: From<Event<Self, I>> + Into<<Self as system::Trait>::Event>;
|
||||
type Origin: From<Origin<Self, I>>;
|
||||
type SomeParameter: Get<u32>;
|
||||
}
|
||||
|
||||
srml_support::decl_module! {
|
||||
pub struct Module<T: Trait<I>, I: InstantiableThing> for enum Call where origin: <T as system::Trait>::Origin {
|
||||
fn offchain_worker() {}
|
||||
|
||||
fn deposit_event<T, I>() = default;
|
||||
|
||||
fn one() {
|
||||
@@ -165,13 +168,19 @@ mod module3 {
|
||||
}
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const SomeValue: u32 = 100;
|
||||
}
|
||||
|
||||
impl module1::Trait<module1::Instance1> for Runtime {
|
||||
type Event = Event;
|
||||
type Origin = Origin;
|
||||
type SomeParameter = SomeValue;
|
||||
}
|
||||
impl module1::Trait<module1::Instance2> for Runtime {
|
||||
type Event = Event;
|
||||
type Origin = Origin;
|
||||
type SomeParameter = SomeValue;
|
||||
}
|
||||
impl module2::Trait for Runtime {
|
||||
type Amount = u16;
|
||||
|
||||
Reference in New Issue
Block a user