personalEcRecover method

Future<EthereumAddress?> personalEcRecover(
  1. EthereumData? message,
  2. EthereumData? signature
)

Returns the address associated with the private key that was used to calculate the signature in personal_sign.

Implementation

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