mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-20 22:05:42 +00:00
Include default values in storage metadata (#1264)
* Add a 'default' field to metadata. It contains code to generate the default value. * wasm update * Make 'default' field an `Option` * Boxed fn is not static, that won't be fine * static fn won't do it to as it cannot get T param, will try fat trait * Fat pointer over phantom data compatible with static instantiation * DecodeDifferent is cool, using it for decoding. * using once cell to do what would require copying lazy_static internals. * Remove cache when no_std (non compatible deps) * wasm bins update * Fuse tooling struct and enum derive.
This commit is contained in:
@@ -15,7 +15,8 @@
|
||||
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
pub use srml_metadata::{
|
||||
DecodeDifferent, FnEncode, RuntimeMetadata, RuntimeModuleMetadata
|
||||
DecodeDifferent, FnEncode, RuntimeMetadata, RuntimeModuleMetadata,
|
||||
DefaultByteGetter,
|
||||
};
|
||||
|
||||
/// Implements the metadata support for the given runtime and all its modules.
|
||||
@@ -188,7 +189,7 @@ mod tests {
|
||||
StorageMethod : Option<u32>;
|
||||
}
|
||||
add_extra_genesis {
|
||||
build(|_, _, _| {});
|
||||
build(|_, _, _| {});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -311,15 +312,20 @@ mod tests {
|
||||
)),
|
||||
storage: Some(DecodeDifferent::Encode(FnEncode(||
|
||||
StorageMetadata {
|
||||
prefix: DecodeDifferent::Encode("TestStorage"),
|
||||
functions: DecodeDifferent::Encode(&[
|
||||
StorageFunctionMetadata {
|
||||
name: DecodeDifferent::Encode("StorageMethod"),
|
||||
modifier: StorageFunctionModifier::Optional,
|
||||
ty: StorageFunctionType::Plain(DecodeDifferent::Encode("u32")),
|
||||
documentation: DecodeDifferent::Encode(&[]),
|
||||
}
|
||||
])
|
||||
prefix: DecodeDifferent::Encode("TestStorage"),
|
||||
functions: DecodeDifferent::Encode(&[
|
||||
StorageFunctionMetadata {
|
||||
name: DecodeDifferent::Encode("StorageMethod"),
|
||||
modifier: StorageFunctionModifier::Optional,
|
||||
ty: StorageFunctionType::Plain(DecodeDifferent::Encode("u32")),
|
||||
default: DecodeDifferent::Encode(
|
||||
DefaultByteGetter(
|
||||
&event_module2::__GetByteStructStorageMethod(::std::marker::PhantomData::<TestRuntime>)
|
||||
)
|
||||
),
|
||||
documentation: DecodeDifferent::Encode(&[]),
|
||||
}
|
||||
])
|
||||
}
|
||||
))),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user