submitWork method

Future<bool?> submitWork(
  1. EthereumData? nonce,
  2. EthereumData? powHash,
  3. EthereumData? digest
)

Submit work Used for submitting a proof-of-work solution. The nonce found The header's pow-hash The mix digest Returns true if the provided solution is valid, otherwise false.

Implementation

Future<bool?> submitWork(
    EthereumData? nonce, EthereumData? powHash, EthereumData? digest) async {
  if (nonce == null) {
    throw ArgumentError.notNull('Ethereum::submitWork - nonce');
  }
  if (powHash == null) {
    throw ArgumentError.notNull('Ethereum::submitWork - powHash');
  }
  if (digest == null) {
    throw ArgumentError.notNull('Ethereum::submitWork - digest');
  }
  final params = <String?>[nonce.asString, powHash.asString, digest.asString];
  const method = EthereumRpcMethods.submitWork;
  final dynamic res = await _client.rpcClient.request(method, params);
  if (res != null && res.containsKey(EthereumConstants.ethResultKey)) {
    return res[EthereumConstants.ethResultKey];
  }
  _client.processError(method, res);
  return null;
}