getUncleByBlockHashAndIndex method

Future<MoacBlock> getUncleByBlockHashAndIndex (BigInt blockHash, int index)

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<MoacBlock> getUncleByBlockHashAndIndex(
    BigInt blockHash, int index) async {
  if (blockHash == null) {
    throw ArgumentError.notNull(
        "Moac::getUncleByBlockHashAndIndex - blockHash");
  }
  if (index == null) {
    throw ArgumentError.notNull("Moac::getUncleByBlockHashAndIndex - index");
  }
  final dynamic params = [
    MoacUtilities.bigIntegerToHex(blockHash),
    MoacUtilities.intToHex(index)
  ];
  final String method = MoacRpcMethods.getUncleByBlockHashAndIndex;
  final res = await rpcClient.request(method, params);
  if (res != null && res.containsKey(moacResultKey)) {
    return MoacBlock.fromMap(res[moacResultKey]);
  }
  _processError(method, res);
  return null;
}