getBlockByHash method

Future<MoacBlock> getBlockByHash (BigInt blockHash, [ bool full = true ])

Get block by hash Returns information about a block by hash Hash of a block and a boolean, if true it returns the full transaction objects, if false only the hashes of the transactions, defaults to true. Returns A block object, or null when no block was found :

Implementation

Future<MoacBlock> getBlockByHash(BigInt blockHash, [bool full = true]) async {
  if (blockHash == null) {
    throw ArgumentError.notNull("Moac::getBlockByHash - blockHash");
  }
  final dynamic params = [MoacUtilities.bigIntegerToHex(blockHash), full];
  final String method = MoacRpcMethods.getBlockByHash;
  final res = await rpcClient.request(method, params);
  if (res != null && res.containsKey(moacResultKey)) {
    return MoacBlock.fromMap(res[moacResultKey]);
  }
  _processError(method, res);
  return null;
}