personalImportRawKey method
Imports the given unencrypted private key (byte string) into the key store, encrypting it with the passphrase.
Implementation
Future<EthereumData?> personalImportRawKey(
String? keydata, String? passphrase) async {
if (keydata == null) {
throw ArgumentError.notNull('Ethereum::personalImportRawKey - keydata');
}
if (passphrase == null) {
throw ArgumentError.notNull(
'Ethereum::personalImportRawKey - passphrase');
}
const method = EthereumRpcMethods.importRawKey;
final params = <String>[keydata, 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;
}