getUncleCountByNumber method

Future<int> getUncleCountByNumber (MoacDefaultBlock blockNumber)

Block Uncle Count By Number The number of uncles in a block matching the given block number. If the method returns null a count of 0 is returned, this is to distinguish between this and an error.

Implementation

Future<int> getUncleCountByNumber(MoacDefaultBlock blockNumber) async {
  if (blockNumber == null) {
    throw ArgumentError.notNull("Moac::getUncleCountByNumber - blockNumber");
  }
  final String method = MoacRpcMethods.blockUncleCountByBlockNumber;
  final String blockString = blockNumber.getSelection();
  final List params = [blockString];
  final res = await rpcClient.request(method, params);
  if (res != null && res.containsKey(moacResultKey)) {
    if (res[moacResultKey] != null) {
      return MoacUtilities.hexToInt(res[moacResultKey]);
    } else {
      return 0;
    }
  }
  _processError(method, res);
  return null;
}