getPairs method

Future<List<KeyValue>> getPairs(
  1. StorageKey prefix, {
  2. BlockHash? at,
})

Returns the keys with prefix, leave empty to get all the keys

Implementation

Future<List<KeyValue>> getPairs(StorageKey prefix, {BlockHash? at}) async {
  final List<String> params = ['0x${hex.encode(prefix)}'];
  if (at != null) {
    params.add('0x${hex.encode(at)}');
  }

  final response = await _provider.send('state_getPairs', params);
  return (response.result as List)
      .cast<List>()
      .map((keyValue) => KeyValue.fromJson(keyValue))
      .toList();
}