storage method

Future<ChainHeadOperationResult> storage(
  1. String blockHash,
  2. List<StorageQueryItem> items, {
  3. String? childTrie,
})

Query storage items of a pinned block.

Parameters:

  • blockHash: The hash of the pinned block.
  • items: List of storage items to query.
  • childTrie: Optional child trie key.

Returns a ChainHeadOperationResult. If isStarted, use the operationId to track the operation's progress via the event stream.

Implementation

Future<ChainHeadOperationResult> storage(
  String blockHash,
  List<StorageQueryItem> items, {
  String? childTrie,
}) async {
  _ensureActive();
  final params = <dynamic>[
    followSubscriptionId,
    blockHash,
    items.map((item) => item.toJson()).toList(),
  ];
  if (childTrie != null) {
    params.add(childTrie);
  }

  final response = await _provider.send('chainHead_v1_storage', params);

  if (response.error != null) {
    throw Exception(response.error.toString());
  }

  return ChainHeadOperationResult.fromJson(Map<String, dynamic>.from(response.result as Map));
}