personalNewAccount method

Future<EthereumData?> personalNewAccount(
  1. String? passphrase
)

Generates a new private key and stores it in the key store directory. The key file is encrypted with the given passphrase. Returns the address of the new account.

Implementation

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