I'm trying to retrieve all values in my StorageMap defined as such in my pallet:
#[pallet::storage]
#[pallet::getter(fn submitted_tasks)]
pub type SubmittedTasks<T: Config> =
StorageMap<_, Blake2_128Concat, B3Hash, Task<T>, OptionQuery>;
from my runtime api (in runtime/src/lib.rs), currently defined as such and not working:
impl pallet_submitter_runtime_api::SubmitterRuntimeApi<Block> for Runtime {
fn get_submitted_tasks() -> Vec<Vec<u8>> {
// This macro generated getter only allows me to query one item.
SubmitterModule::submitted_tasks();
// This does not compile due to associated item not found
SubmitterModule::SubmittedTasks.iter_values().collect();
vec![]
}
}
Now from my understanding, if i use the macro generated getter, it's only possible to query one value from the StorageMap, however I would like to iterate over all values to collect them. How can I achieve this?
Note: the return type will be the vector of encoded Tasks for simplicity