getBlockTransactionCountByHash method
Block Transaction Count By Hash The number of transactions 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> getBlockTransactionCountByHash(BigInt blockHash) async {
if (blockHash == null) {
throw ArgumentError.notNull(
"Moac::getBlockTransactionCountByHash - blockHash");
}
final String method = MoacRpcMethods.blockTransactionCountByHash;
final List params = [MoacUtilities.bigIntegerToHex(blockHash)];
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;
}