getUncleByBlockHashAndIndex method
Get uncle by block hash and index. Returns information about an uncle by block hash and uncle index position. Note: An uncle doesn't contain individual transactions. Hash of a block and integer of the uncle index position. Returns see getBlockByHash.
Implementation
Future<EthereumBlock?> getUncleByBlockHashAndIndex(
EthereumData? blockHash, int? index) async {
if (blockHash == null) {
throw ArgumentError.notNull(
'Ethereum::getUncleByBlockHashAndIndex - blockHash');
}
if (index == null) {
throw ArgumentError.notNull(
'Ethereum::getUncleByBlockHashAndIndex - index');
}
final dynamic params = <String?>[
blockHash.asString,
EthereumUtilities.intToHex(index)
];
const method = EthereumRpcMethods.getUncleByBlockHashAndIndex;
final dynamic res = await _client.rpcClient.request(method, params);
if (res != null && res.containsKey(EthereumConstants.ethResultKey)) {
return EthereumBlock.fromMap(res[EthereumConstants.ethResultKey]);
}
_client.processError(method, res);
return null;
}