One of the core modules we have so far. We get runtime metadata using it, and fetching storage items for all of other modules.
interface StateModule {
suspend fun getRuntimeMetadata(): RuntimeMetadata?
suspend fun <T: Any> fetchStorageItem(
item: RuntimeModuleStorageItem,
storage: RuntimeModuleStorage,
type: KClass<T>
): T?
suspend fun <T: Any> fetchStorageItem(
item: RuntimeModuleStorageItem,
key: ByteArrayConvertible,
storage: RuntimeModuleStorage,
type: KClass<T>
): T?
suspend fun <T: Any> fetchStorageItem(
item: RuntimeModuleStorageItem,
keys: List<ByteArrayConvertible>,
storage: RuntimeModuleStorage,
type: KClass<T>
): T?
}
val client: SubstrateClient
val runtimeMetadata: RuntimeMetadata? = client.modules.state.getRuntimeMetadata()
For fetching storage items, we strongly encourage not to use them as we have a powerful storage service.