One of the core modules we have so far. We get runtime metadata using it, and fetching storage items for all of other modules.
public protocol StateModule: AnyObject {
func runtimeMetadata() async throws -> RuntimeMetadata?
func fetchStorageItem<T: Decodable>(
item: RuntimeModuleStorageItem,
storage: RuntimeModuleStorage
) async throws -> T?
func fetchStorageItem<T: Decodable>(
item: RuntimeModuleStorageItem,
key: Data,
storage: RuntimeModuleStorage
) async throws -> T?
func fetchStorageItem<T: Decodable>(
item: RuntimeModuleStorageItem,
keys: [Data],
storage: RuntimeModuleStorage
) async throws -> T?
}
let client: SubstrateClient
let metadata = try await client.modules.state.runtimeMetadata()
For fetching storage items, we strongly encourage not to use them as we have a powerful storage service.