Is it possible to make batched storage calls to the runtime using subxt
or is it only possible to make repeated individual calls against the state?
Say there are 3 storage variables I would like to query using subxt
. I can do each of these individually:
let storage_addresses = vec![alice, bob, charlie]
.iter()
.map(|dest| subxt::dynamic::storage(
"System",
"Account",
vec![
// Something that encodes to an AccountId32 is what we need for the map key here:
Value::from_bytes(&dest),
],
)
);
let accounts = storage_addresses.iter().map(|a|
api.storage()
.fetch_or_default(&a, None)
.await?
.to_value()?
);
I'm curious if there is a smarter way to batch all these calls at once?
batch
to batch the calls? Here is an example of using the dynamic api withmultisig
that may be helpful as it uses a nested inner call just likebatch
does.batch
call: How would thecall
field be properly constructed? Say I have acall: Vec<DynamicTxPayload>
, how would you derive theValue
, e.g.subxt::dynamic::tx("Utility", "batch", vec![("call", do_something_with_calls)]
?