getBlockByNumber method
Get block by number Returns information about a block by block number. blockNumber - defualt block parameter as in the default block parameter. A boolean, if true it returns the full transaction objects, if false only the hashes of the transactions, defaults to true. Returns See getBlockByHash
Implementation
Future<MoacBlock> getBlockByNumber(MoacDefaultBlock blockNumber,
[bool full = true]) async {
if (blockNumber == null) {
throw ArgumentError.notNull("Moac::getBlockByNumber - blockNumber");
}
final String blockString = blockNumber.getSelection();
final dynamic params = [blockString, full];
final String method = MoacRpcMethods.getBlockByNumber;
final res = await rpcClient.request(method, params);
if (res != null && res.containsKey(moacResultKey)) {
return MoacBlock.fromMap(res[moacResultKey]);
}
_processError(method, res);
return null;
}