getUncleCountByHash method
Block Uncle Count By Hash The number of uncles in a block from a block matching the given block hash. If the method returns null a count of 0 is returned, this is to distinguish between this and an error.
Implementation
Future<int?> getUncleCountByHash(EthereumData? blockHash) async {
if (blockHash == null) {
throw ArgumentError.notNull('Ethereum::getUncleCountByHash - blockHash');
}
const method = EthereumRpcMethods.blockUncleCountByBlockHash;
final params = <String?>[blockHash.asString];
final dynamic res = await _client.rpcClient.request(method, params);
if (res != null && res.containsKey(EthereumConstants.ethResultKey)) {
if (res[EthereumConstants.ethResultKey] != null) {
return EthereumUtilities.hexToInt(res[EthereumConstants.ethResultKey]);
} else {
return 0;
}
}
_client.processError(method, res);
return null;
}