newBlockFilter method

Future<int?> newBlockFilter()

New block filter Creates a filter in the node, to notify when a new block arrives. To check if the state has changed, call getFilterChanges. Returns a filter id.

Implementation

Future<int?> newBlockFilter() async {
  final params = <String>[];
  const method = EthereumRpcMethods.newBlockFilter;
  final dynamic res = await _client.rpcClient.request(method, params);
  if (res != null && res.containsKey(EthereumConstants.ethResultKey)) {
    return EthereumUtilities.hexToInt(res[EthereumConstants.ethResultKey]);
  }
  _client.processError(method, res);
  return null;
}