getStorage method

Future<StorageData?> getStorage(
  1. StorageKey key,
  2. {BlockHash? at}
)

Returns a storage entry at a specific block's state.

Implementation

Future<StorageData?> getStorage(StorageKey key, {BlockHash? at}) async {
  final List<String> params = ['0x${hex.encode(key)}'];
  if (at != null) {
    params.add('0x${hex.encode(at)}');
  }
  final response = await _provider.send('state_getStorage', params);
  final data = response.result as String?;
  return data == null
      ? null
      : Uint8List.fromList(hex.decode(data.substring(2)));
}